using System; using Microsoft.EntityFrameworkCore.Migrations; using NodaTime; #nullable disable namespace DysonNetwork.Sphere.Migrations { /// public partial class AddStickerAndPacks : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "sticker_packs", columns: table => new { id = table.Column(type: "uuid", nullable: false), name = table.Column(type: "character varying(1024)", maxLength: 1024, nullable: false), description = table.Column(type: "character varying(4096)", maxLength: 4096, nullable: false), prefix = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), publisher_id = table.Column(type: "bigint", 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_sticker_packs", x => x.id); table.ForeignKey( name: "fk_sticker_packs_publishers_publisher_id", column: x => x.publisher_id, principalTable: "publishers", principalColumn: "id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "stickers", columns: table => new { id = table.Column(type: "uuid", nullable: false), slug = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), image_id = table.Column(type: "character varying(128)", nullable: false), pack_id = table.Column(type: "uuid", 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_stickers", x => x.id); table.ForeignKey( name: "fk_stickers_files_image_id", column: x => x.image_id, principalTable: "files", principalColumn: "id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "fk_stickers_sticker_packs_pack_id", column: x => x.pack_id, principalTable: "sticker_packs", principalColumn: "id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "ix_sticker_packs_publisher_id", table: "sticker_packs", column: "publisher_id"); migrationBuilder.CreateIndex( name: "ix_stickers_image_id", table: "stickers", column: "image_id"); migrationBuilder.CreateIndex( name: "ix_stickers_pack_id", table: "stickers", column: "pack_id"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "stickers"); migrationBuilder.DropTable( name: "sticker_packs"); } } }