using System; using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace MyOffice.Migrations.Postgres.Migrations { /// public partial class accountcategory : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "AccountCategory", columns: table => new { Id = table.Column(type: "uuid", nullable: false), Name = table.Column(type: "text", nullable: false) }, constraints: table => { table.PrimaryKey("PK_AccountCategory", x => x.Id); }); migrationBuilder.CreateTable( name: "AccountAccountCategory", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), AccountId = table.Column(type: "uuid", nullable: false), CategoryId = table.Column(type: "uuid", nullable: false) }, constraints: table => { table.PrimaryKey("PK_AccountAccountCategory", x => x.Id); table.ForeignKey( name: "FK_AccountAccountCategory_AccountCategory_AccountId", column: x => x.AccountId, principalTable: "AccountCategory", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_AccountAccountCategory_Accounts_CategoryId", column: x => x.CategoryId, principalTable: "Accounts", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_AccountAccountCategory_AccountId", table: "AccountAccountCategory", column: "AccountId"); migrationBuilder.CreateIndex( name: "IX_AccountAccountCategory_CategoryId", table: "AccountAccountCategory", column: "CategoryId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "AccountAccountCategory"); migrationBuilder.DropTable( name: "AccountCategory"); } } }