using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace ManagerService.Migrations { /// public partial class AddSubscriptionPlanAndQuota : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "SizeBytes", table: "Resources", type: "bigint", nullable: false, defaultValue: 0L); migrationBuilder.AddColumn( name: "AiRequestsThisMonth", table: "Instances", type: "integer", nullable: false, defaultValue: 0); migrationBuilder.AddColumn( name: "AiUsageMonthKey", table: "Instances", type: "text", nullable: true); migrationBuilder.AddColumn( name: "SubscriptionPlanId", table: "Instances", type: "text", nullable: true); migrationBuilder.CreateTable( name: "SubscriptionPlans", columns: table => new { Id = table.Column(type: "text", nullable: false), Name = table.Column(type: "text", nullable: false), StorageQuotaBytes = table.Column(type: "bigint", nullable: false), AiRequestsPerMonth = table.Column(type: "integer", nullable: false) }, constraints: table => { table.PrimaryKey("PK_SubscriptionPlans", x => x.Id); }); migrationBuilder.CreateIndex( name: "IX_Instances_SubscriptionPlanId", table: "Instances", column: "SubscriptionPlanId"); migrationBuilder.AddForeignKey( name: "FK_Instances_SubscriptionPlans_SubscriptionPlanId", table: "Instances", column: "SubscriptionPlanId", principalTable: "SubscriptionPlans", principalColumn: "Id"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Instances_SubscriptionPlans_SubscriptionPlanId", table: "Instances"); migrationBuilder.DropTable( name: "SubscriptionPlans"); migrationBuilder.DropIndex( name: "IX_Instances_SubscriptionPlanId", table: "Instances"); migrationBuilder.DropColumn( name: "SizeBytes", table: "Resources"); migrationBuilder.DropColumn( name: "AiRequestsThisMonth", table: "Instances"); migrationBuilder.DropColumn( name: "AiUsageMonthKey", table: "Instances"); migrationBuilder.DropColumn( name: "SubscriptionPlanId", table: "Instances"); } } }