summaryrefslogtreecommitdiff
path: root/src/marlin.web/Migrations/20260908142748_CommitAlt.cs
blob: b607d314a3073bd60b89bce9740c708fefe6911f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace marlin.web.Migrations
{
    /// <inheritdoc />
    public partial class CommitAlt : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "commit",
                table: "jobs");

            migrationBuilder.DropColumn(
                name: "ref",
                table: "jobs");

            migrationBuilder.AddColumn<Guid>(
                name: "branch_id",
                table: "jobs",
                type: "uuid",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));

            migrationBuilder.AddColumn<string>(
                name: "claim_token",
                table: "jobs",
                type: "text",
                nullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "commit_id",
                table: "jobs",
                type: "uuid",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));

            migrationBuilder.CreateIndex(
                name: "ix_jobs_branch_id",
                table: "jobs",
                column: "branch_id");

            migrationBuilder.CreateIndex(
                name: "ix_jobs_commit_id",
                table: "jobs",
                column: "commit_id");

            migrationBuilder.AddForeignKey(
                name: "fk_jobs_source_branches_branch_id",
                table: "jobs",
                column: "branch_id",
                principalTable: "source_branches",
                principalColumn: "id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "fk_jobs_source_commits_commit_id",
                table: "jobs",
                column: "commit_id",
                principalTable: "source_commits",
                principalColumn: "id",
                onDelete: ReferentialAction.Cascade);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "fk_jobs_source_branches_branch_id",
                table: "jobs");

            migrationBuilder.DropForeignKey(
                name: "fk_jobs_source_commits_commit_id",
                table: "jobs");

            migrationBuilder.DropIndex(
                name: "ix_jobs_branch_id",
                table: "jobs");

            migrationBuilder.DropIndex(
                name: "ix_jobs_commit_id",
                table: "jobs");

            migrationBuilder.DropColumn(
                name: "branch_id",
                table: "jobs");

            migrationBuilder.DropColumn(
                name: "claim_token",
                table: "jobs");

            migrationBuilder.DropColumn(
                name: "commit_id",
                table: "jobs");

            migrationBuilder.AddColumn<string>(
                name: "commit",
                table: "jobs",
                type: "text",
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn<string>(
                name: "ref",
                table: "jobs",
                type: "text",
                nullable: false,
                defaultValue: "");
        }
    }
}