-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: normalize deployments table (#14366)
- Loading branch information
1 parent
683992b
commit 04104da
Showing
49 changed files
with
1,283 additions
and
584 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
242 changes: 242 additions & 0 deletions
242
...end/src/Designer/Migrations/20250107121305_AddBuidsTableAndDeploymentsColumns.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
117 changes: 117 additions & 0 deletions
117
backend/src/Designer/Migrations/20250107121305_AddBuidsTableAndDeploymentsColumns.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
using System; | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; | ||
|
||
#nullable disable | ||
|
||
namespace Altinn.Studio.Designer.Migrations | ||
{ | ||
/// <inheritdoc /> | ||
public partial class AddBuidsTableAndDeploymentsColumns : Migration | ||
{ | ||
/// <inheritdoc /> | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.AddColumn<string>( | ||
name: "created_by", | ||
schema: "designer", | ||
table: "deployments", | ||
type: "character varying", | ||
nullable: true); | ||
|
||
migrationBuilder.AddColumn<string>( | ||
name: "envname", | ||
schema: "designer", | ||
table: "deployments", | ||
type: "character varying", | ||
nullable: true); | ||
|
||
migrationBuilder.AddColumn<long>( | ||
name: "internal_build_id", | ||
schema: "designer", | ||
table: "deployments", | ||
type: "bigint", | ||
nullable: true); | ||
|
||
migrationBuilder.CreateTable( | ||
name: "builds", | ||
schema: "designer", | ||
columns: table => new | ||
{ | ||
id = table.Column<long>(type: "bigint", nullable: false) | ||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), | ||
external_id = table.Column<string>(type: "character varying", nullable: true), | ||
status = table.Column<string>(type: "character varying", nullable: true), | ||
result = table.Column<string>(type: "character varying", nullable: true), | ||
build_type = table.Column<int>(type: "integer", nullable: false), | ||
started = table.Column<DateTimeOffset>(type: "timestamptz", nullable: true), | ||
finished = table.Column<DateTimeOffset>(type: "timestamptz", nullable: true) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_builds", x => x.id); | ||
}); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_deployments_internal_build_id", | ||
schema: "designer", | ||
table: "deployments", | ||
column: "internal_build_id"); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_builds_build_type", | ||
schema: "designer", | ||
table: "builds", | ||
column: "build_type"); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_builds_external_id_build_type", | ||
schema: "designer", | ||
table: "builds", | ||
columns: new[] { "external_id", "build_type" }, | ||
unique: true); | ||
|
||
migrationBuilder.AddForeignKey( | ||
name: "fk_deployments_builds_buildid", | ||
schema: "designer", | ||
table: "deployments", | ||
column: "internal_build_id", | ||
principalSchema: "designer", | ||
principalTable: "builds", | ||
principalColumn: "id"); | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.DropForeignKey( | ||
name: "fk_deployments_builds_buildid", | ||
schema: "designer", | ||
table: "deployments"); | ||
|
||
migrationBuilder.DropTable( | ||
name: "builds", | ||
schema: "designer"); | ||
|
||
migrationBuilder.DropIndex( | ||
name: "IX_deployments_internal_build_id", | ||
schema: "designer", | ||
table: "deployments"); | ||
|
||
migrationBuilder.DropColumn( | ||
name: "created_by", | ||
schema: "designer", | ||
table: "deployments"); | ||
|
||
migrationBuilder.DropColumn( | ||
name: "envname", | ||
schema: "designer", | ||
table: "deployments"); | ||
|
||
migrationBuilder.DropColumn( | ||
name: "internal_build_id", | ||
schema: "designer", | ||
table: "deployments"); | ||
} | ||
} | ||
} |
Oops, something went wrong.