using System;
using Microsoft.EntityFrameworkCore.Migrations;
using NodaTime;
#nullable disable
namespace DysonNetwork.Sphere.Migrations
{
///
public partial class AddPublisherSubscription : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "publisher_subscriptions",
columns: table => new
{
id = table.Column(type: "uuid", nullable: false),
publisher_id = table.Column(type: "bigint", nullable: false),
account_id = table.Column(type: "bigint", nullable: false),
status = table.Column(type: "integer", nullable: false),
tier = table.Column(type: "integer", nullable: false),
created_at = table.Column(type: "timestamp with time zone", nullable: false),
updated_at = table.Column(type: "timestamp with time zone", nullable: false),
deleted_at = table.Column(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");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "publisher_subscriptions");
}
}
}