-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
385 additions
and
0 deletions.
There are no files selected for viewing
230 changes: 230 additions & 0 deletions
230
...TTY.PersonalFinanceDashboard.Infrastructure/Migrations/20241028235752_Initial.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
155 changes: 155 additions & 0 deletions
155
...ver/RobinTTY.PersonalFinanceDashboard.Infrastructure/Migrations/20241028235752_Initial.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
using System; | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
|
||
#nullable disable | ||
|
||
namespace RobinTTY.PersonalFinanceDashboard.Infrastructure.Migrations | ||
{ | ||
/// <inheritdoc /> | ||
public partial class Initial : Migration | ||
{ | ||
/// <inheritdoc /> | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.CreateTable( | ||
name: "BankingInstitutions", | ||
columns: table => new | ||
{ | ||
Id = table.Column<string>(type: "TEXT", nullable: false), | ||
Bic = table.Column<string>(type: "TEXT", nullable: false), | ||
Name = table.Column<string>(type: "TEXT", nullable: false), | ||
LogoUri = table.Column<string>(type: "TEXT", nullable: false), | ||
Countries = table.Column<string>(type: "TEXT", nullable: false) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_BankingInstitutions", x => x.Id); | ||
}); | ||
|
||
migrationBuilder.CreateTable( | ||
name: "ThirdPartyDataRetrievalMetadata", | ||
columns: table => new | ||
{ | ||
Id = table.Column<Guid>(type: "TEXT", nullable: false), | ||
DataType = table.Column<int>(type: "INTEGER", nullable: false), | ||
DataSource = table.Column<int>(type: "INTEGER", nullable: false), | ||
LastRetrievalTime = table.Column<DateTime>(type: "TEXT", nullable: false), | ||
RetrievalInterval = table.Column<TimeSpan>(type: "TEXT", nullable: false) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_ThirdPartyDataRetrievalMetadata", x => x.Id); | ||
}); | ||
|
||
migrationBuilder.CreateTable( | ||
name: "BankAccounts", | ||
columns: table => new | ||
{ | ||
Id = table.Column<Guid>(type: "TEXT", nullable: false), | ||
Iban = table.Column<string>(type: "TEXT", nullable: true), | ||
Bic = table.Column<string>(type: "TEXT", nullable: true), | ||
Bban = table.Column<string>(type: "TEXT", nullable: true), | ||
OwnerName = table.Column<string>(type: "TEXT", nullable: true), | ||
AccountType = table.Column<string>(type: "TEXT", nullable: true), | ||
AssociatedInstitutionId = table.Column<string>(type: "TEXT", nullable: true), | ||
Name = table.Column<string>(type: "TEXT", nullable: true), | ||
Description = table.Column<string>(type: "TEXT", nullable: true), | ||
Balance = table.Column<decimal>(type: "TEXT", nullable: true), | ||
Currency = table.Column<string>(type: "TEXT", nullable: true) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_BankAccounts", x => x.Id); | ||
table.ForeignKey( | ||
name: "FK_BankAccounts_BankingInstitutions_AssociatedInstitutionId", | ||
column: x => x.AssociatedInstitutionId, | ||
principalTable: "BankingInstitutions", | ||
principalColumn: "Id"); | ||
}); | ||
|
||
migrationBuilder.CreateTable( | ||
name: "Transactions", | ||
columns: table => new | ||
{ | ||
Id = table.Column<string>(type: "TEXT", nullable: false), | ||
AccountId = table.Column<string>(type: "TEXT", nullable: false), | ||
ValueDate = table.Column<DateTime>(type: "TEXT", nullable: true), | ||
Payer = table.Column<string>(type: "TEXT", nullable: true), | ||
Payee = table.Column<string>(type: "TEXT", nullable: true), | ||
Amount = table.Column<decimal>(type: "TEXT", nullable: false), | ||
Currency = table.Column<string>(type: "TEXT", nullable: false), | ||
Category = table.Column<string>(type: "TEXT", nullable: false), | ||
Notes = table.Column<string>(type: "TEXT", nullable: false), | ||
BankAccountId = table.Column<Guid>(type: "TEXT", nullable: true) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_Transactions", x => x.Id); | ||
table.ForeignKey( | ||
name: "FK_Transactions_BankAccounts_BankAccountId", | ||
column: x => x.BankAccountId, | ||
principalTable: "BankAccounts", | ||
principalColumn: "Id"); | ||
}); | ||
|
||
migrationBuilder.CreateTable( | ||
name: "Tags", | ||
columns: table => new | ||
{ | ||
Id = table.Column<string>(type: "TEXT", nullable: false), | ||
Name = table.Column<string>(type: "TEXT", nullable: false), | ||
Description = table.Column<string>(type: "TEXT", nullable: false), | ||
Color = table.Column<string>(type: "TEXT", nullable: false), | ||
TransactionId = table.Column<string>(type: "TEXT", nullable: true) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_Tags", x => x.Id); | ||
table.ForeignKey( | ||
name: "FK_Tags_Transactions_TransactionId", | ||
column: x => x.TransactionId, | ||
principalTable: "Transactions", | ||
principalColumn: "Id"); | ||
}); | ||
|
||
migrationBuilder.InsertData( | ||
table: "ThirdPartyDataRetrievalMetadata", | ||
columns: new[] { "Id", "DataSource", "DataType", "LastRetrievalTime", "RetrievalInterval" }, | ||
values: new object[] { new Guid("f948e52f-ad17-44b8-9cdf-e0b952f139b3"), 1, 1, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(7, 0, 0, 0, 0) }); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_BankAccounts_AssociatedInstitutionId", | ||
table: "BankAccounts", | ||
column: "AssociatedInstitutionId"); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_Tags_TransactionId", | ||
table: "Tags", | ||
column: "TransactionId"); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_Transactions_BankAccountId", | ||
table: "Transactions", | ||
column: "BankAccountId"); | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.DropTable( | ||
name: "Tags"); | ||
|
||
migrationBuilder.DropTable( | ||
name: "ThirdPartyDataRetrievalMetadata"); | ||
|
||
migrationBuilder.DropTable( | ||
name: "Transactions"); | ||
|
||
migrationBuilder.DropTable( | ||
name: "BankAccounts"); | ||
|
||
migrationBuilder.DropTable( | ||
name: "BankingInstitutions"); | ||
} | ||
} | ||
} |