using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace EntKube.Web.Data.Migrations.SqlServer { /// public partial class AddEnvironmentsAndCustomers : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Customers", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), TenantId = table.Column(type: "uniqueidentifier", nullable: false), Name = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), CreatedAt = table.Column(type: "datetime2", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Customers", x => x.Id); table.ForeignKey( name: "FK_Customers_Tenants_TenantId", column: x => x.TenantId, principalTable: "Tenants", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "Environments", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), TenantId = table.Column(type: "uniqueidentifier", nullable: false), Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), CreatedAt = table.Column(type: "datetime2", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Environments", x => x.Id); table.ForeignKey( name: "FK_Environments_Tenants_TenantId", column: x => x.TenantId, principalTable: "Tenants", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_Customers_TenantId_Name", table: "Customers", columns: new[] { "TenantId", "Name" }, unique: true); migrationBuilder.CreateIndex( name: "IX_Environments_TenantId_Name", table: "Environments", columns: new[] { "TenantId", "Name" }, unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Customers"); migrationBuilder.DropTable( name: "Environments"); } } }