From 066b3291a6ee1b95f20c411a77d595111c0acccd Mon Sep 17 00:00:00 2001 From: Phil Schneider Date: Fri, 4 Aug 2023 15:15:04 +0200 Subject: [PATCH 1/5] chore(migrations): align migrations Align all migrations since 1.6.0-RC5 to RC6 --- ...s => 20230804131140_1.6.0-rc5.Designer.cs} | 4 +- ...oveDaps.cs => 20230804131140_1.6.0-rc5.cs} | 330 +++++++++++++++++- 2 files changed, 331 insertions(+), 3 deletions(-) rename src/portalbackend/PortalBackend.Migrations/Migrations/{20230803131109_CPLP-3105-RemoveDaps.Designer.cs => 20230804131140_1.6.0-rc5.Designer.cs} (99%) rename src/portalbackend/PortalBackend.Migrations/Migrations/{20230803131109_CPLP-3105-RemoveDaps.cs => 20230804131140_1.6.0-rc5.cs} (50%) diff --git a/src/portalbackend/PortalBackend.Migrations/Migrations/20230803131109_CPLP-3105-RemoveDaps.Designer.cs b/src/portalbackend/PortalBackend.Migrations/Migrations/20230804131140_1.6.0-rc5.Designer.cs similarity index 99% rename from src/portalbackend/PortalBackend.Migrations/Migrations/20230803131109_CPLP-3105-RemoveDaps.Designer.cs rename to src/portalbackend/PortalBackend.Migrations/Migrations/20230804131140_1.6.0-rc5.Designer.cs index 90cbbb29aa..173deb3a0c 100644 --- a/src/portalbackend/PortalBackend.Migrations/Migrations/20230803131109_CPLP-3105-RemoveDaps.Designer.cs +++ b/src/portalbackend/PortalBackend.Migrations/Migrations/20230804131140_1.6.0-rc5.Designer.cs @@ -29,8 +29,8 @@ namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.Migrations.Migrations { [DbContext(typeof(PortalDbContext))] - [Migration("20230803131109_CPLP-3105-RemoveDaps")] - partial class CPLP3105RemoveDaps + [Migration("20230804131140_1.6.0-rc5")] + partial class _160rc5 { protected override void BuildTargetModel(ModelBuilder modelBuilder) { diff --git a/src/portalbackend/PortalBackend.Migrations/Migrations/20230803131109_CPLP-3105-RemoveDaps.cs b/src/portalbackend/PortalBackend.Migrations/Migrations/20230804131140_1.6.0-rc5.cs similarity index 50% rename from src/portalbackend/PortalBackend.Migrations/Migrations/20230803131109_CPLP-3105-RemoveDaps.cs rename to src/portalbackend/PortalBackend.Migrations/Migrations/20230804131140_1.6.0-rc5.cs index ccb390967a..98014c7858 100644 --- a/src/portalbackend/PortalBackend.Migrations/Migrations/20230803131109_CPLP-3105-RemoveDaps.cs +++ b/src/portalbackend/PortalBackend.Migrations/Migrations/20230804131140_1.6.0-rc5.cs @@ -24,7 +24,7 @@ namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.Migrations.Migrations { - public partial class CPLP3105RemoveDaps : Migration + public partial class _160rc5 : Migration { protected override void Up(MigrationBuilder migrationBuilder) { @@ -34,6 +34,11 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.Sql("DROP FUNCTION portal.LC_TRIGGER_AFTER_UPDATE_CONNECTOR() CASCADE;"); + migrationBuilder.DropForeignKey( + name: "fk_notifications_company_users_creator_id", + schema: "portal", + table: "notifications"); + migrationBuilder.DropTable( name: "connector_client_details", schema: "portal"); @@ -71,6 +76,195 @@ protected override void Up(MigrationBuilder migrationBuilder) table.PrimaryKey("pk_audit_connector20230803", x => x.audit_v1id); }); + migrationBuilder.CreateIndex( + name: "ix_user_roles_last_editor_id", + schema: "portal", + table: "user_roles", + column: "last_editor_id"); + + migrationBuilder.CreateIndex( + name: "ix_provider_company_details_last_editor_id", + schema: "portal", + table: "provider_company_details", + column: "last_editor_id"); + + migrationBuilder.CreateIndex( + name: "ix_offers_last_editor_id", + schema: "portal", + table: "offers", + column: "last_editor_id"); + + migrationBuilder.CreateIndex( + name: "ix_offer_subscriptions_last_editor_id", + schema: "portal", + table: "offer_subscriptions", + column: "last_editor_id"); + + migrationBuilder.CreateIndex( + name: "ix_identity_assigned_roles_last_editor_id", + schema: "portal", + table: "identity_assigned_roles", + column: "last_editor_id"); + + migrationBuilder.CreateIndex( + name: "ix_identities_last_editor_id", + schema: "portal", + table: "identities", + column: "last_editor_id"); + + migrationBuilder.CreateIndex( + name: "ix_consents_last_editor_id", + schema: "portal", + table: "consents", + column: "last_editor_id"); + + migrationBuilder.CreateIndex( + name: "ix_company_users_last_editor_id", + schema: "portal", + table: "company_users", + column: "last_editor_id"); + + migrationBuilder.CreateIndex( + name: "ix_company_ssi_details_last_editor_id", + schema: "portal", + table: "company_ssi_details", + column: "last_editor_id"); + + migrationBuilder.CreateIndex( + name: "ix_company_assigned_roles_last_editor_id", + schema: "portal", + table: "company_assigned_roles", + column: "last_editor_id"); + + migrationBuilder.CreateIndex( + name: "ix_company_applications_last_editor_id", + schema: "portal", + table: "company_applications", + column: "last_editor_id"); + + migrationBuilder.CreateIndex( + name: "ix_app_subscription_details_last_editor_id", + schema: "portal", + table: "app_subscription_details", + column: "last_editor_id"); + + migrationBuilder.AddForeignKey( + name: "fk_app_subscription_details_identities_last_editor_id", + schema: "portal", + table: "app_subscription_details", + column: "last_editor_id", + principalSchema: "portal", + principalTable: "identities", + principalColumn: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_company_applications_identities_last_editor_id", + schema: "portal", + table: "company_applications", + column: "last_editor_id", + principalSchema: "portal", + principalTable: "identities", + principalColumn: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_company_assigned_roles_identities_last_editor_id", + schema: "portal", + table: "company_assigned_roles", + column: "last_editor_id", + principalSchema: "portal", + principalTable: "identities", + principalColumn: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_company_ssi_details_identities_last_editor_id", + schema: "portal", + table: "company_ssi_details", + column: "last_editor_id", + principalSchema: "portal", + principalTable: "identities", + principalColumn: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_company_users_identities_last_editor_id", + schema: "portal", + table: "company_users", + column: "last_editor_id", + principalSchema: "portal", + principalTable: "identities", + principalColumn: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_consents_identities_last_editor_id", + schema: "portal", + table: "consents", + column: "last_editor_id", + principalSchema: "portal", + principalTable: "identities", + principalColumn: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_identities_identities_last_editor_id", + schema: "portal", + table: "identities", + column: "last_editor_id", + principalSchema: "portal", + principalTable: "identities", + principalColumn: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_identity_assigned_roles_identities_last_editor_id", + schema: "portal", + table: "identity_assigned_roles", + column: "last_editor_id", + principalSchema: "portal", + principalTable: "identities", + principalColumn: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_notifications_identities_creator_id", + schema: "portal", + table: "notifications", + column: "creator_user_id", + principalSchema: "portal", + principalTable: "identities", + principalColumn: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_offer_subscriptions_identities_last_editor_id", + schema: "portal", + table: "offer_subscriptions", + column: "last_editor_id", + principalSchema: "portal", + principalTable: "identities", + principalColumn: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_offers_identities_last_editor_id", + schema: "portal", + table: "offers", + column: "last_editor_id", + principalSchema: "portal", + principalTable: "identities", + principalColumn: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_provider_company_details_identities_last_editor_id", + schema: "portal", + table: "provider_company_details", + column: "last_editor_id", + principalSchema: "portal", + principalTable: "identities", + principalColumn: "id"); + + migrationBuilder.AddForeignKey( + name: "fk_user_roles_identities_last_editor_id", + schema: "portal", + table: "user_roles", + column: "last_editor_id", + principalSchema: "portal", + principalTable: "identities", + principalColumn: "id"); + migrationBuilder.Sql("CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_CONNECTOR() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_CONNECTOR$\r\nBEGIN\r\n INSERT INTO portal.audit_connector20230803 (\"id\", \"name\", \"connector_url\", \"type_id\", \"status_id\", \"provider_id\", \"host_id\", \"self_description_document_id\", \"location_id\", \"self_description_message\", \"date_last_changed\", \"company_service_account_id\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT OLD.id, \r\n OLD.name, \r\n OLD.connector_url, \r\n OLD.type_id, \r\n OLD.status_id, \r\n OLD.provider_id, \r\n OLD.host_id, \r\n OLD.self_description_document_id, \r\n OLD.location_id, \r\n OLD.self_description_message, \r\n OLD.date_last_changed, \r\n OLD.company_service_account_id, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_CONNECTOR$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_CONNECTOR AFTER DELETE\r\nON portal.connectors\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_CONNECTOR();"); migrationBuilder.Sql("CREATE FUNCTION portal.LC_TRIGGER_AFTER_INSERT_CONNECTOR() RETURNS trigger as $LC_TRIGGER_AFTER_INSERT_CONNECTOR$\r\nBEGIN\r\n INSERT INTO portal.audit_connector20230803 (\"id\", \"name\", \"connector_url\", \"type_id\", \"status_id\", \"provider_id\", \"host_id\", \"self_description_document_id\", \"location_id\", \"self_description_message\", \"date_last_changed\", \"company_service_account_id\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT NEW.id, \r\n NEW.name, \r\n NEW.connector_url, \r\n NEW.type_id, \r\n NEW.status_id, \r\n NEW.provider_id, \r\n NEW.host_id, \r\n NEW.self_description_document_id, \r\n NEW.location_id, \r\n NEW.self_description_message, \r\n NEW.date_last_changed, \r\n NEW.company_service_account_id, \r\n NEW.last_editor_id, \r\n gen_random_uuid(), \r\n 1, \r\n CURRENT_DATE, \r\n NEW.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_INSERT_CONNECTOR$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_INSERT_CONNECTOR AFTER INSERT\r\nON portal.connectors\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_INSERT_CONNECTOR();"); @@ -86,10 +280,135 @@ protected override void Down(MigrationBuilder migrationBuilder) migrationBuilder.Sql("DROP FUNCTION portal.LC_TRIGGER_AFTER_UPDATE_CONNECTOR() CASCADE;"); + migrationBuilder.DropForeignKey( + name: "fk_app_subscription_details_identities_last_editor_id", + schema: "portal", + table: "app_subscription_details"); + + migrationBuilder.DropForeignKey( + name: "fk_company_applications_identities_last_editor_id", + schema: "portal", + table: "company_applications"); + + migrationBuilder.DropForeignKey( + name: "fk_company_assigned_roles_identities_last_editor_id", + schema: "portal", + table: "company_assigned_roles"); + + migrationBuilder.DropForeignKey( + name: "fk_company_ssi_details_identities_last_editor_id", + schema: "portal", + table: "company_ssi_details"); + + migrationBuilder.DropForeignKey( + name: "fk_company_users_identities_last_editor_id", + schema: "portal", + table: "company_users"); + + migrationBuilder.DropForeignKey( + name: "fk_consents_identities_last_editor_id", + schema: "portal", + table: "consents"); + + migrationBuilder.DropForeignKey( + name: "fk_identities_identities_last_editor_id", + schema: "portal", + table: "identities"); + + migrationBuilder.DropForeignKey( + name: "fk_identity_assigned_roles_identities_last_editor_id", + schema: "portal", + table: "identity_assigned_roles"); + + migrationBuilder.DropForeignKey( + name: "fk_notifications_identities_creator_id", + schema: "portal", + table: "notifications"); + + migrationBuilder.DropForeignKey( + name: "fk_offer_subscriptions_identities_last_editor_id", + schema: "portal", + table: "offer_subscriptions"); + + migrationBuilder.DropForeignKey( + name: "fk_offers_identities_last_editor_id", + schema: "portal", + table: "offers"); + + migrationBuilder.DropForeignKey( + name: "fk_provider_company_details_identities_last_editor_id", + schema: "portal", + table: "provider_company_details"); + + migrationBuilder.DropForeignKey( + name: "fk_user_roles_identities_last_editor_id", + schema: "portal", + table: "user_roles"); + migrationBuilder.DropTable( name: "audit_connector20230803", schema: "portal"); + migrationBuilder.DropIndex( + name: "ix_user_roles_last_editor_id", + schema: "portal", + table: "user_roles"); + + migrationBuilder.DropIndex( + name: "ix_provider_company_details_last_editor_id", + schema: "portal", + table: "provider_company_details"); + + migrationBuilder.DropIndex( + name: "ix_offers_last_editor_id", + schema: "portal", + table: "offers"); + + migrationBuilder.DropIndex( + name: "ix_offer_subscriptions_last_editor_id", + schema: "portal", + table: "offer_subscriptions"); + + migrationBuilder.DropIndex( + name: "ix_identity_assigned_roles_last_editor_id", + schema: "portal", + table: "identity_assigned_roles"); + + migrationBuilder.DropIndex( + name: "ix_identities_last_editor_id", + schema: "portal", + table: "identities"); + + migrationBuilder.DropIndex( + name: "ix_consents_last_editor_id", + schema: "portal", + table: "consents"); + + migrationBuilder.DropIndex( + name: "ix_company_users_last_editor_id", + schema: "portal", + table: "company_users"); + + migrationBuilder.DropIndex( + name: "ix_company_ssi_details_last_editor_id", + schema: "portal", + table: "company_ssi_details"); + + migrationBuilder.DropIndex( + name: "ix_company_assigned_roles_last_editor_id", + schema: "portal", + table: "company_assigned_roles"); + + migrationBuilder.DropIndex( + name: "ix_company_applications_last_editor_id", + schema: "portal", + table: "company_applications"); + + migrationBuilder.DropIndex( + name: "ix_app_subscription_details_last_editor_id", + schema: "portal", + table: "app_subscription_details"); + migrationBuilder.AddColumn( name: "daps_registration_successful", schema: "portal", @@ -117,6 +436,15 @@ protected override void Down(MigrationBuilder migrationBuilder) onDelete: ReferentialAction.SetNull); }); + migrationBuilder.AddForeignKey( + name: "fk_notifications_company_users_creator_id", + schema: "portal", + table: "notifications", + column: "creator_user_id", + principalSchema: "portal", + principalTable: "company_users", + principalColumn: "id"); + migrationBuilder.Sql("CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_CONNECTOR() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_CONNECTOR$\r\nBEGIN\r\n INSERT INTO portal.audit_connector20230503 (\"id\", \"name\", \"connector_url\", \"type_id\", \"status_id\", \"provider_id\", \"host_id\", \"self_description_document_id\", \"location_id\", \"daps_registration_successful\", \"self_description_message\", \"date_last_changed\", \"company_service_account_id\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT OLD.id, \r\n OLD.name, \r\n OLD.connector_url, \r\n OLD.type_id, \r\n OLD.status_id, \r\n OLD.provider_id, \r\n OLD.host_id, \r\n OLD.self_description_document_id, \r\n OLD.location_id, \r\n OLD.daps_registration_successful, \r\n OLD.self_description_message, \r\n OLD.date_last_changed, \r\n OLD.company_service_account_id, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_CONNECTOR$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_CONNECTOR AFTER DELETE\r\nON portal.connectors\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_CONNECTOR();"); migrationBuilder.Sql("CREATE FUNCTION portal.LC_TRIGGER_AFTER_INSERT_CONNECTOR() RETURNS trigger as $LC_TRIGGER_AFTER_INSERT_CONNECTOR$\r\nBEGIN\r\n INSERT INTO portal.audit_connector20230503 (\"id\", \"name\", \"connector_url\", \"type_id\", \"status_id\", \"provider_id\", \"host_id\", \"self_description_document_id\", \"location_id\", \"daps_registration_successful\", \"self_description_message\", \"date_last_changed\", \"company_service_account_id\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT NEW.id, \r\n NEW.name, \r\n NEW.connector_url, \r\n NEW.type_id, \r\n NEW.status_id, \r\n NEW.provider_id, \r\n NEW.host_id, \r\n NEW.self_description_document_id, \r\n NEW.location_id, \r\n NEW.daps_registration_successful, \r\n NEW.self_description_message, \r\n NEW.date_last_changed, \r\n NEW.company_service_account_id, \r\n NEW.last_editor_id, \r\n gen_random_uuid(), \r\n 1, \r\n CURRENT_DATE, \r\n NEW.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_INSERT_CONNECTOR$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_INSERT_CONNECTOR AFTER INSERT\r\nON portal.connectors\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_INSERT_CONNECTOR();"); From ec77b9f069fb08fdbad313e19fc505df93b9d168 Mon Sep 17 00:00:00 2001 From: Phil Schneider Date: Fri, 4 Aug 2023 16:02:22 +0200 Subject: [PATCH 2/5] chore: recreate migration --- ...s => 20230804135935_1.6.0-rc5.Designer.cs} | 4 +- ...6.0-rc5.cs => 20230804135935_1.6.0-rc5.cs} | 330 +----------------- .../PortalDbContextModelSnapshot.cs | 2 +- 3 files changed, 4 insertions(+), 332 deletions(-) rename src/portalbackend/PortalBackend.Migrations/Migrations/{20230804131140_1.6.0-rc5.Designer.cs => 20230804135935_1.6.0-rc5.Designer.cs} (99%) rename src/portalbackend/PortalBackend.Migrations/Migrations/{20230804131140_1.6.0-rc5.cs => 20230804135935_1.6.0-rc5.cs} (50%) diff --git a/src/portalbackend/PortalBackend.Migrations/Migrations/20230804131140_1.6.0-rc5.Designer.cs b/src/portalbackend/PortalBackend.Migrations/Migrations/20230804135935_1.6.0-rc5.Designer.cs similarity index 99% rename from src/portalbackend/PortalBackend.Migrations/Migrations/20230804131140_1.6.0-rc5.Designer.cs rename to src/portalbackend/PortalBackend.Migrations/Migrations/20230804135935_1.6.0-rc5.Designer.cs index 173deb3a0c..78d9bc9ac5 100644 --- a/src/portalbackend/PortalBackend.Migrations/Migrations/20230804131140_1.6.0-rc5.Designer.cs +++ b/src/portalbackend/PortalBackend.Migrations/Migrations/20230804135935_1.6.0-rc5.Designer.cs @@ -1,4 +1,4 @@ -/******************************************************************************** +/******************************************************************************** * Copyright (c) 2021, 2023 BMW Group AG * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation * @@ -29,7 +29,7 @@ namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.Migrations.Migrations { [DbContext(typeof(PortalDbContext))] - [Migration("20230804131140_1.6.0-rc5")] + [Migration("20230804135935_1.6.0-rc5")] partial class _160rc5 { protected override void BuildTargetModel(ModelBuilder modelBuilder) diff --git a/src/portalbackend/PortalBackend.Migrations/Migrations/20230804131140_1.6.0-rc5.cs b/src/portalbackend/PortalBackend.Migrations/Migrations/20230804135935_1.6.0-rc5.cs similarity index 50% rename from src/portalbackend/PortalBackend.Migrations/Migrations/20230804131140_1.6.0-rc5.cs rename to src/portalbackend/PortalBackend.Migrations/Migrations/20230804135935_1.6.0-rc5.cs index 98014c7858..d8a6bf72ba 100644 --- a/src/portalbackend/PortalBackend.Migrations/Migrations/20230804131140_1.6.0-rc5.cs +++ b/src/portalbackend/PortalBackend.Migrations/Migrations/20230804135935_1.6.0-rc5.cs @@ -1,4 +1,4 @@ -/******************************************************************************** +/******************************************************************************** * Copyright (c) 2021, 2023 BMW Group AG * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation * @@ -34,11 +34,6 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.Sql("DROP FUNCTION portal.LC_TRIGGER_AFTER_UPDATE_CONNECTOR() CASCADE;"); - migrationBuilder.DropForeignKey( - name: "fk_notifications_company_users_creator_id", - schema: "portal", - table: "notifications"); - migrationBuilder.DropTable( name: "connector_client_details", schema: "portal"); @@ -76,195 +71,6 @@ protected override void Up(MigrationBuilder migrationBuilder) table.PrimaryKey("pk_audit_connector20230803", x => x.audit_v1id); }); - migrationBuilder.CreateIndex( - name: "ix_user_roles_last_editor_id", - schema: "portal", - table: "user_roles", - column: "last_editor_id"); - - migrationBuilder.CreateIndex( - name: "ix_provider_company_details_last_editor_id", - schema: "portal", - table: "provider_company_details", - column: "last_editor_id"); - - migrationBuilder.CreateIndex( - name: "ix_offers_last_editor_id", - schema: "portal", - table: "offers", - column: "last_editor_id"); - - migrationBuilder.CreateIndex( - name: "ix_offer_subscriptions_last_editor_id", - schema: "portal", - table: "offer_subscriptions", - column: "last_editor_id"); - - migrationBuilder.CreateIndex( - name: "ix_identity_assigned_roles_last_editor_id", - schema: "portal", - table: "identity_assigned_roles", - column: "last_editor_id"); - - migrationBuilder.CreateIndex( - name: "ix_identities_last_editor_id", - schema: "portal", - table: "identities", - column: "last_editor_id"); - - migrationBuilder.CreateIndex( - name: "ix_consents_last_editor_id", - schema: "portal", - table: "consents", - column: "last_editor_id"); - - migrationBuilder.CreateIndex( - name: "ix_company_users_last_editor_id", - schema: "portal", - table: "company_users", - column: "last_editor_id"); - - migrationBuilder.CreateIndex( - name: "ix_company_ssi_details_last_editor_id", - schema: "portal", - table: "company_ssi_details", - column: "last_editor_id"); - - migrationBuilder.CreateIndex( - name: "ix_company_assigned_roles_last_editor_id", - schema: "portal", - table: "company_assigned_roles", - column: "last_editor_id"); - - migrationBuilder.CreateIndex( - name: "ix_company_applications_last_editor_id", - schema: "portal", - table: "company_applications", - column: "last_editor_id"); - - migrationBuilder.CreateIndex( - name: "ix_app_subscription_details_last_editor_id", - schema: "portal", - table: "app_subscription_details", - column: "last_editor_id"); - - migrationBuilder.AddForeignKey( - name: "fk_app_subscription_details_identities_last_editor_id", - schema: "portal", - table: "app_subscription_details", - column: "last_editor_id", - principalSchema: "portal", - principalTable: "identities", - principalColumn: "id"); - - migrationBuilder.AddForeignKey( - name: "fk_company_applications_identities_last_editor_id", - schema: "portal", - table: "company_applications", - column: "last_editor_id", - principalSchema: "portal", - principalTable: "identities", - principalColumn: "id"); - - migrationBuilder.AddForeignKey( - name: "fk_company_assigned_roles_identities_last_editor_id", - schema: "portal", - table: "company_assigned_roles", - column: "last_editor_id", - principalSchema: "portal", - principalTable: "identities", - principalColumn: "id"); - - migrationBuilder.AddForeignKey( - name: "fk_company_ssi_details_identities_last_editor_id", - schema: "portal", - table: "company_ssi_details", - column: "last_editor_id", - principalSchema: "portal", - principalTable: "identities", - principalColumn: "id"); - - migrationBuilder.AddForeignKey( - name: "fk_company_users_identities_last_editor_id", - schema: "portal", - table: "company_users", - column: "last_editor_id", - principalSchema: "portal", - principalTable: "identities", - principalColumn: "id"); - - migrationBuilder.AddForeignKey( - name: "fk_consents_identities_last_editor_id", - schema: "portal", - table: "consents", - column: "last_editor_id", - principalSchema: "portal", - principalTable: "identities", - principalColumn: "id"); - - migrationBuilder.AddForeignKey( - name: "fk_identities_identities_last_editor_id", - schema: "portal", - table: "identities", - column: "last_editor_id", - principalSchema: "portal", - principalTable: "identities", - principalColumn: "id"); - - migrationBuilder.AddForeignKey( - name: "fk_identity_assigned_roles_identities_last_editor_id", - schema: "portal", - table: "identity_assigned_roles", - column: "last_editor_id", - principalSchema: "portal", - principalTable: "identities", - principalColumn: "id"); - - migrationBuilder.AddForeignKey( - name: "fk_notifications_identities_creator_id", - schema: "portal", - table: "notifications", - column: "creator_user_id", - principalSchema: "portal", - principalTable: "identities", - principalColumn: "id"); - - migrationBuilder.AddForeignKey( - name: "fk_offer_subscriptions_identities_last_editor_id", - schema: "portal", - table: "offer_subscriptions", - column: "last_editor_id", - principalSchema: "portal", - principalTable: "identities", - principalColumn: "id"); - - migrationBuilder.AddForeignKey( - name: "fk_offers_identities_last_editor_id", - schema: "portal", - table: "offers", - column: "last_editor_id", - principalSchema: "portal", - principalTable: "identities", - principalColumn: "id"); - - migrationBuilder.AddForeignKey( - name: "fk_provider_company_details_identities_last_editor_id", - schema: "portal", - table: "provider_company_details", - column: "last_editor_id", - principalSchema: "portal", - principalTable: "identities", - principalColumn: "id"); - - migrationBuilder.AddForeignKey( - name: "fk_user_roles_identities_last_editor_id", - schema: "portal", - table: "user_roles", - column: "last_editor_id", - principalSchema: "portal", - principalTable: "identities", - principalColumn: "id"); - migrationBuilder.Sql("CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_CONNECTOR() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_CONNECTOR$\r\nBEGIN\r\n INSERT INTO portal.audit_connector20230803 (\"id\", \"name\", \"connector_url\", \"type_id\", \"status_id\", \"provider_id\", \"host_id\", \"self_description_document_id\", \"location_id\", \"self_description_message\", \"date_last_changed\", \"company_service_account_id\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT OLD.id, \r\n OLD.name, \r\n OLD.connector_url, \r\n OLD.type_id, \r\n OLD.status_id, \r\n OLD.provider_id, \r\n OLD.host_id, \r\n OLD.self_description_document_id, \r\n OLD.location_id, \r\n OLD.self_description_message, \r\n OLD.date_last_changed, \r\n OLD.company_service_account_id, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_CONNECTOR$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_CONNECTOR AFTER DELETE\r\nON portal.connectors\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_CONNECTOR();"); migrationBuilder.Sql("CREATE FUNCTION portal.LC_TRIGGER_AFTER_INSERT_CONNECTOR() RETURNS trigger as $LC_TRIGGER_AFTER_INSERT_CONNECTOR$\r\nBEGIN\r\n INSERT INTO portal.audit_connector20230803 (\"id\", \"name\", \"connector_url\", \"type_id\", \"status_id\", \"provider_id\", \"host_id\", \"self_description_document_id\", \"location_id\", \"self_description_message\", \"date_last_changed\", \"company_service_account_id\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT NEW.id, \r\n NEW.name, \r\n NEW.connector_url, \r\n NEW.type_id, \r\n NEW.status_id, \r\n NEW.provider_id, \r\n NEW.host_id, \r\n NEW.self_description_document_id, \r\n NEW.location_id, \r\n NEW.self_description_message, \r\n NEW.date_last_changed, \r\n NEW.company_service_account_id, \r\n NEW.last_editor_id, \r\n gen_random_uuid(), \r\n 1, \r\n CURRENT_DATE, \r\n NEW.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_INSERT_CONNECTOR$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_INSERT_CONNECTOR AFTER INSERT\r\nON portal.connectors\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_INSERT_CONNECTOR();"); @@ -280,135 +86,10 @@ protected override void Down(MigrationBuilder migrationBuilder) migrationBuilder.Sql("DROP FUNCTION portal.LC_TRIGGER_AFTER_UPDATE_CONNECTOR() CASCADE;"); - migrationBuilder.DropForeignKey( - name: "fk_app_subscription_details_identities_last_editor_id", - schema: "portal", - table: "app_subscription_details"); - - migrationBuilder.DropForeignKey( - name: "fk_company_applications_identities_last_editor_id", - schema: "portal", - table: "company_applications"); - - migrationBuilder.DropForeignKey( - name: "fk_company_assigned_roles_identities_last_editor_id", - schema: "portal", - table: "company_assigned_roles"); - - migrationBuilder.DropForeignKey( - name: "fk_company_ssi_details_identities_last_editor_id", - schema: "portal", - table: "company_ssi_details"); - - migrationBuilder.DropForeignKey( - name: "fk_company_users_identities_last_editor_id", - schema: "portal", - table: "company_users"); - - migrationBuilder.DropForeignKey( - name: "fk_consents_identities_last_editor_id", - schema: "portal", - table: "consents"); - - migrationBuilder.DropForeignKey( - name: "fk_identities_identities_last_editor_id", - schema: "portal", - table: "identities"); - - migrationBuilder.DropForeignKey( - name: "fk_identity_assigned_roles_identities_last_editor_id", - schema: "portal", - table: "identity_assigned_roles"); - - migrationBuilder.DropForeignKey( - name: "fk_notifications_identities_creator_id", - schema: "portal", - table: "notifications"); - - migrationBuilder.DropForeignKey( - name: "fk_offer_subscriptions_identities_last_editor_id", - schema: "portal", - table: "offer_subscriptions"); - - migrationBuilder.DropForeignKey( - name: "fk_offers_identities_last_editor_id", - schema: "portal", - table: "offers"); - - migrationBuilder.DropForeignKey( - name: "fk_provider_company_details_identities_last_editor_id", - schema: "portal", - table: "provider_company_details"); - - migrationBuilder.DropForeignKey( - name: "fk_user_roles_identities_last_editor_id", - schema: "portal", - table: "user_roles"); - migrationBuilder.DropTable( name: "audit_connector20230803", schema: "portal"); - migrationBuilder.DropIndex( - name: "ix_user_roles_last_editor_id", - schema: "portal", - table: "user_roles"); - - migrationBuilder.DropIndex( - name: "ix_provider_company_details_last_editor_id", - schema: "portal", - table: "provider_company_details"); - - migrationBuilder.DropIndex( - name: "ix_offers_last_editor_id", - schema: "portal", - table: "offers"); - - migrationBuilder.DropIndex( - name: "ix_offer_subscriptions_last_editor_id", - schema: "portal", - table: "offer_subscriptions"); - - migrationBuilder.DropIndex( - name: "ix_identity_assigned_roles_last_editor_id", - schema: "portal", - table: "identity_assigned_roles"); - - migrationBuilder.DropIndex( - name: "ix_identities_last_editor_id", - schema: "portal", - table: "identities"); - - migrationBuilder.DropIndex( - name: "ix_consents_last_editor_id", - schema: "portal", - table: "consents"); - - migrationBuilder.DropIndex( - name: "ix_company_users_last_editor_id", - schema: "portal", - table: "company_users"); - - migrationBuilder.DropIndex( - name: "ix_company_ssi_details_last_editor_id", - schema: "portal", - table: "company_ssi_details"); - - migrationBuilder.DropIndex( - name: "ix_company_assigned_roles_last_editor_id", - schema: "portal", - table: "company_assigned_roles"); - - migrationBuilder.DropIndex( - name: "ix_company_applications_last_editor_id", - schema: "portal", - table: "company_applications"); - - migrationBuilder.DropIndex( - name: "ix_app_subscription_details_last_editor_id", - schema: "portal", - table: "app_subscription_details"); - migrationBuilder.AddColumn( name: "daps_registration_successful", schema: "portal", @@ -436,15 +117,6 @@ protected override void Down(MigrationBuilder migrationBuilder) onDelete: ReferentialAction.SetNull); }); - migrationBuilder.AddForeignKey( - name: "fk_notifications_company_users_creator_id", - schema: "portal", - table: "notifications", - column: "creator_user_id", - principalSchema: "portal", - principalTable: "company_users", - principalColumn: "id"); - migrationBuilder.Sql("CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_CONNECTOR() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_CONNECTOR$\r\nBEGIN\r\n INSERT INTO portal.audit_connector20230503 (\"id\", \"name\", \"connector_url\", \"type_id\", \"status_id\", \"provider_id\", \"host_id\", \"self_description_document_id\", \"location_id\", \"daps_registration_successful\", \"self_description_message\", \"date_last_changed\", \"company_service_account_id\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT OLD.id, \r\n OLD.name, \r\n OLD.connector_url, \r\n OLD.type_id, \r\n OLD.status_id, \r\n OLD.provider_id, \r\n OLD.host_id, \r\n OLD.self_description_document_id, \r\n OLD.location_id, \r\n OLD.daps_registration_successful, \r\n OLD.self_description_message, \r\n OLD.date_last_changed, \r\n OLD.company_service_account_id, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_CONNECTOR$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_CONNECTOR AFTER DELETE\r\nON portal.connectors\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_CONNECTOR();"); migrationBuilder.Sql("CREATE FUNCTION portal.LC_TRIGGER_AFTER_INSERT_CONNECTOR() RETURNS trigger as $LC_TRIGGER_AFTER_INSERT_CONNECTOR$\r\nBEGIN\r\n INSERT INTO portal.audit_connector20230503 (\"id\", \"name\", \"connector_url\", \"type_id\", \"status_id\", \"provider_id\", \"host_id\", \"self_description_document_id\", \"location_id\", \"daps_registration_successful\", \"self_description_message\", \"date_last_changed\", \"company_service_account_id\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT NEW.id, \r\n NEW.name, \r\n NEW.connector_url, \r\n NEW.type_id, \r\n NEW.status_id, \r\n NEW.provider_id, \r\n NEW.host_id, \r\n NEW.self_description_document_id, \r\n NEW.location_id, \r\n NEW.daps_registration_successful, \r\n NEW.self_description_message, \r\n NEW.date_last_changed, \r\n NEW.company_service_account_id, \r\n NEW.last_editor_id, \r\n gen_random_uuid(), \r\n 1, \r\n CURRENT_DATE, \r\n NEW.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_INSERT_CONNECTOR$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_INSERT_CONNECTOR AFTER INSERT\r\nON portal.connectors\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_INSERT_CONNECTOR();"); diff --git a/src/portalbackend/PortalBackend.Migrations/Migrations/PortalDbContextModelSnapshot.cs b/src/portalbackend/PortalBackend.Migrations/Migrations/PortalDbContextModelSnapshot.cs index 2dfa4a7322..7917d91dc2 100644 --- a/src/portalbackend/PortalBackend.Migrations/Migrations/PortalDbContextModelSnapshot.cs +++ b/src/portalbackend/PortalBackend.Migrations/Migrations/PortalDbContextModelSnapshot.cs @@ -1,4 +1,4 @@ -/******************************************************************************** +/******************************************************************************** * Copyright (c) 2021, 2023 BMW Group AG * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation * From 6df1bdaef2aa6ba0c93007e2fa0bdd07f990c781 Mon Sep 17 00:00:00 2001 From: Phil Schneider Date: Fri, 4 Aug 2023 16:08:42 +0200 Subject: [PATCH 3/5] chore: fix encoding --- .../Migrations/20230804135935_1.6.0-rc5.Designer.cs | 2 +- .../Migrations/20230804135935_1.6.0-rc5.cs | 2 +- .../Migrations/PortalDbContextModelSnapshot.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/portalbackend/PortalBackend.Migrations/Migrations/20230804135935_1.6.0-rc5.Designer.cs b/src/portalbackend/PortalBackend.Migrations/Migrations/20230804135935_1.6.0-rc5.Designer.cs index 78d9bc9ac5..f3cadb87c9 100644 --- a/src/portalbackend/PortalBackend.Migrations/Migrations/20230804135935_1.6.0-rc5.Designer.cs +++ b/src/portalbackend/PortalBackend.Migrations/Migrations/20230804135935_1.6.0-rc5.Designer.cs @@ -1,4 +1,4 @@ -/******************************************************************************** +/******************************************************************************** * Copyright (c) 2021, 2023 BMW Group AG * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation * diff --git a/src/portalbackend/PortalBackend.Migrations/Migrations/20230804135935_1.6.0-rc5.cs b/src/portalbackend/PortalBackend.Migrations/Migrations/20230804135935_1.6.0-rc5.cs index d8a6bf72ba..c88088a8a2 100644 --- a/src/portalbackend/PortalBackend.Migrations/Migrations/20230804135935_1.6.0-rc5.cs +++ b/src/portalbackend/PortalBackend.Migrations/Migrations/20230804135935_1.6.0-rc5.cs @@ -1,4 +1,4 @@ -/******************************************************************************** +/******************************************************************************** * Copyright (c) 2021, 2023 BMW Group AG * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation * diff --git a/src/portalbackend/PortalBackend.Migrations/Migrations/PortalDbContextModelSnapshot.cs b/src/portalbackend/PortalBackend.Migrations/Migrations/PortalDbContextModelSnapshot.cs index 7917d91dc2..2dfa4a7322 100644 --- a/src/portalbackend/PortalBackend.Migrations/Migrations/PortalDbContextModelSnapshot.cs +++ b/src/portalbackend/PortalBackend.Migrations/Migrations/PortalDbContextModelSnapshot.cs @@ -1,4 +1,4 @@ -/******************************************************************************** +/******************************************************************************** * Copyright (c) 2021, 2023 BMW Group AG * Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation * From c28631873f2a2471d283edeba0b8bfe2d23fd14a Mon Sep 17 00:00:00 2001 From: Phil Schneider Date: Mon, 7 Aug 2023 10:24:19 +0200 Subject: [PATCH 4/5] feat(ssi): add SUSTAINABILITY_CREDENTIAL type --- .../20230804135935_1.6.0-rc5.Designer.cs | 12 +++++++++- .../Migrations/20230804135935_1.6.0-rc5.cs | 24 +++++++++++++++++++ .../PortalDbContextModelSnapshot.cs | 10 ++++++++ ...pe_use_case_detail_versions.consortia.json | 8 +++++++ ...edential_type_assigned_external_types.json | 4 ++++ ...rified_credential_type_assigned_kinds.json | 4 ++++ ...ed_credential_type_assigned_use_cases.json | 4 ++++ .../Enums/VerifiedCredentialExternalTypeId.cs | 3 +++ .../Enums/VerifiedCredentialTypeId.cs | 3 +++ .../CompanySsiDetailsRepositoryTests.cs | 7 +++--- 10 files changed, 75 insertions(+), 4 deletions(-) diff --git a/src/portalbackend/PortalBackend.Migrations/Migrations/20230804135935_1.6.0-rc5.Designer.cs b/src/portalbackend/PortalBackend.Migrations/Migrations/20230804135935_1.6.0-rc5.Designer.cs index f3cadb87c9..a2ace8188e 100644 --- a/src/portalbackend/PortalBackend.Migrations/Migrations/20230804135935_1.6.0-rc5.Designer.cs +++ b/src/portalbackend/PortalBackend.Migrations/Migrations/20230804135935_1.6.0-rc5.Designer.cs @@ -29,7 +29,7 @@ namespace Org.Eclipse.TractusX.Portal.Backend.PortalBackend.Migrations.Migrations { [DbContext(typeof(PortalDbContext))] - [Migration("20230804135935_1.6.0-rc5")] + [Migration("20230807080842_1.6.0-rc5")] partial class _160rc5 { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -5104,6 +5104,11 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { Id = 4, Label = "VEHICLE_DISMANTLE" + }, + new + { + Id = 5, + Label = "SUSTAINABILITY_CREDENTIAL" }); }); @@ -5183,6 +5188,11 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { Id = 4, Label = "DISMANTLER_CERTIFICATE" + }, + new + { + Id = 5, + Label = "SUSTAINABILITY_FRAMEWORK" }); }); diff --git a/src/portalbackend/PortalBackend.Migrations/Migrations/20230804135935_1.6.0-rc5.cs b/src/portalbackend/PortalBackend.Migrations/Migrations/20230804135935_1.6.0-rc5.cs index c88088a8a2..9d03684a75 100644 --- a/src/portalbackend/PortalBackend.Migrations/Migrations/20230804135935_1.6.0-rc5.cs +++ b/src/portalbackend/PortalBackend.Migrations/Migrations/20230804135935_1.6.0-rc5.cs @@ -71,6 +71,18 @@ protected override void Up(MigrationBuilder migrationBuilder) table.PrimaryKey("pk_audit_connector20230803", x => x.audit_v1id); }); + migrationBuilder.InsertData( + schema: "portal", + table: "verified_credential_external_types", + columns: new[] { "id", "label" }, + values: new object[] { 5, "SUSTAINABILITY_CREDENTIAL" }); + + migrationBuilder.InsertData( + schema: "portal", + table: "verified_credential_types", + columns: new[] { "id", "label" }, + values: new object[] { 5, "SUSTAINABILITY_FRAMEWORK" }); + migrationBuilder.Sql("CREATE FUNCTION portal.LC_TRIGGER_AFTER_DELETE_CONNECTOR() RETURNS trigger as $LC_TRIGGER_AFTER_DELETE_CONNECTOR$\r\nBEGIN\r\n INSERT INTO portal.audit_connector20230803 (\"id\", \"name\", \"connector_url\", \"type_id\", \"status_id\", \"provider_id\", \"host_id\", \"self_description_document_id\", \"location_id\", \"self_description_message\", \"date_last_changed\", \"company_service_account_id\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT OLD.id, \r\n OLD.name, \r\n OLD.connector_url, \r\n OLD.type_id, \r\n OLD.status_id, \r\n OLD.provider_id, \r\n OLD.host_id, \r\n OLD.self_description_document_id, \r\n OLD.location_id, \r\n OLD.self_description_message, \r\n OLD.date_last_changed, \r\n OLD.company_service_account_id, \r\n OLD.last_editor_id, \r\n gen_random_uuid(), \r\n 3, \r\n CURRENT_DATE, \r\n OLD.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_DELETE_CONNECTOR$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_DELETE_CONNECTOR AFTER DELETE\r\nON portal.connectors\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_DELETE_CONNECTOR();"); migrationBuilder.Sql("CREATE FUNCTION portal.LC_TRIGGER_AFTER_INSERT_CONNECTOR() RETURNS trigger as $LC_TRIGGER_AFTER_INSERT_CONNECTOR$\r\nBEGIN\r\n INSERT INTO portal.audit_connector20230803 (\"id\", \"name\", \"connector_url\", \"type_id\", \"status_id\", \"provider_id\", \"host_id\", \"self_description_document_id\", \"location_id\", \"self_description_message\", \"date_last_changed\", \"company_service_account_id\", \"last_editor_id\", \"audit_v1id\", \"audit_v1operation_id\", \"audit_v1date_last_changed\", \"audit_v1last_editor_id\") SELECT NEW.id, \r\n NEW.name, \r\n NEW.connector_url, \r\n NEW.type_id, \r\n NEW.status_id, \r\n NEW.provider_id, \r\n NEW.host_id, \r\n NEW.self_description_document_id, \r\n NEW.location_id, \r\n NEW.self_description_message, \r\n NEW.date_last_changed, \r\n NEW.company_service_account_id, \r\n NEW.last_editor_id, \r\n gen_random_uuid(), \r\n 1, \r\n CURRENT_DATE, \r\n NEW.last_editor_id;\r\nRETURN NEW;\r\nEND;\r\n$LC_TRIGGER_AFTER_INSERT_CONNECTOR$ LANGUAGE plpgsql;\r\nCREATE TRIGGER LC_TRIGGER_AFTER_INSERT_CONNECTOR AFTER INSERT\r\nON portal.connectors\r\nFOR EACH ROW EXECUTE PROCEDURE portal.LC_TRIGGER_AFTER_INSERT_CONNECTOR();"); @@ -86,6 +98,18 @@ protected override void Down(MigrationBuilder migrationBuilder) migrationBuilder.Sql("DROP FUNCTION portal.LC_TRIGGER_AFTER_UPDATE_CONNECTOR() CASCADE;"); + migrationBuilder.DeleteData( + schema: "portal", + table: "verified_credential_external_types", + keyColumn: "id", + keyValue: 5); + + migrationBuilder.DeleteData( + schema: "portal", + table: "verified_credential_types", + keyColumn: "id", + keyValue: 5); + migrationBuilder.DropTable( name: "audit_connector20230803", schema: "portal"); diff --git a/src/portalbackend/PortalBackend.Migrations/Migrations/PortalDbContextModelSnapshot.cs b/src/portalbackend/PortalBackend.Migrations/Migrations/PortalDbContextModelSnapshot.cs index 2dfa4a7322..b6e905cda8 100644 --- a/src/portalbackend/PortalBackend.Migrations/Migrations/PortalDbContextModelSnapshot.cs +++ b/src/portalbackend/PortalBackend.Migrations/Migrations/PortalDbContextModelSnapshot.cs @@ -5102,6 +5102,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) { Id = 4, Label = "VEHICLE_DISMANTLE" + }, + new + { + Id = 5, + Label = "SUSTAINABILITY_CREDENTIAL" }); }); @@ -5181,6 +5186,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) { Id = 4, Label = "DISMANTLER_CERTIFICATE" + }, + new + { + Id = 5, + Label = "SUSTAINABILITY_FRAMEWORK" }); }); diff --git a/src/portalbackend/PortalBackend.Migrations/Seeder/Data/verified_credential_external_type_use_case_detail_versions.consortia.json b/src/portalbackend/PortalBackend.Migrations/Seeder/Data/verified_credential_external_type_use_case_detail_versions.consortia.json index b771a28875..2bb1b79f9f 100644 --- a/src/portalbackend/PortalBackend.Migrations/Seeder/Data/verified_credential_external_type_use_case_detail_versions.consortia.json +++ b/src/portalbackend/PortalBackend.Migrations/Seeder/Data/verified_credential_external_type_use_case_detail_versions.consortia.json @@ -30,5 +30,13 @@ "template": "https://catena-x.net/fileadmin/user_upload/04_Einfuehren_und_umsetzen/Framework_Use_Case_Traceability/Catena_X_Use_Case_Rahmenbedingungen_Trace_3.0_DE.pdf", "valid_from": "2024-01-01 00:00:00.000000 +00:00", "expiry": "2024-12-31 00:00:00.000000 +00:00" + }, + { + "id": "1268a76a-ca19-4dd8-b932-01f24071d565", + "verified_credential_external_type_id": 5, + "version": "1.0.0", + "template": "https://catena-x.net/fileadmin/user_upload/04_Einfuehren_und_umsetzen/Framework_Use_Case_Traceability/Catena_X_Use_Case_Rahmenbedingungen_Trace_3.0_DE.pdf", + "valid_from": "2024-01-01 00:00:00.000000 +00:00", + "expiry": "2024-12-31 00:00:00.000000 +00:00" } ] diff --git a/src/portalbackend/PortalBackend.Migrations/Seeder/Data/verified_credential_type_assigned_external_types.json b/src/portalbackend/PortalBackend.Migrations/Seeder/Data/verified_credential_type_assigned_external_types.json index c82c6ade28..c3b296b22d 100644 --- a/src/portalbackend/PortalBackend.Migrations/Seeder/Data/verified_credential_type_assigned_external_types.json +++ b/src/portalbackend/PortalBackend.Migrations/Seeder/Data/verified_credential_type_assigned_external_types.json @@ -14,5 +14,9 @@ { "verified_credential_external_type_id": 4, "verified_credential_type_id": 4 + }, + { + "verified_credential_external_type_id": 5, + "verified_credential_type_id": 5 } ] diff --git a/src/portalbackend/PortalBackend.Migrations/Seeder/Data/verified_credential_type_assigned_kinds.json b/src/portalbackend/PortalBackend.Migrations/Seeder/Data/verified_credential_type_assigned_kinds.json index 05051369d0..fe63a18b50 100644 --- a/src/portalbackend/PortalBackend.Migrations/Seeder/Data/verified_credential_type_assigned_kinds.json +++ b/src/portalbackend/PortalBackend.Migrations/Seeder/Data/verified_credential_type_assigned_kinds.json @@ -14,5 +14,9 @@ { "verified_credential_type_id": 4, "verified_credential_type_kind_id": 2 + }, + { + "verified_credential_type_id": 5, + "verified_credential_type_kind_id": 1 } ] diff --git a/src/portalbackend/PortalBackend.Migrations/Seeder/Data/verified_credential_type_assigned_use_cases.json b/src/portalbackend/PortalBackend.Migrations/Seeder/Data/verified_credential_type_assigned_use_cases.json index 286ee622db..22165c2153 100644 --- a/src/portalbackend/PortalBackend.Migrations/Seeder/Data/verified_credential_type_assigned_use_cases.json +++ b/src/portalbackend/PortalBackend.Migrations/Seeder/Data/verified_credential_type_assigned_use_cases.json @@ -10,5 +10,9 @@ { "verified_credential_type_id": 3, "use_case_id": "c065a349-f649-47f8-94d5-1a504a855419" + }, + { + "verified_credential_type_id": 5, + "use_case_id": "1aacde78-35ec-4df3-ba1e-f988cddcbbd8" } ] diff --git a/src/portalbackend/PortalBackend.PortalEntities/Enums/VerifiedCredentialExternalTypeId.cs b/src/portalbackend/PortalBackend.PortalEntities/Enums/VerifiedCredentialExternalTypeId.cs index 3394141f3d..8052ecfdd5 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Enums/VerifiedCredentialExternalTypeId.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Enums/VerifiedCredentialExternalTypeId.cs @@ -15,4 +15,7 @@ public enum VerifiedCredentialExternalTypeId [EnumMember(Value = "vehicleDismantle")] VEHICLE_DISMANTLE = 4, + + [EnumMember(Value = "Sustainability_Credential")] + SUSTAINABILITY_CREDENTIAL = 5, } diff --git a/src/portalbackend/PortalBackend.PortalEntities/Enums/VerifiedCredentialTypeId.cs b/src/portalbackend/PortalBackend.PortalEntities/Enums/VerifiedCredentialTypeId.cs index 1346d35376..d19531b257 100644 --- a/src/portalbackend/PortalBackend.PortalEntities/Enums/VerifiedCredentialTypeId.cs +++ b/src/portalbackend/PortalBackend.PortalEntities/Enums/VerifiedCredentialTypeId.cs @@ -35,4 +35,7 @@ public enum VerifiedCredentialTypeId [EnumMember(Value = "Dismantler Certificate")] DISMANTLER_CERTIFICATE = 4, + + [EnumMember(Value = "Sustainability Framework")] + SUSTAINABILITY_FRAMEWORK = 5, } diff --git a/tests/portalbackend/PortalBackend.DBAccess.Tests/CompanySsiDetailsRepositoryTests.cs b/tests/portalbackend/PortalBackend.DBAccess.Tests/CompanySsiDetailsRepositoryTests.cs index 2dedd57756..b23f859f57 100644 --- a/tests/portalbackend/PortalBackend.DBAccess.Tests/CompanySsiDetailsRepositoryTests.cs +++ b/tests/portalbackend/PortalBackend.DBAccess.Tests/CompanySsiDetailsRepositoryTests.cs @@ -55,11 +55,12 @@ public async Task GetDetailsForCompany_WithValidData_ReturnsExpected() var result = await sut.GetUseCaseParticipationForCompany(_validCompanyId, "en").ToListAsync().ConfigureAwait(false); // Assert - result.Should().HaveCount(3); - result.Where(x => x.Description != null).Should().HaveCount(3).And.Satisfy( + result.Should().HaveCount(4); + result.Where(x => x.Description != null).Should().HaveCount(4).And.Satisfy( x => x.Description == "Traceability", x => x.Description == "Sustainability & CO2-Footprint", - x => x.Description == "Quality Management"); + x => x.Description == "Quality Management", + x => x.Description == "Circular Economy"); var traceability = result.Single(x => x.CredentialType == VerifiedCredentialTypeId.TRACEABILITY_FRAMEWORK); traceability.VerifiedCredentials.Should().HaveCount(3).And.Satisfy( x => x.ExternalDetailData.Version == "1.0.0" && x.SsiDetailData.Single().ParticipationStatus == CompanySsiDetailStatusId.PENDING, From a3443402a524fe876e86dd23e7e331467d92f009 Mon Sep 17 00:00:00 2001 From: Phil Schneider Date: Mon, 7 Aug 2023 10:32:04 +0200 Subject: [PATCH 5/5] release: bump version for v1.6.0-RC5 --- CHANGELOG.md | 24 ++++++++++++++++++++++++ src/Directory.Build.props | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 22852bab6a..b0a301d016 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,30 @@ New features, fixed bugs, known defects and other noteworthy changes to each release of the Catena-X Portal Backend. +## 1.6.0-RC5 + +### Change +* Administration Service + * add validation to endpoint /api/administration/serviceaccount/owncompany/serviceaccounts/{serviceAccountId} to check if requesting user is either owner or provider + * enable search of clientId for GET /api/administration/serviceaccount/owncompany/serviceaccounts +* Daps + * Remove Daps calls from all business logic + +### Technical Support +* update of the portal_welcome_email template +* add check whether an endpoint should only be callable for a service account user +* add check whether an endpoint should only be callable for a company user + +### Bugfix +* Logging + * configure serilog for backend services + +### Known Knowns +* Registration process additional invited user receives 'Welcome Email' without personal salutation due to missing first and last name +* New service account is created with identity "Company User" inside identity table - however the user mapping to company_service_accounts is assigned correctly +* Managed technical users (for offer customers) are not fetched in the GET /serviceAccounts call +* Changing an app instance type (/api/apps/AppReleaseProcess/instance-type/{appId}) is not blocked as soon as the app is submitted for release + ## 1.6.0-RC4 ### Change diff --git a/src/Directory.Build.props b/src/Directory.Build.props index a3c653174f..b64b7a10bf 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -21,6 +21,6 @@ 1.6.0 - RC4 + RC5