using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace CleanArchitecture.Infrastructure.Migrations { /// public partial class InitialMigration : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Tenants", columns: table => new { Id = table.Column(type: "uuid", nullable: false), Name = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), Deleted = table.Column(type: "boolean", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Tenants", x => x.Id); }); migrationBuilder.CreateTable( name: "Users", columns: table => new { Id = table.Column(type: "uuid", nullable: false), Email = table.Column(type: "character varying(320)", maxLength: 320, nullable: false), FirstName = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), LastName = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), Password = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), Role = table.Column(type: "integer", nullable: false), Status = table.Column(type: "integer", nullable: false), LastLoggedinDate = table.Column(type: "timestamp with time zone", nullable: true), TenantId = table.Column(type: "uuid", nullable: false), Deleted = table.Column(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"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Users"); migrationBuilder.DropTable( name: "Tenants"); } } }