using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace EngineeringSync.Infrastructure.Migrations { /// public partial class InitialCreate : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Projects", columns: table => new { Id = table.Column(type: "TEXT", nullable: false), Name = table.Column(type: "TEXT", maxLength: 200, nullable: false), EngineeringPath = table.Column(type: "TEXT", nullable: false), SimulationPath = table.Column(type: "TEXT", nullable: false), FileExtensions = table.Column(type: "TEXT", nullable: false), IsActive = table.Column(type: "INTEGER", nullable: false), CreatedAt = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Projects", x => x.Id); }); migrationBuilder.CreateTable( name: "FileRevisions", columns: table => new { Id = table.Column(type: "TEXT", nullable: false), ProjectId = table.Column(type: "TEXT", nullable: false), RelativePath = table.Column(type: "TEXT", nullable: false), FileHash = table.Column(type: "TEXT", nullable: false), Size = table.Column(type: "INTEGER", nullable: false), LastModified = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_FileRevisions", x => x.Id); table.ForeignKey( name: "FK_FileRevisions_Projects_ProjectId", column: x => x.ProjectId, principalTable: "Projects", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "PendingChanges", columns: table => new { Id = table.Column(type: "TEXT", nullable: false), ProjectId = table.Column(type: "TEXT", nullable: false), RelativePath = table.Column(type: "TEXT", nullable: false), ChangeType = table.Column(type: "INTEGER", nullable: false), OldRelativePath = table.Column(type: "TEXT", nullable: true), Status = table.Column(type: "INTEGER", nullable: false), CreatedAt = table.Column(type: "TEXT", nullable: false), SyncedAt = table.Column(type: "TEXT", nullable: true) }, constraints: table => { table.PrimaryKey("PK_PendingChanges", x => x.Id); table.ForeignKey( name: "FK_PendingChanges_Projects_ProjectId", column: x => x.ProjectId, principalTable: "Projects", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_FileRevisions_ProjectId_RelativePath", table: "FileRevisions", columns: new[] { "ProjectId", "RelativePath" }, unique: true); migrationBuilder.CreateIndex( name: "IX_PendingChanges_ProjectId", table: "PendingChanges", column: "ProjectId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "FileRevisions"); migrationBuilder.DropTable( name: "PendingChanges"); migrationBuilder.DropTable( name: "Projects"); } } }