using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace Tnsu.ApprovalRoute.Infrastructure.Persistence.Migrations { /// public partial class AddListPartitioning : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "list_partitioning_started_at", table: "request_types", type: "timestamp with time zone", nullable: true); migrationBuilder.CreateTable( name: "request_list_partitions", columns: table => new { id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), request_type_id = table.Column(type: "integer", nullable: false), number = table.Column(type: "integer", nullable: false), list_id = table.Column(type: "character varying(512)", maxLength: 512, nullable: false), title = table.Column(type: "character varying(512)", maxLength: 512, nullable: true), created_at = table.Column(type: "timestamp with time zone", nullable: false) }, constraints: table => { table.PrimaryKey("pk_request_list_partitions", x => x.id); table.ForeignKey( name: "fk_request_list_partitions_request_types_request_type_id", column: x => x.request_type_id, principalTable: "request_types", principalColumn: "id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "ix_request_list_partitions_request_type_id_number", table: "request_list_partitions", columns: new[] { "request_type_id", "number" }, unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "request_list_partitions"); migrationBuilder.DropColumn( name: "list_partitioning_started_at", table: "request_types"); } } }