96 lines
4.2 KiB
C#
96 lines
4.2 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using NodaTime;
|
|
|
|
#nullable disable
|
|
|
|
namespace DysonNetwork.Sphere.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class PublisherFeatures : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.RenameColumn(
|
|
name: "publisher_type",
|
|
table: "publishers",
|
|
newName: "type");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "custom_apps",
|
|
columns: table => new
|
|
{
|
|
id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
slug = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false),
|
|
name = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false),
|
|
status = table.Column<int>(type: "integer", nullable: false),
|
|
verified_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
|
|
verified_as = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
|
|
publisher_id = table.Column<Guid>(type: "uuid", 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_custom_apps", x => x.id);
|
|
table.ForeignKey(
|
|
name: "fk_custom_apps_publishers_publisher_id",
|
|
column: x => x.publisher_id,
|
|
principalTable: "publishers",
|
|
principalColumn: "id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "publisher_features",
|
|
columns: table => new
|
|
{
|
|
id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
flag = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: false),
|
|
expired_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
|
|
publisher_id = table.Column<Guid>(type: "uuid", 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_features", x => x.id);
|
|
table.ForeignKey(
|
|
name: "fk_publisher_features_publishers_publisher_id",
|
|
column: x => x.publisher_id,
|
|
principalTable: "publishers",
|
|
principalColumn: "id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "ix_custom_apps_publisher_id",
|
|
table: "custom_apps",
|
|
column: "publisher_id");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "ix_publisher_features_publisher_id",
|
|
table: "publisher_features",
|
|
column: "publisher_id");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "custom_apps");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "publisher_features");
|
|
|
|
migrationBuilder.RenameColumn(
|
|
name: "type",
|
|
table: "publishers",
|
|
newName: "publisher_type");
|
|
}
|
|
}
|
|
}
|