using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Marco.Pms.DataAccess.Migrations { /// public partial class Seprated_SubscriptionPlan_And_SubscriptionPlanDetails : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_StatusMasters_Tenants_TenantId", table: "StatusMasters"); migrationBuilder.DropForeignKey( name: "FK_SubscriptionPlans_CurrencyMaster_CurrencyId", table: "SubscriptionPlans"); migrationBuilder.DropForeignKey( name: "FK_SubscriptionPlans_Employees_CreatedById", table: "SubscriptionPlans"); migrationBuilder.DropForeignKey( name: "FK_SubscriptionPlans_Employees_UpdatedById", table: "SubscriptionPlans"); migrationBuilder.DropForeignKey( name: "FK_TenantSubscriptions_SubscriptionPlans_PlanId", table: "TenantSubscriptions"); migrationBuilder.DropIndex( name: "IX_SubscriptionPlans_CreatedById", table: "SubscriptionPlans"); migrationBuilder.DropIndex( name: "IX_SubscriptionPlans_CurrencyId", table: "SubscriptionPlans"); migrationBuilder.DropIndex( name: "IX_SubscriptionPlans_UpdatedById", table: "SubscriptionPlans"); migrationBuilder.DropIndex( name: "IX_StatusMasters_TenantId", table: "StatusMasters"); migrationBuilder.DropColumn( name: "CreateAt", table: "SubscriptionPlans"); migrationBuilder.DropColumn( name: "CreatedById", table: "SubscriptionPlans"); migrationBuilder.DropColumn( name: "CurrencyId", table: "SubscriptionPlans"); migrationBuilder.DropColumn( name: "FeaturesId", table: "SubscriptionPlans"); migrationBuilder.DropColumn( name: "MaxStorage", table: "SubscriptionPlans"); migrationBuilder.DropColumn( name: "MaxUser", table: "SubscriptionPlans"); migrationBuilder.DropColumn( name: "PriceHalfYearly", table: "SubscriptionPlans"); migrationBuilder.DropColumn( name: "PriceMonthly", table: "SubscriptionPlans"); migrationBuilder.DropColumn( name: "PriceQuarterly", table: "SubscriptionPlans"); migrationBuilder.DropColumn( name: "PriceYearly", table: "SubscriptionPlans"); migrationBuilder.DropColumn( name: "TrialDays", table: "SubscriptionPlans"); migrationBuilder.DropColumn( name: "UpdateAt", table: "SubscriptionPlans"); migrationBuilder.DropColumn( name: "UpdatedById", table: "SubscriptionPlans"); migrationBuilder.DropColumn( name: "TenantId", table: "StatusMasters"); migrationBuilder.AddColumn( name: "IsCancelled", table: "TenantSubscriptions", type: "tinyint(1)", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "MaxUsers", table: "TenantSubscriptions", type: "double", nullable: false, defaultValue: 0.0); migrationBuilder.CreateTable( name: "SubscriptionPlanDetails", columns: table => new { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), Price = table.Column(type: "double", nullable: false), Frequency = table.Column(type: "int", nullable: false), TrialDays = table.Column(type: "int", nullable: false), MaxUser = table.Column(type: "double", nullable: false), MaxStorage = table.Column(type: "double", nullable: false), FeaturesId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), CreateAt = table.Column(type: "datetime(6)", nullable: false), UpdateAt = table.Column(type: "datetime(6)", nullable: true), PlanId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), CurrencyId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), CreatedById = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), UpdatedById = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), IsActive = table.Column(type: "tinyint(1)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_SubscriptionPlanDetails", x => x.Id); table.ForeignKey( name: "FK_SubscriptionPlanDetails_CurrencyMaster_CurrencyId", column: x => x.CurrencyId, principalTable: "CurrencyMaster", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_SubscriptionPlanDetails_Employees_CreatedById", column: x => x.CreatedById, principalTable: "Employees", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_SubscriptionPlanDetails_Employees_UpdatedById", column: x => x.UpdatedById, principalTable: "Employees", principalColumn: "Id"); table.ForeignKey( name: "FK_SubscriptionPlanDetails_SubscriptionPlans_PlanId", column: x => x.PlanId, principalTable: "SubscriptionPlans", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateIndex( name: "IX_SubscriptionPlanDetails_CreatedById", table: "SubscriptionPlanDetails", column: "CreatedById"); migrationBuilder.CreateIndex( name: "IX_SubscriptionPlanDetails_CurrencyId", table: "SubscriptionPlanDetails", column: "CurrencyId"); migrationBuilder.CreateIndex( name: "IX_SubscriptionPlanDetails_PlanId", table: "SubscriptionPlanDetails", column: "PlanId"); migrationBuilder.CreateIndex( name: "IX_SubscriptionPlanDetails_UpdatedById", table: "SubscriptionPlanDetails", column: "UpdatedById"); migrationBuilder.AddForeignKey( name: "FK_TenantSubscriptions_SubscriptionPlanDetails_PlanId", table: "TenantSubscriptions", column: "PlanId", principalTable: "SubscriptionPlanDetails", principalColumn: "Id", onDelete: ReferentialAction.Cascade); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_TenantSubscriptions_SubscriptionPlanDetails_PlanId", table: "TenantSubscriptions"); migrationBuilder.DropTable( name: "SubscriptionPlanDetails"); migrationBuilder.DropColumn( name: "IsCancelled", table: "TenantSubscriptions"); migrationBuilder.DropColumn( name: "MaxUsers", table: "TenantSubscriptions"); migrationBuilder.AddColumn( name: "CreateAt", table: "SubscriptionPlans", type: "datetime(6)", nullable: false, defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); migrationBuilder.AddColumn( name: "CreatedById", table: "SubscriptionPlans", type: "char(36)", nullable: false, defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), collation: "ascii_general_ci"); migrationBuilder.AddColumn( name: "CurrencyId", table: "SubscriptionPlans", type: "char(36)", nullable: false, defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), collation: "ascii_general_ci"); migrationBuilder.AddColumn( name: "FeaturesId", table: "SubscriptionPlans", type: "char(36)", nullable: false, defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), collation: "ascii_general_ci"); migrationBuilder.AddColumn( name: "MaxStorage", table: "SubscriptionPlans", type: "double", nullable: false, defaultValue: 0.0); migrationBuilder.AddColumn( name: "MaxUser", table: "SubscriptionPlans", type: "double", nullable: false, defaultValue: 0.0); migrationBuilder.AddColumn( name: "PriceHalfYearly", table: "SubscriptionPlans", type: "double", nullable: false, defaultValue: 0.0); migrationBuilder.AddColumn( name: "PriceMonthly", table: "SubscriptionPlans", type: "double", nullable: false, defaultValue: 0.0); migrationBuilder.AddColumn( name: "PriceQuarterly", table: "SubscriptionPlans", type: "double", nullable: false, defaultValue: 0.0); migrationBuilder.AddColumn( name: "PriceYearly", table: "SubscriptionPlans", type: "double", nullable: false, defaultValue: 0.0); migrationBuilder.AddColumn( name: "TrialDays", table: "SubscriptionPlans", type: "int", nullable: false, defaultValue: 0); migrationBuilder.AddColumn( name: "UpdateAt", table: "SubscriptionPlans", type: "datetime(6)", nullable: true); migrationBuilder.AddColumn( name: "UpdatedById", table: "SubscriptionPlans", type: "char(36)", nullable: true, collation: "ascii_general_ci"); migrationBuilder.AddColumn( name: "TenantId", table: "StatusMasters", type: "char(36)", nullable: false, defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), collation: "ascii_general_ci"); migrationBuilder.UpdateData( table: "StatusMasters", keyColumn: "Id", keyValue: new Guid("33deaef9-9af1-4f2a-b443-681ea0d04f81"), column: "TenantId", value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26")); migrationBuilder.UpdateData( table: "StatusMasters", keyColumn: "Id", keyValue: new Guid("603e994b-a27f-4e5d-a251-f3d69b0498ba"), column: "TenantId", value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26")); migrationBuilder.UpdateData( table: "StatusMasters", keyColumn: "Id", keyValue: new Guid("b74da4c2-d07e-46f2-9919-e75e49b12731"), column: "TenantId", value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26")); migrationBuilder.UpdateData( table: "StatusMasters", keyColumn: "Id", keyValue: new Guid("cdad86aa-8a56-4ff4-b633-9c629057dfef"), column: "TenantId", value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26")); migrationBuilder.UpdateData( table: "StatusMasters", keyColumn: "Id", keyValue: new Guid("ef1c356e-0fe0-42df-a5d3-8daee355492d"), column: "TenantId", value: new Guid("b3466e83-7e11-464c-b93a-daf047838b26")); migrationBuilder.CreateIndex( name: "IX_SubscriptionPlans_CreatedById", table: "SubscriptionPlans", column: "CreatedById"); migrationBuilder.CreateIndex( name: "IX_SubscriptionPlans_CurrencyId", table: "SubscriptionPlans", column: "CurrencyId"); migrationBuilder.CreateIndex( name: "IX_SubscriptionPlans_UpdatedById", table: "SubscriptionPlans", column: "UpdatedById"); migrationBuilder.CreateIndex( name: "IX_StatusMasters_TenantId", table: "StatusMasters", column: "TenantId"); migrationBuilder.AddForeignKey( name: "FK_StatusMasters_Tenants_TenantId", table: "StatusMasters", column: "TenantId", principalTable: "Tenants", principalColumn: "Id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "FK_SubscriptionPlans_CurrencyMaster_CurrencyId", table: "SubscriptionPlans", column: "CurrencyId", principalTable: "CurrencyMaster", principalColumn: "Id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "FK_SubscriptionPlans_Employees_CreatedById", table: "SubscriptionPlans", column: "CreatedById", principalTable: "Employees", principalColumn: "Id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "FK_SubscriptionPlans_Employees_UpdatedById", table: "SubscriptionPlans", column: "UpdatedById", principalTable: "Employees", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_TenantSubscriptions_SubscriptionPlans_PlanId", table: "TenantSubscriptions", column: "PlanId", principalTable: "SubscriptionPlans", principalColumn: "Id", onDelete: ReferentialAction.Cascade); } } }