using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace NadekoBot.Db.Migrations { /// public partial class todolist : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "todosarchive", columns: table => new { id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), userid = table.Column(type: "numeric(20,0)", nullable: false), name = table.Column(type: "text", nullable: false) }, constraints: table => { table.PrimaryKey("pk_todosarchive", x => x.id); }); migrationBuilder.CreateTable( name: "todos", columns: table => new { id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), userid = table.Column(type: "numeric(20,0)", nullable: false), todo = table.Column(type: "text", nullable: false), dateadded = table.Column(type: "timestamp without time zone", nullable: false), isdone = table.Column(type: "boolean", nullable: false), archiveid = table.Column(type: "integer", nullable: true) }, constraints: table => { table.PrimaryKey("pk_todos", x => x.id); table.ForeignKey( name: "fk_todos_todosarchive_archiveid", column: x => x.archiveid, principalTable: "todosarchive", principalColumn: "id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "ix_todos_archiveid", table: "todos", column: "archiveid"); migrationBuilder.CreateIndex( name: "ix_todos_userid", table: "todos", column: "userid"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "todos"); migrationBuilder.DropTable( name: "todosarchive"); } } }