using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SecureBank.Database.Migrations
{
///
public partial class Migration1 : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Accounts",
columns: table => new
{
Id = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
FirstName = table.Column(type: "TEXT", maxLength: 100, nullable: false),
LastName = table.Column(type: "TEXT", maxLength: 100, nullable: false),
Email = table.Column(type: "TEXT", maxLength: 300, nullable: false),
PhoneNumber = table.Column(type: "TEXT", maxLength: 20, nullable: false),
LoginFailedCount = table.Column(type: "INTEGER", nullable: false),
TemporaryPassword = table.Column(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Accounts", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AccountPasswords",
columns: table => new
{
Id = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
AccountId = table.Column(type: "INTEGER", nullable: false),
Password = table.Column(type: "BLOB", maxLength: 1000, nullable: false),
LeftSalt = table.Column(type: "TEXT", maxLength: 20, nullable: false),
RightSalt = table.Column(type: "TEXT", maxLength: 20, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AccountPasswords", x => x.Id);
table.ForeignKey(
name: "FK_AccountPasswords_Accounts_AccountId",
column: x => x.AccountId,
principalTable: "Accounts",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AccountPasswordIndexes",
columns: table => new
{
AccountPasswordId = table.Column(type: "INTEGER", nullable: false),
Index = table.Column(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.ForeignKey(
name: "FK_AccountPasswordIndexes_AccountPasswords_AccountPasswordId",
column: x => x.AccountPasswordId,
principalTable: "AccountPasswords",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_AccountPasswordIndexes_AccountPasswordId",
table: "AccountPasswordIndexes",
column: "AccountPasswordId");
migrationBuilder.CreateIndex(
name: "IX_AccountPasswords_AccountId",
table: "AccountPasswords",
column: "AccountId");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AccountPasswordIndexes");
migrationBuilder.DropTable(
name: "AccountPasswords");
migrationBuilder.DropTable(
name: "Accounts");
}
}
}