@sphereon/ssi-sdk.data-store
Version:
73 lines • 9.44 kB
JavaScript
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CreateIssuanceBranding1685628974232 = void 0;
const ssi_sdk_core_1 = require("@sphereon/ssi-sdk.core");
class CreateIssuanceBranding1685628974232 {
constructor() {
this.name = 'CreateIssuanceBranding1685628974232';
}
up(queryRunner) {
return __awaiter(this, void 0, void 0, function* () {
yield (0, ssi_sdk_core_1.enablePostgresUuidExtension)(queryRunner);
yield queryRunner.query(`CREATE TABLE "ImageDimensions" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "width" integer NOT NULL, "height" integer NOT NULL, CONSTRAINT "PK_ImageDimensions_id" PRIMARY KEY ("id"))`);
yield queryRunner.query(`CREATE TABLE "ImageAttributes" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "uri" character varying, "dataUri" character varying, "mediaType" character varying(255), "alt" character varying(255), "dimensionsId" uuid, CONSTRAINT "UQ_dimensionsId" UNIQUE ("dimensionsId"), CONSTRAINT "PK_ImageAttributes_id" PRIMARY KEY ("id"))`);
yield queryRunner.query(`CREATE TABLE "BackgroundAttributes" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "color" character varying(255), "imageId" uuid, CONSTRAINT "UQ_imageId" UNIQUE ("imageId"), CONSTRAINT "PK_BackgroundAttributes_id" PRIMARY KEY ("id"))`);
yield queryRunner.query(`CREATE TABLE "TextAttributes" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "color" character varying(255), CONSTRAINT "PK_TextAttributes_id" PRIMARY KEY ("id"))`);
yield queryRunner.query(`CREATE TABLE "BaseLocaleBranding" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "alias" character varying(255), "locale" character varying(255) NOT NULL, "description" character varying(255), "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), "credentialBrandingId" uuid, "issuerBrandingId" uuid, "type" character varying NOT NULL, "logoId" uuid, "backgroundId" uuid, "textId" uuid, "client_uri" character varying, "tos_uri" character varying, "policy_uri" character varying, "contacts" character varying, CONSTRAINT "UQ_logoId" UNIQUE ("logoId"), CONSTRAINT "UQ_backgroundId" UNIQUE ("backgroundId"), CONSTRAINT "UQ_textId" UNIQUE ("textId"), CONSTRAINT "PK_BaseLocaleBranding_id" PRIMARY KEY ("id"))`);
yield queryRunner.query(`CREATE UNIQUE INDEX "IDX_CredentialLocaleBrandingEntity_credentialBranding_locale" ON "BaseLocaleBranding" ("credentialBrandingId", "locale")`);
yield queryRunner.query(`CREATE UNIQUE INDEX "IDX_IssuerLocaleBrandingEntity_issuerBranding_locale" ON "BaseLocaleBranding" ("issuerBrandingId", "locale")`);
yield queryRunner.query(`CREATE INDEX "IDX_BaseLocaleBranding_type" ON "BaseLocaleBranding" ("type")`);
yield queryRunner.query(`CREATE TABLE "CredentialClaims" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "key" character varying(255) NOT NULL, "name" character varying(255) NOT NULL, "credentialLocaleBrandingId" character varying, CONSTRAINT "PK_CredentialClaims_id" PRIMARY KEY ("id"))`);
yield queryRunner.query(`CREATE UNIQUE INDEX "IDX_CredentialClaimsEntity_credentialLocaleBranding_locale" ON "CredentialClaims" ("credentialLocaleBrandingId", "key")`);
yield queryRunner.query(`CREATE TABLE "CredentialBranding" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "vcHash" character varying(255) NOT NULL, "issuerCorrelationId" character varying(255) NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "UQ_vcHash" UNIQUE ("vcHash"), CONSTRAINT "PK_CredentialBranding_id" PRIMARY KEY ("id"))`);
yield queryRunner.query(`CREATE INDEX "IDX_CredentialBrandingEntity_issuerCorrelationId" ON "CredentialBranding" ("issuerCorrelationId")`);
yield queryRunner.query(`CREATE INDEX "IDX_CredentialBrandingEntity_vcHash" ON "CredentialBranding" ("vcHash")`);
yield queryRunner.query(`CREATE TABLE "IssuerBranding" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "issuerCorrelationId" character varying(255) NOT NULL, "created_at" TIMESTAMP NOT NULL DEFAULT now(), "last_updated_at" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "UQ_issuerCorrelationId" UNIQUE ("issuerCorrelationId"), CONSTRAINT "PK_IssuerBranding_id" PRIMARY KEY ("id"))`);
yield queryRunner.query(`CREATE INDEX "IDX_IssuerBrandingEntity_issuerCorrelationId" ON "IssuerBranding" ("issuerCorrelationId")`);
yield queryRunner.query(`ALTER TABLE "ImageAttributes" ADD CONSTRAINT "FK_ImageAttributes_dimensionsId" FOREIGN KEY ("dimensionsId") REFERENCES "ImageDimensions"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
yield queryRunner.query(`ALTER TABLE "BackgroundAttributes" ADD CONSTRAINT "FK_BackgroundAttributes_imageId" FOREIGN KEY ("imageId") REFERENCES "ImageAttributes"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
yield queryRunner.query(`ALTER TABLE "BaseLocaleBranding" ADD CONSTRAINT "FK_BaseLocaleBranding_logoId" FOREIGN KEY ("logoId") REFERENCES "ImageAttributes"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
yield queryRunner.query(`ALTER TABLE "BaseLocaleBranding" ADD CONSTRAINT "FK_BaseLocaleBranding_backgroundId" FOREIGN KEY ("backgroundId") REFERENCES "BackgroundAttributes"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
yield queryRunner.query(`ALTER TABLE "BaseLocaleBranding" ADD CONSTRAINT "FK_BaseLocaleBranding_textId" FOREIGN KEY ("textId") REFERENCES "TextAttributes"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
yield queryRunner.query(`ALTER TABLE "BaseLocaleBranding" ADD CONSTRAINT "FK_BaseLocaleBranding_credentialBrandingId" FOREIGN KEY ("credentialBrandingId") REFERENCES "CredentialBranding"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
yield queryRunner.query(`ALTER TABLE "BaseLocaleBranding" ADD CONSTRAINT "FK_BaseLocaleBranding_issuerBrandingId" FOREIGN KEY ("issuerBrandingId") REFERENCES "IssuerBranding"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
});
}
down(queryRunner) {
return __awaiter(this, void 0, void 0, function* () {
yield queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_BaseLocaleBranding_issuerBrandingId"`);
yield queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_BaseLocaleBranding_credentialBrandingId"`);
yield queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_BaseLocaleBranding_textId"`);
yield queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_BaseLocaleBranding_backgroundId"`);
yield queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_BaseLocaleBranding_logoId"`);
yield queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_BackgroundAttributes_imageId"`);
yield queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP CONSTRAINT "FK_ImageAttributes_dimensionsId"`);
yield queryRunner.query(`ALTER TABLE "IssuerBranding" DROP INDEX "IDX_IssuerBrandingEntity_issuerCorrelationId"`);
yield queryRunner.query(`DROP TABLE "IssuerBranding"`);
yield queryRunner.query(`ALTER TABLE "CredentialBranding" DROP INDEX "IDX_CredentialBrandingEntity_vcHash"`);
yield queryRunner.query(`ALTER TABLE "CredentialBranding" DROP INDEX "IDX_CredentialBrandingEntity_issuerCorrelationId"`);
yield queryRunner.query(`DROP TABLE "CredentialBranding"`);
yield queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP INDEX "IDX_BaseLocaleBranding_type"`);
yield queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP INDEX "IDX_IssuerLocaleBrandingEntity_issuerBranding_locale"`);
yield queryRunner.query(`ALTER TABLE "BaseLocaleBranding" DROP INDEX "IDX_CredentialLocaleBrandingEntity_credentialBranding_locale"`);
yield queryRunner.query(`ALTER TABLE "CredentialClaims" DROP INDEX "IDX_CredentialClaimsEntity_credentialLocaleBranding_locale"`);
yield queryRunner.query(`DROP TABLE "CredentialClaims"`);
yield queryRunner.query(`DROP TABLE "BaseLocaleBranding"`);
yield queryRunner.query(`DROP TABLE "TextAttributes"`);
yield queryRunner.query(`DROP TABLE "BackgroundAttributes"`);
yield queryRunner.query(`DROP TABLE "ImageAttributes"`);
yield queryRunner.query(`DROP TABLE "ImageDimensions"`);
});
}
}
exports.CreateIssuanceBranding1685628974232 = CreateIssuanceBranding1685628974232;
//# sourceMappingURL=1685628974232-CreateIssuanceBranding.js.map