using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace OTSSignsOrchestrator.Core.Migrations { /// public partial class DesktopInitial : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "SecretMetadata", columns: table => new { Id = table.Column(type: "TEXT", nullable: false), Name = table.Column(type: "TEXT", maxLength: 200, nullable: false), IsGlobal = table.Column(type: "INTEGER", nullable: false), CustomerName = table.Column(type: "TEXT", maxLength: 100, nullable: true), CreatedAt = table.Column(type: "TEXT", nullable: false), LastRotatedAt = table.Column(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_SecretMetadata", x => x.Id); }); migrationBuilder.CreateTable( name: "SshHosts", columns: table => new { Id = table.Column(type: "TEXT", nullable: false), Label = table.Column(type: "TEXT", maxLength: 200, nullable: false), Host = table.Column(type: "TEXT", maxLength: 500, nullable: false), Port = table.Column(type: "INTEGER", nullable: false), Username = table.Column(type: "TEXT", maxLength: 100, nullable: false), PrivateKeyPath = table.Column(type: "TEXT", maxLength: 1000, nullable: true), KeyPassphrase = table.Column(type: "TEXT", maxLength: 2000, nullable: true), Password = table.Column(type: "TEXT", maxLength: 2000, nullable: true), UseKeyAuth = table.Column(type: "INTEGER", nullable: false), CreatedAt = table.Column(type: "TEXT", nullable: false), UpdatedAt = table.Column(type: "TEXT", nullable: false), LastTestedAt = table.Column(type: "TEXT", nullable: true), LastTestSuccess = table.Column(type: "INTEGER", nullable: true) }, constraints: table => { table.PrimaryKey("PK_SshHosts", x => x.Id); }); migrationBuilder.CreateTable( name: "CmsInstances", columns: table => new { Id = table.Column(type: "TEXT", nullable: false), CustomerName = table.Column(type: "TEXT", maxLength: 100, nullable: false), StackName = table.Column(type: "TEXT", maxLength: 100, nullable: false), CmsServerName = table.Column(type: "TEXT", maxLength: 200, nullable: false), HostHttpPort = table.Column(type: "INTEGER", nullable: false), ThemeHostPath = table.Column(type: "TEXT", maxLength: 500, nullable: false), LibraryHostPath = table.Column(type: "TEXT", maxLength: 500, nullable: false), SmtpServer = table.Column(type: "TEXT", maxLength: 200, nullable: false), SmtpUsername = table.Column(type: "TEXT", maxLength: 200, nullable: false), Constraints = table.Column(type: "TEXT", maxLength: 2000, nullable: true), TemplateRepoUrl = table.Column(type: "TEXT", maxLength: 500, nullable: false), TemplateRepoPat = table.Column(type: "TEXT", maxLength: 500, nullable: true), TemplateLastFetch = table.Column(type: "TEXT", nullable: true), TemplateCacheKey = table.Column(type: "TEXT", maxLength: 100, nullable: true), Status = table.Column(type: "INTEGER", nullable: false), XiboUsername = table.Column(type: "TEXT", maxLength: 500, nullable: true), XiboPassword = table.Column(type: "TEXT", maxLength: 1000, nullable: true), XiboApiTestStatus = table.Column(type: "INTEGER", nullable: false), XiboApiTestedAt = table.Column(type: "TEXT", nullable: true), CreatedAt = table.Column(type: "TEXT", nullable: false), UpdatedAt = table.Column(type: "TEXT", nullable: false), DeletedAt = table.Column(type: "TEXT", nullable: true), SshHostId = table.Column(type: "TEXT", 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: "OperationLogs", columns: table => new { Id = table.Column(type: "TEXT", nullable: false), Operation = table.Column(type: "INTEGER", nullable: false), InstanceId = table.Column(type: "TEXT", nullable: true), UserId = table.Column(type: "TEXT", maxLength: 200, nullable: true), Status = table.Column(type: "INTEGER", nullable: false), Message = table.Column(type: "TEXT", maxLength: 2000, nullable: true), DurationMs = table.Column(type: "INTEGER", nullable: true), Timestamp = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_OperationLogs", x => x.Id); table.ForeignKey( name: "FK_OperationLogs_CmsInstances_InstanceId", column: x => x.InstanceId, principalTable: "CmsInstances", principalColumn: "Id"); }); 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_OperationLogs_InstanceId", table: "OperationLogs", column: "InstanceId"); migrationBuilder.CreateIndex( name: "IX_OperationLogs_Operation", table: "OperationLogs", column: "Operation"); migrationBuilder.CreateIndex( name: "IX_OperationLogs_Timestamp", table: "OperationLogs", column: "Timestamp"); migrationBuilder.CreateIndex( name: "IX_SecretMetadata_Name", table: "SecretMetadata", column: "Name", unique: true); migrationBuilder.CreateIndex( name: "IX_SshHosts_Label", table: "SshHosts", column: "Label", unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "OperationLogs"); migrationBuilder.DropTable( name: "SecretMetadata"); migrationBuilder.DropTable( name: "CmsInstances"); migrationBuilder.DropTable( name: "SshHosts"); } } }