Files

103 lines
4.3 KiB
C#
Raw Permalink Normal View History

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EngineeringSync.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class InitialCreate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Projects",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", maxLength: 200, nullable: false),
EngineeringPath = table.Column<string>(type: "TEXT", nullable: false),
SimulationPath = table.Column<string>(type: "TEXT", nullable: false),
FileExtensions = table.Column<string>(type: "TEXT", nullable: false),
IsActive = table.Column<bool>(type: "INTEGER", nullable: false),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Projects", x => x.Id);
});
migrationBuilder.CreateTable(
name: "FileRevisions",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
ProjectId = table.Column<Guid>(type: "TEXT", nullable: false),
RelativePath = table.Column<string>(type: "TEXT", nullable: false),
FileHash = table.Column<string>(type: "TEXT", nullable: false),
Size = table.Column<long>(type: "INTEGER", nullable: false),
LastModified = table.Column<DateTime>(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<Guid>(type: "TEXT", nullable: false),
ProjectId = table.Column<Guid>(type: "TEXT", nullable: false),
RelativePath = table.Column<string>(type: "TEXT", nullable: false),
ChangeType = table.Column<int>(type: "INTEGER", nullable: false),
OldRelativePath = table.Column<string>(type: "TEXT", nullable: true),
Status = table.Column<int>(type: "INTEGER", nullable: false),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
SyncedAt = table.Column<DateTime>(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");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "FileRevisions");
migrationBuilder.DropTable(
name: "PendingChanges");
migrationBuilder.DropTable(
name: "Projects");
}
}
}