mirror of
https://github.com/alex289/CleanArchitecture.git
synced 2025-07-01 11:02:57 +00:00
80 lines
3.6 KiB
C#
80 lines
3.6 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace CleanArchitecture.Infrastructure.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class InitialMigration : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Tenants",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
Name = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
|
|
Deleted = table.Column<bool>(type: "boolean", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Tenants", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Users",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
Email = table.Column<string>(type: "character varying(320)", maxLength: 320, nullable: false),
|
|
FirstName = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
|
|
LastName = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
|
|
Password = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
|
|
Role = table.Column<int>(type: "integer", nullable: false),
|
|
Status = table.Column<int>(type: "integer", nullable: false),
|
|
LastLoggedinDate = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
|
TenantId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
Deleted = table.Column<bool>(type: "boolean", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Users", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Users_Tenants_TenantId",
|
|
column: x => x.TenantId,
|
|
principalTable: "Tenants",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "Tenants",
|
|
columns: new[] { "Id", "Deleted", "Name" },
|
|
values: new object[] { new Guid("b542bf25-134c-47a2-a0df-84ed14d03c4a"), false, "Admin Tenant" });
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "Users",
|
|
columns: new[] { "Id", "Deleted", "Email", "FirstName", "LastLoggedinDate", "LastName", "Password", "Role", "Status", "TenantId" },
|
|
values: new object[] { new Guid("7e3892c0-9374-49fa-a3fd-53db637a40ae"), false, "admin@email.com", "Admin", null, "User", "$2a$12$Blal/uiFIJdYsCLTMUik/egLbfg3XhbnxBC6Sb5IKz2ZYhiU/MzL2", 0, 0, new Guid("b542bf25-134c-47a2-a0df-84ed14d03c4a") });
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Users_TenantId",
|
|
table: "Users",
|
|
column: "TenantId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "Users");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Tenants");
|
|
}
|
|
}
|
|
}
|