using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable namespace AAIntegration.SimmonsBank.API.Migrations { /// public partial class Autoclass : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "AutoclassRules", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Name = table.Column(type: "text", nullable: false), AccountId = table.Column(type: "integer", nullable: false), Enabled = table.Column(type: "boolean", nullable: false) }, constraints: table => { table.PrimaryKey("PK_AutoclassRules", x => x.Id); table.ForeignKey( name: "FK_AutoclassRules_Accounts_AccountId", column: x => x.AccountId, principalTable: "Accounts", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "AutoclassChanges", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), Field = table.Column(type: "integer", nullable: false), Value = table.Column(type: "text", nullable: false), AutoclassRuleId = table.Column(type: "integer", nullable: true) }, constraints: table => { table.PrimaryKey("PK_AutoclassChanges", x => x.Id); table.ForeignKey( name: "FK_AutoclassChanges_AutoclassRules_AutoclassRuleId", column: x => x.AutoclassRuleId, principalTable: "AutoclassRules", principalColumn: "Id"); }); migrationBuilder.CreateTable( name: "AutoclassExpressions", columns: table => new { Id = table.Column(type: "integer", nullable: false) .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), TransactionField = table.Column(type: "integer", nullable: false), CompareOperator = table.Column(type: "integer", nullable: false), Value = table.Column(type: "text", nullable: false), AutoclassRuleId = table.Column(type: "integer", nullable: true) }, constraints: table => { table.PrimaryKey("PK_AutoclassExpressions", x => x.Id); table.ForeignKey( name: "FK_AutoclassExpressions_AutoclassRules_AutoclassRuleId", column: x => x.AutoclassRuleId, principalTable: "AutoclassRules", principalColumn: "Id"); }); migrationBuilder.CreateIndex( name: "IX_AutoclassChanges_AutoclassRuleId", table: "AutoclassChanges", column: "AutoclassRuleId"); migrationBuilder.CreateIndex( name: "IX_AutoclassExpressions_AutoclassRuleId", table: "AutoclassExpressions", column: "AutoclassRuleId"); migrationBuilder.CreateIndex( name: "IX_AutoclassRules_AccountId", table: "AutoclassRules", column: "AccountId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "AutoclassChanges"); migrationBuilder.DropTable( name: "AutoclassExpressions"); migrationBuilder.DropTable( name: "AutoclassRules"); } } }