diff --git a/backend/src/Designer/Migrations/20250107094036_NormalizeDeploymentsData.Designer.cs b/backend/src/Designer/Migrations/20250107094036_NormalizeDeploymentsData.Designer.cs new file mode 100644 index 00000000000..4731217e3e8 --- /dev/null +++ b/backend/src/Designer/Migrations/20250107094036_NormalizeDeploymentsData.Designer.cs @@ -0,0 +1,238 @@ +// +using System; +using Altinn.Studio.Designer.Repository.ORMImplementation.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace Altinn.Studio.Designer.Migrations +{ + [DbContext(typeof(DesignerdbContext))] + [Migration("20250107094036_NormalizeDeploymentsData")] + partial class NormalizeDeploymentsData + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseSerialColumns(modelBuilder); + + modelBuilder.Entity("Altinn.Studio.Designer.Repository.ORMImplementation.Models.AppScopesDbObject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("App") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("app"); + + b.Property("Created") + .HasColumnType("timestamptz") + .HasColumnName("created"); + + b.Property("CreatedBy") + .HasColumnType("character varying") + .HasColumnName("created_by"); + + b.Property("LastModifiedBy") + .HasColumnType("character varying") + .HasColumnName("last_modified_by"); + + b.Property("Org") + .IsRequired() + .HasColumnType("character varying") + .HasColumnName("org"); + + b.Property("Scopes") + .IsRequired() + .HasColumnType("jsonb") + .HasColumnName("scopes"); + + b.Property("Version") + .IsConcurrencyToken() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("xid") + .HasColumnName("xmin"); + + b.HasKey("Id") + .HasName("app_scopes_pkey"); + + b.HasIndex(new[] { "Org", "App" }, "idx_app_scopes_org_app") + .IsUnique(); + + b.ToTable("app_scopes", "designer"); + }); + + modelBuilder.Entity("Altinn.Studio.Designer.Repository.ORMImplementation.Models.BuildDbObject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("BuildType") + .HasColumnType("integer") + .HasColumnName("build_type"); + + b.Property("ExternalId") + .HasColumnType("character varying") + .HasColumnName("external_id"); + + b.Property("Finished") + .HasColumnType("timestamptz") + .HasColumnName("finished"); + + b.Property("Result") + .HasColumnType("character varying") + .HasColumnName("result"); + + b.Property("Started") + .HasColumnType("timestamptz") + .HasColumnName("started"); + + b.Property("Status") + .HasColumnType("character varying") + .HasColumnName("status"); + + b.HasKey("Id"); + + b.HasIndex("BuildType"); + + b.HasIndex("ExternalId", "BuildType") + .IsUnique(); + + b.ToTable("builds", "designer"); + }); + + modelBuilder.Entity("Altinn.Studio.Designer.Repository.ORMImplementation.Models.Deployment", b => + { + b.Property("Sequenceno") + .ValueGeneratedOnAdd() + .HasColumnType("BIGSERIAL") + .HasColumnName("sequenceno"); + + NpgsqlPropertyBuilderExtensions.UseSerialColumn(b.Property("Sequenceno")); + + b.Property("App") + .HasColumnType("character varying") + .HasColumnName("app"); + + b.Property("Buildid") + .HasColumnType("character varying") + .HasColumnName("buildid"); + + b.Property("Buildresult") + .HasColumnType("character varying") + .HasColumnName("buildresult"); + + b.Property("Created") + .HasColumnType("timestamptz") + .HasColumnName("created"); + + b.Property("CreatedBy") + .HasColumnType("character varying") + .HasColumnName("created_by"); + + b.Property("Entity") + .HasColumnType("text") + .HasColumnName("entity"); + + b.Property("InternalBuildId") + .HasColumnType("bigint") + .HasColumnName("internal_build_id"); + + b.Property("Org") + .HasColumnType("character varying") + .HasColumnName("org"); + + b.Property("Tagname") + .HasColumnType("character varying") + .HasColumnName("tagname"); + + b.HasKey("Sequenceno") + .HasName("deployments_pkey"); + + b.HasIndex("InternalBuildId"); + + b.HasIndex(new[] { "Org", "App" }, "idx_deployments_org_app"); + + b.ToTable("deployments", "designer"); + }); + + modelBuilder.Entity("Altinn.Studio.Designer.Repository.ORMImplementation.Models.Release", b => + { + b.Property("Sequenceno") + .ValueGeneratedOnAdd() + .HasColumnType("BIGSERIAL") + .HasColumnName("sequenceno"); + + NpgsqlPropertyBuilderExtensions.UseSerialColumn(b.Property("Sequenceno")); + + b.Property("App") + .HasColumnType("character varying") + .HasColumnName("app"); + + b.Property("Buildid") + .HasColumnType("character varying") + .HasColumnName("buildid"); + + b.Property("Buildresult") + .HasColumnType("character varying") + .HasColumnName("buildresult"); + + b.Property("Buildstatus") + .HasColumnType("character varying") + .HasColumnName("buildstatus"); + + b.Property("Created") + .HasColumnType("timestamptz") + .HasColumnName("created"); + + b.Property("Entity") + .HasColumnType("text") + .HasColumnName("entity"); + + b.Property("Org") + .HasColumnType("character varying") + .HasColumnName("org"); + + b.Property("Tagname") + .HasColumnType("character varying") + .HasColumnName("tagname"); + + b.HasKey("Sequenceno") + .HasName("releases_pkey"); + + b.HasIndex(new[] { "Org", "App" }, "idx_releases_org_app"); + + b.ToTable("releases", "designer"); + }); + + modelBuilder.Entity("Altinn.Studio.Designer.Repository.ORMImplementation.Models.Deployment", b => + { + b.HasOne("Altinn.Studio.Designer.Repository.ORMImplementation.Models.BuildDbObject", "Build") + .WithMany() + .HasForeignKey("InternalBuildId") + .HasConstraintName("fk_deployments_builds_buildid"); + + b.Navigation("Build"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/backend/src/Designer/Migrations/20250107094036_NormalizeDeploymentsData.cs b/backend/src/Designer/Migrations/20250107094036_NormalizeDeploymentsData.cs new file mode 100644 index 00000000000..93cb915bd0c --- /dev/null +++ b/backend/src/Designer/Migrations/20250107094036_NormalizeDeploymentsData.cs @@ -0,0 +1,23 @@ +using Altinn.Studio.Designer.Migrations.SqlScripts; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Altinn.Studio.Designer.Migrations +{ + /// + public partial class NormalizeDeploymentsData : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.Sql(SqlScriptsReadHelper.ReadSqlScript("DeploymentsNormalization/normalization.sql")); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + // No data being deleted, so no need to implement this + } + } +}