using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace OTSSignsOrchestrator.Core.Migrations { /// public partial class RemoveCmsInstancesAndSecretMetadata : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_OperationLogs_CmsInstances_InstanceId", table: "OperationLogs"); migrationBuilder.DropTable( name: "CmsInstances"); migrationBuilder.DropTable( name: "SecretMetadata"); migrationBuilder.DropIndex( name: "IX_OperationLogs_InstanceId", table: "OperationLogs"); migrationBuilder.DropColumn( name: "InstanceId", table: "OperationLogs"); migrationBuilder.AddColumn( name: "StackName", table: "OperationLogs", type: "TEXT", maxLength: 150, nullable: true); migrationBuilder.CreateIndex( name: "IX_OperationLogs_StackName", table: "OperationLogs", column: "StackName"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropIndex( name: "IX_OperationLogs_StackName", table: "OperationLogs"); migrationBuilder.DropColumn( name: "StackName", table: "OperationLogs"); migrationBuilder.AddColumn( name: "InstanceId", table: "OperationLogs", type: "TEXT", nullable: true); migrationBuilder.CreateTable( name: "CmsInstances", columns: table => new { Id = table.Column(type: "TEXT", nullable: false), SshHostId = table.Column(type: "TEXT", nullable: true), CmsServerName = table.Column(type: "TEXT", maxLength: 200, nullable: false), Constraints = table.Column(type: "TEXT", maxLength: 2000, nullable: true), CreatedAt = table.Column(type: "TEXT", nullable: false), CustomerAbbrev = table.Column(type: "TEXT", maxLength: 3, nullable: false), CustomerName = table.Column(type: "TEXT", maxLength: 100, nullable: false), DeletedAt = table.Column(type: "TEXT", nullable: true), HostHttpPort = table.Column(type: "INTEGER", nullable: false), LibraryHostPath = table.Column(type: "TEXT", maxLength: 500, nullable: false), NewtId = table.Column(type: "TEXT", maxLength: 500, nullable: true), NewtSecret = table.Column(type: "TEXT", maxLength: 500, nullable: true), NfsExport = table.Column(type: "TEXT", maxLength: 500, nullable: true), NfsExportFolder = table.Column(type: "TEXT", maxLength: 500, nullable: true), NfsExtraOptions = table.Column(type: "TEXT", maxLength: 500, nullable: true), NfsServer = table.Column(type: "TEXT", maxLength: 200, nullable: true), SmtpServer = table.Column(type: "TEXT", maxLength: 200, nullable: false), SmtpUsername = table.Column(type: "TEXT", maxLength: 200, nullable: false), StackName = table.Column(type: "TEXT", maxLength: 100, nullable: false), Status = table.Column(type: "INTEGER", nullable: false), TemplateCacheKey = table.Column(type: "TEXT", maxLength: 100, nullable: true), TemplateLastFetch = table.Column(type: "TEXT", nullable: true), TemplateRepoPat = table.Column(type: "TEXT", maxLength: 500, nullable: true), TemplateRepoUrl = table.Column(type: "TEXT", maxLength: 500, nullable: false), ThemeHostPath = table.Column(type: "TEXT", maxLength: 500, nullable: false), UpdatedAt = table.Column(type: "TEXT", nullable: false), XiboApiTestStatus = table.Column(type: "INTEGER", nullable: false), XiboApiTestedAt = table.Column(type: "TEXT", nullable: true), XiboPassword = table.Column(type: "TEXT", maxLength: 1000, nullable: true), XiboUsername = table.Column(type: "TEXT", maxLength: 500, nullable: true) }, constraints: table => { table.PrimaryKey("PK_CmsInstances", x => x.Id); table.ForeignKey( name: "FK_CmsInstances_SshHosts_SshHostId", column: x => x.SshHostId, principalTable: "SshHosts", principalColumn: "Id", onDelete: ReferentialAction.SetNull); }); migrationBuilder.CreateTable( name: "SecretMetadata", columns: table => new { Id = table.Column(type: "TEXT", nullable: false), CreatedAt = table.Column(type: "TEXT", nullable: false), CustomerName = table.Column(type: "TEXT", maxLength: 100, nullable: true), IsGlobal = table.Column(type: "INTEGER", nullable: false), LastRotatedAt = table.Column(type: "TEXT", nullable: true), Name = table.Column(type: "TEXT", maxLength: 200, nullable: false) }, constraints: table => { table.PrimaryKey("PK_SecretMetadata", x => x.Id); }); migrationBuilder.CreateIndex( name: "IX_OperationLogs_InstanceId", table: "OperationLogs", column: "InstanceId"); migrationBuilder.CreateIndex( name: "IX_CmsInstances_CustomerName", table: "CmsInstances", column: "CustomerName"); migrationBuilder.CreateIndex( name: "IX_CmsInstances_SshHostId", table: "CmsInstances", column: "SshHostId"); migrationBuilder.CreateIndex( name: "IX_CmsInstances_StackName", table: "CmsInstances", column: "StackName", unique: true); migrationBuilder.CreateIndex( name: "IX_SecretMetadata_Name", table: "SecretMetadata", column: "Name", unique: true); migrationBuilder.AddForeignKey( name: "FK_OperationLogs_CmsInstances_InstanceId", table: "OperationLogs", column: "InstanceId", principalTable: "CmsInstances", principalColumn: "Id"); } } }