| 1 | using AgentForge.Data; |
| 2 | using Microsoft.EntityFrameworkCore.Infrastructure; |
| 3 | using Microsoft.EntityFrameworkCore.Migrations; |
| 4 | |
| 5 | #nullable disable |
| 6 | |
| 7 | namespace AgentForge.Data.Migrations |
| 8 | { |
| 9 | [DbContext(typeof(ForgeDbContext))] |
| 10 | [Migration("20260612150000_AddRepoGroups")] |
| 11 | public partial class AddRepoGroups : Migration |
| 12 | { |
| 13 | /// <inheritdoc /> |
| 14 | protected override void Up(MigrationBuilder migrationBuilder) |
| 15 | { |
| 16 | migrationBuilder.CreateTable( |
| 17 | name: "repo_groups", |
| 18 | columns: table => new |
| 19 | { |
| 20 | Id = table.Column<string>(type: "TEXT", nullable: false), |
| 21 | CreatedAt = table.Column<string>(type: "TEXT", nullable: false), |
| 22 | Description = table.Column<string>(type: "TEXT", nullable: false), |
| 23 | DisplayName = table.Column<string>(type: "TEXT", nullable: false), |
| 24 | Slug = table.Column<string>(type: "TEXT", nullable: false) |
| 25 | }, |
| 26 | constraints: table => |
| 27 | { |
| 28 | table.PrimaryKey("PK_repo_groups", x => x.Id); |
| 29 | }); |
| 30 | |
| 31 | migrationBuilder.CreateIndex( |
| 32 | name: "IX_repo_groups_Slug", |
| 33 | table: "repo_groups", |
| 34 | column: "Slug", |
| 35 | unique: true); |
| 36 | |
| 37 | migrationBuilder.AddColumn<string>( |
| 38 | name: "GroupId", |
| 39 | table: "repos", |
| 40 | type: "TEXT", |
| 41 | nullable: true); |
| 42 | |
| 43 | migrationBuilder.CreateIndex( |
| 44 | name: "IX_repos_GroupId", |
| 45 | table: "repos", |
| 46 | column: "GroupId"); |
| 47 | |
| 48 | migrationBuilder.AddForeignKey( |
| 49 | name: "FK_repos_repo_groups_GroupId", |
| 50 | table: "repos", |
| 51 | column: "GroupId", |
| 52 | principalTable: "repo_groups", |
| 53 | principalColumn: "Id"); |
| 54 | } |
| 55 | |
| 56 | /// <inheritdoc /> |
| 57 | protected override void Down(MigrationBuilder migrationBuilder) |
| 58 | { |
| 59 | migrationBuilder.DropForeignKey( |
| 60 | name: "FK_repos_repo_groups_GroupId", |
| 61 | table: "repos"); |
| 62 | |
| 63 | migrationBuilder.DropIndex( |
| 64 | name: "IX_repos_GroupId", |
| 65 | table: "repos"); |
| 66 | |
| 67 | migrationBuilder.DropColumn( |
| 68 | name: "GroupId", |
| 69 | table: "repos"); |
| 70 | |
| 71 | migrationBuilder.DropTable( |
| 72 | name: "repo_groups"); |
| 73 | } |
| 74 | } |
| 75 | } |
| 76 | |