Budget, admin och lite css
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
101
Aberwyn/Migrations/20250515202922_CreateBudgetSchema.cs
Normal file
101
Aberwyn/Migrations/20250515202922_CreateBudgetSchema.cs
Normal file
@@ -0,0 +1,101 @@
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Aberwyn.Migrations
|
||||
{
|
||||
public partial class CreateBudgetSchema : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "BudgetPeriods",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Year = table.Column<int>(type: "int", nullable: false),
|
||||
Month = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_BudgetPeriods", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "BudgetCategories",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Name = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Color = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
BudgetPeriodId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_BudgetCategories", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_BudgetCategories_BudgetPeriods_BudgetPeriodId",
|
||||
column: x => x.BudgetPeriodId,
|
||||
principalTable: "BudgetPeriods",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "BudgetItems",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Name = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Person = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Amount = table.Column<decimal>(type: "decimal(65,30)", nullable: false),
|
||||
IsExpense = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
IncludeInSummary = table.Column<bool>(type: "tinyint(1)", nullable: false),
|
||||
BudgetCategoryId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_BudgetItems", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_BudgetItems_BudgetCategories_BudgetCategoryId",
|
||||
column: x => x.BudgetCategoryId,
|
||||
principalTable: "BudgetCategories",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BudgetCategories_BudgetPeriodId",
|
||||
table: "BudgetCategories",
|
||||
column: "BudgetPeriodId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BudgetItems_BudgetCategoryId",
|
||||
table: "BudgetItems",
|
||||
column: "BudgetCategoryId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "BudgetItems");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "BudgetCategories");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "BudgetPeriods");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user