using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace CredentialManager.Migrations { /// public partial class AddDataCouplerProfiles : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "DataCouplerProfiles", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Name = table.Column(type: "TEXT", maxLength: 100, nullable: false), Description = table.Column(type: "TEXT", maxLength: 500, nullable: true), SourceType = table.Column(type: "TEXT", maxLength: 20, nullable: false), SourceCredentialId = table.Column(type: "INTEGER", nullable: true), SourceSchema = table.Column(type: "TEXT", maxLength: 200, nullable: true), SourceTable = table.Column(type: "TEXT", maxLength: 200, nullable: true), SourceFilePath = table.Column(type: "TEXT", maxLength: 500, nullable: true), DestinationType = table.Column(type: "TEXT", maxLength: 20, nullable: false), DestinationCredentialId = table.Column(type: "INTEGER", nullable: true), DestinationSchema = table.Column(type: "TEXT", maxLength: 200, nullable: true), DestinationTable = table.Column(type: "TEXT", maxLength: 200, nullable: true), DestinationEndpoint = table.Column(type: "TEXT", maxLength: 500, nullable: true), FieldMappingJson = table.Column(type: "TEXT", maxLength: 4000, nullable: true), CreatedBy = table.Column(type: "TEXT", maxLength: 100, nullable: true), CreatedAt = table.Column(type: "TEXT", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"), LastUsedAt = table.Column(type: "TEXT", nullable: true), IsActive = table.Column(type: "INTEGER", nullable: false, defaultValue: true) }, constraints: table => { table.PrimaryKey("PK_DataCouplerProfiles", x => x.Id); table.ForeignKey( name: "FK_DataCouplerProfiles_Credentials_DestinationCredentialId", column: x => x.DestinationCredentialId, principalTable: "Credentials", principalColumn: "Id", onDelete: ReferentialAction.SetNull); table.ForeignKey( name: "FK_DataCouplerProfiles_Credentials_SourceCredentialId", column: x => x.SourceCredentialId, principalTable: "Credentials", principalColumn: "Id", onDelete: ReferentialAction.SetNull); }); migrationBuilder.CreateIndex( name: "IX_DataCouplerProfiles_CreatedAt", table: "DataCouplerProfiles", column: "CreatedAt"); migrationBuilder.CreateIndex( name: "IX_DataCouplerProfiles_DestinationCredentialId", table: "DataCouplerProfiles", column: "DestinationCredentialId"); migrationBuilder.CreateIndex( name: "IX_DataCouplerProfiles_DestinationType", table: "DataCouplerProfiles", column: "DestinationType"); migrationBuilder.CreateIndex( name: "IX_DataCouplerProfiles_IsActive", table: "DataCouplerProfiles", column: "IsActive"); migrationBuilder.CreateIndex( name: "IX_DataCouplerProfiles_LastUsedAt", table: "DataCouplerProfiles", column: "LastUsedAt"); migrationBuilder.CreateIndex( name: "IX_DataCouplerProfiles_Name", table: "DataCouplerProfiles", column: "Name", unique: true); migrationBuilder.CreateIndex( name: "IX_DataCouplerProfiles_SourceCredentialId", table: "DataCouplerProfiles", column: "SourceCredentialId"); migrationBuilder.CreateIndex( name: "IX_DataCouplerProfiles_SourceType", table: "DataCouplerProfiles", column: "SourceType"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "DataCouplerProfiles"); } } }