From a9bc03fb01b5d1ac41bf5592f384d22df5425aa4 Mon Sep 17 00:00:00 2001 From: Melodi <62381002+Melodi17@users.noreply.github.com> Date: Sun, 6 Sep 2026 09:02:31 +1000 Subject: feat: vcs and secret management support --- .../Migrations/20260905011100_AddCommitModel.cs | 126 +++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 src/marlin.web/Migrations/20260905011100_AddCommitModel.cs (limited to 'src/marlin.web/Migrations/20260905011100_AddCommitModel.cs') diff --git a/src/marlin.web/Migrations/20260905011100_AddCommitModel.cs b/src/marlin.web/Migrations/20260905011100_AddCommitModel.cs new file mode 100644 index 0000000..78a23d0 --- /dev/null +++ b/src/marlin.web/Migrations/20260905011100_AddCommitModel.cs @@ -0,0 +1,126 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace marlin.web.Migrations +{ + /// + public partial class AddCommitModel : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "head_commit", + table: "source_branches"); + + migrationBuilder.AddColumn( + name: "commit_id", + table: "source_branches", + type: "uuid", + nullable: false, + defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); + + migrationBuilder.CreateTable( + name: "source_commits", + columns: table => new + { + id = table.Column(type: "uuid", nullable: false), + source_id = table.Column(type: "uuid", nullable: false), + blobs_fetched = table.Column(type: "boolean", nullable: false), + hash = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("pk_source_commits", x => x.id); + table.UniqueConstraint("ak_source_commits_source_id_hash", x => new { x.source_id, x.hash }); + table.ForeignKey( + name: "fk_source_commits_sources_source_id", + column: x => x.source_id, + principalTable: "sources", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "source_blobs", + columns: table => new + { + id = table.Column(type: "uuid", nullable: false), + source_id = table.Column(type: "uuid", nullable: false), + commit_id = table.Column(type: "uuid", nullable: false), + path = table.Column(type: "text", nullable: false), + content = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("pk_source_blobs", x => x.id); + table.ForeignKey( + name: "fk_source_blobs_source_commits_commit_id", + column: x => x.commit_id, + principalTable: "source_commits", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "fk_source_blobs_sources_source_id", + column: x => x.source_id, + principalTable: "sources", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "ix_source_branches_commit_id", + table: "source_branches", + column: "commit_id"); + + migrationBuilder.CreateIndex( + name: "ix_source_blobs_commit_id", + table: "source_blobs", + column: "commit_id"); + + migrationBuilder.CreateIndex( + name: "ix_source_blobs_source_id", + table: "source_blobs", + column: "source_id"); + + migrationBuilder.AddForeignKey( + name: "fk_source_branches_source_commits_commit_id", + table: "source_branches", + column: "commit_id", + principalTable: "source_commits", + principalColumn: "id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "fk_source_branches_source_commits_commit_id", + table: "source_branches"); + + migrationBuilder.DropTable( + name: "source_blobs"); + + migrationBuilder.DropTable( + name: "source_commits"); + + migrationBuilder.DropIndex( + name: "ix_source_branches_commit_id", + table: "source_branches"); + + migrationBuilder.DropColumn( + name: "commit_id", + table: "source_branches"); + + migrationBuilder.AddColumn( + name: "head_commit", + table: "source_branches", + type: "text", + nullable: false, + defaultValue: ""); + } + } +} -- cgit v1.3.1