106 lines
4.5 KiB
C#
106 lines
4.5 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
|
|
#nullable disable
|
|
|
|
namespace AAIntegration.SimmonsBank.API.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class Autoclass : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "AutoclassRules",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
Name = table.Column<string>(type: "text", nullable: false),
|
|
AccountId = table.Column<int>(type: "integer", nullable: false),
|
|
Enabled = table.Column<bool>(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<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
Field = table.Column<int>(type: "integer", nullable: false),
|
|
Value = table.Column<string>(type: "text", nullable: false),
|
|
AutoclassRuleId = table.Column<int>(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<int>(type: "integer", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
TransactionField = table.Column<int>(type: "integer", nullable: false),
|
|
CompareOperator = table.Column<int>(type: "integer", nullable: false),
|
|
Value = table.Column<string>(type: "text", nullable: false),
|
|
AutoclassRuleId = table.Column<int>(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");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "AutoclassChanges");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "AutoclassExpressions");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "AutoclassRules");
|
|
}
|
|
}
|
|
}
|