diff --git a/prisma/migrations/20240701121336_add_issuer_id_and_verified_schemas/migration.sql b/prisma/migrations/20240701121336_add_issuer_id_and_verified_schemas/migration.sql deleted file mode 100644 index 934cf45..0000000 --- a/prisma/migrations/20240701121336_add_issuer_id_and_verified_schemas/migration.sql +++ /dev/null @@ -1,34 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `organizationId` on the `Schema` table. All the data in the column will be lost. - - Added the required column `issuerId` to the `Schema` table without a default value. This is not possible if the table is not empty. - -*/ --- DropForeignKey -ALTER TABLE "Schema" DROP CONSTRAINT "Schema_organizationId_fkey"; - --- AlterTable -ALTER TABLE "Schema" DROP COLUMN "organizationId", -ADD COLUMN "issuerId" TEXT NOT NULL; - --- CreateTable -CREATE TABLE "_VerifierSchemas" ( - "A" TEXT NOT NULL, - "B" TEXT NOT NULL -); - --- CreateIndex -CREATE UNIQUE INDEX "_VerifierSchemas_AB_unique" ON "_VerifierSchemas"("A", "B"); - --- CreateIndex -CREATE INDEX "_VerifierSchemas_B_index" ON "_VerifierSchemas"("B"); - --- AddForeignKey -ALTER TABLE "Schema" ADD CONSTRAINT "Schema_issuerId_fkey" FOREIGN KEY ("issuerId") REFERENCES "Organization"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "_VerifierSchemas" ADD CONSTRAINT "_VerifierSchemas_A_fkey" FOREIGN KEY ("A") REFERENCES "Organization"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "_VerifierSchemas" ADD CONSTRAINT "_VerifierSchemas_B_fkey" FOREIGN KEY ("B") REFERENCES "Schema"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/prisma/migrations/20240705072819_/migration.sql b/prisma/migrations/20240705072819_/migration.sql deleted file mode 100644 index e7368e7..0000000 --- a/prisma/migrations/20240705072819_/migration.sql +++ /dev/null @@ -1,71 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `definition` on the `Schema` table. All the data in the column will be lost. - - You are about to drop the column `issuerId` on the `Schema` table. All the data in the column will be lost. - - You are about to drop the `Credential` table. If the table is not empty, all the data it contains will be lost. - - You are about to drop the `CredentialDefinition` table. If the table is not empty, all the data it contains will be lost. - - You are about to drop the `RevocationRegistry` table. If the table is not empty, all the data it contains will be lost. - - You are about to drop the `_VerifierSchemas` table. If the table is not empty, all the data it contains will be lost. - - Added the required column `assuranceLevelId` to the `Organization` table without a default value. This is not possible if the table is not empty. - - Added the required column `namespaceId` to the `Organization` table without a default value. This is not possible if the table is not empty. - - Added the required column `organizationId` to the `Schema` table without a default value. This is not possible if the table is not empty. - - Added the required column `type` to the `Schema` table without a default value. This is not possible if the table is not empty. - -*/ --- CreateEnum -CREATE TYPE "SchemaType" AS ENUM ('W3C', 'ANONCREDS'); - --- DropForeignKey -ALTER TABLE "Credential" DROP CONSTRAINT "Credential_definitionId_fkey"; - --- DropForeignKey -ALTER TABLE "Credential" DROP CONSTRAINT "Credential_revocationRegistryId_fkey"; - --- DropForeignKey -ALTER TABLE "Credential" DROP CONSTRAINT "Credential_schemaId_fkey"; - --- DropForeignKey -ALTER TABLE "Schema" DROP CONSTRAINT "Schema_issuerId_fkey"; - --- DropForeignKey -ALTER TABLE "_VerifierSchemas" DROP CONSTRAINT "_VerifierSchemas_A_fkey"; - --- DropForeignKey -ALTER TABLE "_VerifierSchemas" DROP CONSTRAINT "_VerifierSchemas_B_fkey"; - --- AlterTable -ALTER TABLE "Organization" ADD COLUMN "assuranceLevelId" TEXT NOT NULL, -ADD COLUMN "namespaceId" TEXT NOT NULL; - --- AlterTable -ALTER TABLE "Schema" DROP COLUMN "definition", -DROP COLUMN "issuerId", -ADD COLUMN "anonCredsDefinitionId" TEXT, -ADD COLUMN "organizationId" TEXT NOT NULL, -ADD COLUMN "type" "SchemaType" NOT NULL, -ADD COLUMN "w3cUri" TEXT; - --- DropTable -DROP TABLE "Credential"; - --- DropTable -DROP TABLE "CredentialDefinition"; - --- DropTable -DROP TABLE "RevocationRegistry"; - --- DropTable -DROP TABLE "_VerifierSchemas"; - --- DropEnum -DROP TYPE "CredentialType"; - --- AddForeignKey -ALTER TABLE "Organization" ADD CONSTRAINT "Organization_namespaceId_fkey" FOREIGN KEY ("namespaceId") REFERENCES "Namespace"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Organization" ADD CONSTRAINT "Organization_assuranceLevelId_fkey" FOREIGN KEY ("assuranceLevelId") REFERENCES "AssuranceLevel"("id") ON DELETE RESTRICT ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Schema" ADD CONSTRAINT "Schema_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20240718151011_add_attributes/migration.sql b/prisma/migrations/20240718151011_add_attributes/migration.sql deleted file mode 100644 index 5cc56c6..0000000 --- a/prisma/migrations/20240718151011_add_attributes/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE "Organization" ADD COLUMN "attributes" TEXT[]; diff --git a/prisma/migrations/20240718151510_without_attribute/migration.sql b/prisma/migrations/20240718151510_without_attribute/migration.sql deleted file mode 100644 index 8191110..0000000 --- a/prisma/migrations/20240718151510_without_attribute/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `attributes` on the `Organization` table. All the data in the column will be lost. - -*/ --- AlterTable -ALTER TABLE "Organization" DROP COLUMN "attributes"; diff --git a/prisma/migrations/20240718151719_name_to_anon_creds_schema_id/migration.sql b/prisma/migrations/20240718151719_name_to_anon_creds_schema_id/migration.sql deleted file mode 100644 index ef54867..0000000 --- a/prisma/migrations/20240718151719_name_to_anon_creds_schema_id/migration.sql +++ /dev/null @@ -1,9 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `anonCredsDefinitionId` on the `Schema` table. All the data in the column will be lost. - -*/ --- AlterTable -ALTER TABLE "Schema" DROP COLUMN "anonCredsDefinitionId", -ADD COLUMN "anonCredsSchemaId" TEXT; diff --git a/prisma/migrations/20240718152250_add_post_route_for_schema/migration.sql b/prisma/migrations/20240718152250_add_post_route_for_schema/migration.sql deleted file mode 100644 index 03d93d2..0000000 --- a/prisma/migrations/20240718152250_add_post_route_for_schema/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ --- DropForeignKey -ALTER TABLE "Schema" DROP CONSTRAINT "Schema_organizationId_fkey"; - --- AlterTable -ALTER TABLE "Schema" ALTER COLUMN "organizationId" DROP NOT NULL; - --- AddForeignKey -ALTER TABLE "Schema" ADD CONSTRAINT "Schema_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/prisma/migrations/20240718155719_add_govid_to_schema/migration.sql b/prisma/migrations/20240718155719_add_govid_to_schema/migration.sql deleted file mode 100644 index 0c8d3e4..0000000 --- a/prisma/migrations/20240718155719_add_govid_to_schema/migration.sql +++ /dev/null @@ -1,11 +0,0 @@ -/* - Warnings: - - - Added the required column `governanceAuthorityId` to the `Schema` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "Schema" ADD COLUMN "governanceAuthorityId" TEXT NOT NULL; - --- AddForeignKey -ALTER TABLE "Schema" ADD CONSTRAINT "Schema_governanceAuthorityId_fkey" FOREIGN KEY ("governanceAuthorityId") REFERENCES "GovernanceAuthority"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20240719073117_add_attributes/migration.sql b/prisma/migrations/20240719073117_add_attributes/migration.sql deleted file mode 100644 index 7b7e916..0000000 --- a/prisma/migrations/20240719073117_add_attributes/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE "Organization" ADD COLUMN "attributes" JSONB; diff --git a/prisma/migrations/20240704082415_/migration.sql b/prisma/migrations/20240719091118_all_reset/migration.sql similarity index 90% rename from prisma/migrations/20240704082415_/migration.sql rename to prisma/migrations/20240719091118_all_reset/migration.sql index 1adcbb5..40db24a 100644 --- a/prisma/migrations/20240704082415_/migration.sql +++ b/prisma/migrations/20240719091118_all_reset/migration.sql @@ -23,6 +23,7 @@ CREATE TABLE "Organization" ( "namespaceId" TEXT NOT NULL, "assuranceLevelId" TEXT NOT NULL, "onboardedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "attributes" JSONB, CONSTRAINT "Organization_pkey" PRIMARY KEY ("id") ); @@ -33,21 +34,13 @@ CREATE TABLE "Schema" ( "name" TEXT NOT NULL, "type" "SchemaType" NOT NULL, "w3cUri" TEXT, - "anonCredsDefinitionId" TEXT, - "organizationId" TEXT NOT NULL, + "anonCredsSchemaId" TEXT, + "organizationId" TEXT, + "governanceAuthorityId" TEXT NOT NULL, CONSTRAINT "Schema_pkey" PRIMARY KEY ("id") ); --- CreateTable -CREATE TABLE "RevocationRegistry" ( - "id" TEXT NOT NULL, - "name" TEXT NOT NULL, - "definition" JSONB NOT NULL, - - CONSTRAINT "RevocationRegistry_pkey" PRIMARY KEY ("id") -); - -- CreateTable CREATE TABLE "Namespace" ( "id" TEXT NOT NULL, @@ -96,7 +89,10 @@ ALTER TABLE "Organization" ADD CONSTRAINT "Organization_namespaceId_fkey" FOREIG ALTER TABLE "Organization" ADD CONSTRAINT "Organization_assuranceLevelId_fkey" FOREIGN KEY ("assuranceLevelId") REFERENCES "AssuranceLevel"("id") ON DELETE RESTRICT ON UPDATE CASCADE; -- AddForeignKey -ALTER TABLE "Schema" ADD CONSTRAINT "Schema_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE RESTRICT ON UPDATE CASCADE; +ALTER TABLE "Schema" ADD CONSTRAINT "Schema_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE SET NULL ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "Schema" ADD CONSTRAINT "Schema_governanceAuthorityId_fkey" FOREIGN KEY ("governanceAuthorityId") REFERENCES "GovernanceAuthority"("id") ON DELETE RESTRICT ON UPDATE CASCADE; -- AddForeignKey ALTER TABLE "Namespace" ADD CONSTRAINT "Namespace_governanceAuthorityId_fkey" FOREIGN KEY ("governanceAuthorityId") REFERENCES "GovernanceAuthority"("id") ON DELETE RESTRICT ON UPDATE CASCADE;