Files
aviq-second-boilerplate/BethanysPieShopHRM.Api/Migrations/20260319223542_InitialMigration.cs
T
2026-03-22 00:29:34 +01:00

146 lines
6.5 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace BethanysPieShopHRM.Api.Migrations
{
/// <inheritdoc />
public partial class InitialMigration : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Countries",
columns: table => new
{
CountryId = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Countries", x => x.CountryId);
});
migrationBuilder.CreateTable(
name: "JobCategories",
columns: table => new
{
JobCategoryId = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
JobCategoryName = table.Column<string>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_JobCategories", x => x.JobCategoryId);
});
migrationBuilder.CreateTable(
name: "Employees",
columns: table => new
{
EmployeeId = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
FirstName = table.Column<string>(type: "TEXT", nullable: false),
LastName = table.Column<string>(type: "TEXT", nullable: false),
BirthDate = table.Column<DateTime>(type: "TEXT", nullable: false),
Email = table.Column<string>(type: "TEXT", nullable: false),
Street = table.Column<string>(type: "TEXT", nullable: false),
Zip = table.Column<string>(type: "TEXT", nullable: false),
City = table.Column<string>(type: "TEXT", nullable: false),
CountryId = table.Column<int>(type: "INTEGER", nullable: false),
PhoneNumber = table.Column<string>(type: "TEXT", nullable: false),
Smoker = table.Column<bool>(type: "INTEGER", nullable: false),
MaritalStatus = table.Column<int>(type: "INTEGER", nullable: false),
Gender = table.Column<int>(type: "INTEGER", nullable: false),
Comment = table.Column<string>(type: "TEXT", nullable: true),
JoinedDate = table.Column<DateTime>(type: "TEXT", nullable: true),
ExitDate = table.Column<DateTime>(type: "TEXT", nullable: true),
JobCategoryId = table.Column<int>(type: "INTEGER", nullable: false),
Latitude = table.Column<double>(type: "REAL", nullable: true),
Longitude = table.Column<double>(type: "REAL", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Employees", x => x.EmployeeId);
table.ForeignKey(
name: "FK_Employees_Countries_CountryId",
column: x => x.CountryId,
principalTable: "Countries",
principalColumn: "CountryId",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Employees_JobCategories_JobCategoryId",
column: x => x.JobCategoryId,
principalTable: "JobCategories",
principalColumn: "JobCategoryId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.InsertData(
table: "Countries",
columns: new[] { "CountryId", "Name" },
values: new object[,]
{
{ 1, "Belgium" },
{ 2, "Germany" },
{ 3, "Netherlands" },
{ 4, "USA" },
{ 5, "Japan" },
{ 6, "China" },
{ 7, "UK" },
{ 8, "France" },
{ 9, "Brazil" }
});
migrationBuilder.InsertData(
table: "JobCategories",
columns: new[] { "JobCategoryId", "JobCategoryName" },
values: new object[,]
{
{ 1, "Pie research" },
{ 2, "Sales" },
{ 3, "Management" },
{ 4, "Store staff" },
{ 5, "Finance" },
{ 6, "QA" },
{ 7, "IT" },
{ 8, "Cleaning" },
{ 9, "Bakery" }
});
migrationBuilder.InsertData(
table: "Employees",
columns: new[] { "EmployeeId", "BirthDate", "City", "Comment", "CountryId", "Email", "ExitDate", "FirstName", "Gender", "JobCategoryId", "JoinedDate", "LastName", "Latitude", "Longitude", "MaritalStatus", "PhoneNumber", "Smoker", "Street", "Zip" },
values: new object[] { 1, new DateTime(1979, 1, 16, 0, 0, 0, 0, DateTimeKind.Unspecified), "Brussels", "Lorem Ipsum", 1, "bethany@bethanyspieshop.com", null, "Bethany", 1, 1, new DateTime(2015, 3, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "Smith", 50.850299999999997, 4.3517000000000001, 1, "324777888773", false, "Grote Markt 1", "1000" });
migrationBuilder.CreateIndex(
name: "IX_Employees_CountryId",
table: "Employees",
column: "CountryId");
migrationBuilder.CreateIndex(
name: "IX_Employees_JobCategoryId",
table: "Employees",
column: "JobCategoryId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Employees");
migrationBuilder.DropTable(
name: "Countries");
migrationBuilder.DropTable(
name: "JobCategories");
}
}
}