using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace IoTSharp.Data.Sqlite.Migrations { public partial class AddTenantInfoAndToken : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_BaseEvents_Customer_CustomerId", table: "BaseEvents"); migrationBuilder.DropForeignKey( name: "FK_BaseEvents_Tenant_TenantId", table: "BaseEvents"); migrationBuilder.AlterColumn( name: "TenantId", table: "BaseEvents", type: "TEXT", nullable: true, oldClrType: typeof(Guid), oldType: "TEXT"); migrationBuilder.AlterColumn( name: "CustomerId", table: "BaseEvents", type: "TEXT", nullable: true, oldClrType: typeof(Guid), oldType: "TEXT"); migrationBuilder.AddForeignKey( name: "FK_BaseEvents_Customer_CustomerId", table: "BaseEvents", column: "CustomerId", principalTable: "Customer", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_BaseEvents_Tenant_TenantId", table: "BaseEvents", column: "TenantId", principalTable: "Tenant", principalColumn: "Id"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_BaseEvents_Customer_CustomerId", table: "BaseEvents"); migrationBuilder.DropForeignKey( name: "FK_BaseEvents_Tenant_TenantId", table: "BaseEvents"); migrationBuilder.AlterColumn( name: "TenantId", table: "BaseEvents", type: "TEXT", nullable: false, defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), oldClrType: typeof(Guid), oldType: "TEXT", oldNullable: true); migrationBuilder.AlterColumn( name: "CustomerId", table: "BaseEvents", type: "TEXT", nullable: false, defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), oldClrType: typeof(Guid), oldType: "TEXT", oldNullable: true); migrationBuilder.AddForeignKey( name: "FK_BaseEvents_Customer_CustomerId", table: "BaseEvents", column: "CustomerId", principalTable: "Customer", principalColumn: "Id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "FK_BaseEvents_Tenant_TenantId", table: "BaseEvents", column: "TenantId", principalTable: "Tenant", principalColumn: "Id", onDelete: ReferentialAction.Cascade); } } }