64 lines
2.6 KiB
C#
64 lines
2.6 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using NodaTime;
|
|
|
|
#nullable disable
|
|
|
|
namespace DysonNetwork.Sphere.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddPublisherSubscription : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "publisher_subscriptions",
|
|
columns: table => new
|
|
{
|
|
id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
publisher_id = table.Column<long>(type: "bigint", nullable: false),
|
|
account_id = table.Column<long>(type: "bigint", nullable: false),
|
|
status = table.Column<int>(type: "integer", nullable: false),
|
|
tier = table.Column<int>(type: "integer", nullable: false),
|
|
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
|
|
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
|
|
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("pk_publisher_subscriptions", x => x.id);
|
|
table.ForeignKey(
|
|
name: "fk_publisher_subscriptions_accounts_account_id",
|
|
column: x => x.account_id,
|
|
principalTable: "accounts",
|
|
principalColumn: "id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "fk_publisher_subscriptions_publishers_publisher_id",
|
|
column: x => x.publisher_id,
|
|
principalTable: "publishers",
|
|
principalColumn: "id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "ix_publisher_subscriptions_account_id",
|
|
table: "publisher_subscriptions",
|
|
column: "account_id");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "ix_publisher_subscriptions_publisher_id",
|
|
table: "publisher_subscriptions",
|
|
column: "publisher_id");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "publisher_subscriptions");
|
|
}
|
|
}
|
|
}
|