From b8d16fe6a7c5b0fb954f5769b93a36198d2c49a5 Mon Sep 17 00:00:00 2001 From: Roy Scheeren Date: Tue, 23 Jan 2024 15:56:42 +0100 Subject: [PATCH] feat(envited.ascs.digital): add company profile table Signed-off-by: Roy Scheeren --- .../common/database/data/companyCategories.ts | 32 + .../common/database/schema.ts | 47 +- .../common/database/seed.ts | 9 +- .../development/0001_mysterious_kree.sql | 43 ++ .../development/meta/0001_snapshot.json | 619 ++++++++++++++++++ .../drizzle/development/meta/_journal.json | 7 + .../drizzle/staging/0001_rare_falcon.sql | 43 ++ .../drizzle/staging/meta/0001_snapshot.json | 619 ++++++++++++++++++ .../drizzle/staging/meta/_journal.json | 7 + 9 files changed, 1422 insertions(+), 4 deletions(-) create mode 100644 apps/envited.ascs.digital/common/database/data/companyCategories.ts create mode 100644 apps/envited.ascs.digital/drizzle/development/0001_mysterious_kree.sql create mode 100644 apps/envited.ascs.digital/drizzle/development/meta/0001_snapshot.json create mode 100644 apps/envited.ascs.digital/drizzle/staging/0001_rare_falcon.sql create mode 100644 apps/envited.ascs.digital/drizzle/staging/meta/0001_snapshot.json diff --git a/apps/envited.ascs.digital/common/database/data/companyCategories.ts b/apps/envited.ascs.digital/common/database/data/companyCategories.ts new file mode 100644 index 00000000..262ea728 --- /dev/null +++ b/apps/envited.ascs.digital/common/database/data/companyCategories.ts @@ -0,0 +1,32 @@ +export const COMPANY_CATEGORIES = [ + { + id: 'oem', + name: 'OEM', + description: 'Original Equipment Manufacturer', + }, + { + id: 'supplier', + name: 'Supplier', + description: 'Supplier', + }, + { + id: 'data-provider', + name: 'Data Provider', + description: 'Data Provider', + }, + { + id: 'service-provider', + name: 'Service Provider', + description: 'Service Provider', + }, + { + id: 'tool-vendor', + name: 'Tool Vendor', + description: 'Tool Vendor', + }, + { + id: 'academics', + name: 'Academics', + description: 'Academics', + }, +] diff --git a/apps/envited.ascs.digital/common/database/schema.ts b/apps/envited.ascs.digital/common/database/schema.ts index 1b65b18c..4ca3497f 100644 --- a/apps/envited.ascs.digital/common/database/schema.ts +++ b/apps/envited.ascs.digital/common/database/schema.ts @@ -1,5 +1,5 @@ import { relations } from 'drizzle-orm' -import { boolean, pgTable, text, timestamp, uuid } from 'drizzle-orm/pg-core' +import { boolean, jsonb, pgTable, text, timestamp, uuid } from 'drizzle-orm/pg-core' export const user = pgTable('user', { id: text('id').unique().primaryKey(), @@ -9,7 +9,7 @@ export const user = pgTable('user', { isEnvitedMember: boolean('is_envited_member'), streetAddress: text('street_address'), postalCode: text('postal_code'), - addressLocality: text('address_location'), + addressLocality: text('address_locality'), addressCountry: text('address_country'), vatId: text('vat_id'), privacyPolicyAccepted: text('privacy_policy_accepted'), @@ -102,3 +102,46 @@ export const usersToRolesRelations = relations(usersToRoles, ({ one }) => ({ references: [user.id], }), })) + +export const profile = pgTable('profile', { + id: uuid('id').defaultRandom().primaryKey(), + name: text('name').unique(), + description: text('description'), + logo: text('logo'), + streetAddress: text('street_address'), + postalCode: text('postal_code'), + addressLocality: text('address_locality'), + addressCountry: text('address_country'), + firstName: text('first_name'), + lastName: text('last_name'), + phone: text('phone'), + email: text('email'), + website: text('website'), + offerings: jsonb('offerings'), +}) + +export const companyCategory = pgTable('companyCategory', { + id: text('id').unique().primaryKey(), + name: text('name').unique(), + description: text('description'), +}) + +export const profilesToCompanyCategories = pgTable('profilesToCompanyCategories', { + profileId: uuid('profile_id') + .references(() => profile.id) + .notNull(), + companyCategoryId: text('company_category_id') + .references(() => companyCategory.id) + .notNull(), +}) + +export const profilesToCompanyCategoriesRelations = relations(profilesToCompanyCategories, ({ one }) => ({ + companyCategory: one(companyCategory, { + fields: [profilesToCompanyCategories.companyCategoryId], + references: [companyCategory.id], + }), + profile: one(profile, { + fields: [profilesToCompanyCategories.profileId], + references: [profile.id], + }), +})) diff --git a/apps/envited.ascs.digital/common/database/seed.ts b/apps/envited.ascs.digital/common/database/seed.ts index 7c9274eb..2eb344fe 100644 --- a/apps/envited.ascs.digital/common/database/seed.ts +++ b/apps/envited.ascs.digital/common/database/seed.ts @@ -2,12 +2,16 @@ import { RDSDataClient } from '@aws-sdk/client-rds-data' import { fromIni } from '@aws-sdk/credential-providers' import { drizzle as RDSDrizzle } from 'drizzle-orm/aws-data-api/pg' +import { COMPANY_CATEGORIES } from './data/companyCategories' import { ROLES } from './data/roles' import { connectDb } from './database' -import { role } from './schema' +import { companyCategory, role } from './schema' import * as schema from './schema' -const insertRoles = (connection: any) => async (roles: any[]) => connection.insert(role).values(roles).execute() +const insertRoles = (connection: any) => async (roles: any[]) => + connection.insert(role).values(roles).onConflictDoNothing().execute() +const insertCompanyCategories = (connection: any) => async (companyCategories: any[]) => + connection.insert(companyCategory).values(companyCategories).onConflictDoNothing().execute() const seed = async () => { try { @@ -30,6 +34,7 @@ const seed = async () => { }) } await insertRoles(connection)(ROLES) + await insertCompanyCategories(connection)(COMPANY_CATEGORIES) return } catch (error) { console.error(error) diff --git a/apps/envited.ascs.digital/drizzle/development/0001_mysterious_kree.sql b/apps/envited.ascs.digital/drizzle/development/0001_mysterious_kree.sql new file mode 100644 index 00000000..bb20f7cc --- /dev/null +++ b/apps/envited.ascs.digital/drizzle/development/0001_mysterious_kree.sql @@ -0,0 +1,43 @@ +CREATE TABLE IF NOT EXISTS "companyCategory" ( + "id" text PRIMARY KEY NOT NULL, + "name" text, + "description" text, + CONSTRAINT "companyCategory_id_unique" UNIQUE("id"), + CONSTRAINT "companyCategory_name_unique" UNIQUE("name") +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "profile" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "name" text, + "description" text, + "logo" text, + "street_address" text, + "postal_code" text, + "address_locality" text, + "address_country" text, + "first_name" text, + "last_name" text, + "phone" text, + "email" text, + "website" text, + "offerings" jsonb, + CONSTRAINT "profile_name_unique" UNIQUE("name") +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "profilesToCompanyCategories" ( + "profile_id" uuid NOT NULL, + "company_category_id" text NOT NULL +); +--> statement-breakpoint +ALTER TABLE "user" RENAME COLUMN "address_location" TO "address_locality";--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "profilesToCompanyCategories" ADD CONSTRAINT "profilesToCompanyCategories_profile_id_profile_id_fk" FOREIGN KEY ("profile_id") REFERENCES "public"."profile"("id") ON DELETE no action ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "profilesToCompanyCategories" ADD CONSTRAINT "profilesToCompanyCategories_company_category_id_companyCategory_id_fk" FOREIGN KEY ("company_category_id") REFERENCES "public"."companyCategory"("id") ON DELETE no action ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; diff --git a/apps/envited.ascs.digital/drizzle/development/meta/0001_snapshot.json b/apps/envited.ascs.digital/drizzle/development/meta/0001_snapshot.json new file mode 100644 index 00000000..5bc8947f --- /dev/null +++ b/apps/envited.ascs.digital/drizzle/development/meta/0001_snapshot.json @@ -0,0 +1,619 @@ +{ + "id": "bf45c78e-c299-4435-bcb8-eaa63edd87fb", + "prevId": "8fbe3d01-c68f-48ae-9a7f-49222e392a4a", + "version": "5", + "dialect": "pg", + "tables": { + "addressType": { + "name": "addressType", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "addressType_name_unique": { + "name": "addressType_name_unique", + "nullsNotDistinct": false, + "columns": [ + "name" + ] + } + } + }, + "companyCategory": { + "name": "companyCategory", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "companyCategory_id_unique": { + "name": "companyCategory_id_unique", + "nullsNotDistinct": false, + "columns": [ + "id" + ] + }, + "companyCategory_name_unique": { + "name": "companyCategory_name_unique", + "nullsNotDistinct": false, + "columns": [ + "name" + ] + } + } + }, + "credentialType": { + "name": "credentialType", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "issuer": { + "name": "issuer", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "issuer_id_unique": { + "name": "issuer_id_unique", + "nullsNotDistinct": false, + "columns": [ + "id" + ] + } + } + }, + "profile": { + "name": "profile", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "logo": { + "name": "logo", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "street_address": { + "name": "street_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "postal_code": { + "name": "postal_code", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "address_locality": { + "name": "address_locality", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "address_country": { + "name": "address_country", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "first_name": { + "name": "first_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_name": { + "name": "last_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "offerings": { + "name": "offerings", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "profile_name_unique": { + "name": "profile_name_unique", + "nullsNotDistinct": false, + "columns": [ + "name" + ] + } + } + }, + "profilesToCompanyCategories": { + "name": "profilesToCompanyCategories", + "schema": "", + "columns": { + "profile_id": { + "name": "profile_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "company_category_id": { + "name": "company_category_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "profilesToCompanyCategories_profile_id_profile_id_fk": { + "name": "profilesToCompanyCategories_profile_id_profile_id_fk", + "tableFrom": "profilesToCompanyCategories", + "tableTo": "profile", + "schemaTo": "public", + "columnsFrom": [ + "profile_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "profilesToCompanyCategories_company_category_id_companyCategory_id_fk": { + "name": "profilesToCompanyCategories_company_category_id_companyCategory_id_fk", + "tableFrom": "profilesToCompanyCategories", + "tableTo": "companyCategory", + "schemaTo": "public", + "columnsFrom": [ + "company_category_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "role": { + "name": "role", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "role_id_unique": { + "name": "role_id_unique", + "nullsNotDistinct": false, + "columns": [ + "id" + ] + } + } + }, + "user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_ascs_member": { + "name": "is_ascs_member", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "is_envited_member": { + "name": "is_envited_member", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "street_address": { + "name": "street_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "postal_code": { + "name": "postal_code", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "address_locality": { + "name": "address_locality", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "address_country": { + "name": "address_country", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "vat_id": { + "name": "vat_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "privacy_policy_accepted": { + "name": "privacy_policy_accepted", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "articles_of_association_accepted": { + "name": "articles_of_association_accepted", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "contribution_rules_accepted": { + "name": "contribution_rules_accepted", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "issuer_id": { + "name": "issuer_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "address_type_id": { + "name": "address_type_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "issuance_date": { + "name": "issuance_date", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "expiration_date": { + "name": "expiration_date", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "user_issuer_id_issuer_id_fk": { + "name": "user_issuer_id_issuer_id_fk", + "tableFrom": "user", + "tableTo": "issuer", + "schemaTo": "public", + "columnsFrom": [ + "issuer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "user_address_type_id_addressType_id_fk": { + "name": "user_address_type_id_addressType_id_fk", + "tableFrom": "user", + "tableTo": "addressType", + "schemaTo": "public", + "columnsFrom": [ + "address_type_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_id_unique": { + "name": "user_id_unique", + "nullsNotDistinct": false, + "columns": [ + "id" + ] + } + } + }, + "usersToCredentialTypes": { + "name": "usersToCredentialTypes", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "credential_type_id": { + "name": "credential_type_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "usersToCredentialTypes_user_id_user_id_fk": { + "name": "usersToCredentialTypes_user_id_user_id_fk", + "tableFrom": "usersToCredentialTypes", + "tableTo": "user", + "schemaTo": "public", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "usersToCredentialTypes_credential_type_id_credentialType_id_fk": { + "name": "usersToCredentialTypes_credential_type_id_credentialType_id_fk", + "tableFrom": "usersToCredentialTypes", + "tableTo": "credentialType", + "schemaTo": "public", + "columnsFrom": [ + "credential_type_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "usersToRoles": { + "name": "usersToRoles", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "role_id": { + "name": "role_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "usersToRoles_user_id_user_id_fk": { + "name": "usersToRoles_user_id_user_id_fk", + "tableFrom": "usersToRoles", + "tableTo": "user", + "schemaTo": "public", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "usersToRoles_role_id_role_id_fk": { + "name": "usersToRoles_role_id_role_id_fk", + "tableFrom": "usersToRoles", + "tableTo": "role", + "schemaTo": "public", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + } + }, + "enums": {}, + "schemas": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/apps/envited.ascs.digital/drizzle/development/meta/_journal.json b/apps/envited.ascs.digital/drizzle/development/meta/_journal.json index d3cc0cad..d2ebe67d 100644 --- a/apps/envited.ascs.digital/drizzle/development/meta/_journal.json +++ b/apps/envited.ascs.digital/drizzle/development/meta/_journal.json @@ -8,6 +8,13 @@ "when": 1705574231633, "tag": "0000_fantastic_the_fury", "breakpoints": true + }, + { + "idx": 1, + "version": "5", + "when": 1706017410399, + "tag": "0001_mysterious_kree", + "breakpoints": true } ] } \ No newline at end of file diff --git a/apps/envited.ascs.digital/drizzle/staging/0001_rare_falcon.sql b/apps/envited.ascs.digital/drizzle/staging/0001_rare_falcon.sql new file mode 100644 index 00000000..bb20f7cc --- /dev/null +++ b/apps/envited.ascs.digital/drizzle/staging/0001_rare_falcon.sql @@ -0,0 +1,43 @@ +CREATE TABLE IF NOT EXISTS "companyCategory" ( + "id" text PRIMARY KEY NOT NULL, + "name" text, + "description" text, + CONSTRAINT "companyCategory_id_unique" UNIQUE("id"), + CONSTRAINT "companyCategory_name_unique" UNIQUE("name") +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "profile" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "name" text, + "description" text, + "logo" text, + "street_address" text, + "postal_code" text, + "address_locality" text, + "address_country" text, + "first_name" text, + "last_name" text, + "phone" text, + "email" text, + "website" text, + "offerings" jsonb, + CONSTRAINT "profile_name_unique" UNIQUE("name") +); +--> statement-breakpoint +CREATE TABLE IF NOT EXISTS "profilesToCompanyCategories" ( + "profile_id" uuid NOT NULL, + "company_category_id" text NOT NULL +); +--> statement-breakpoint +ALTER TABLE "user" RENAME COLUMN "address_location" TO "address_locality";--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "profilesToCompanyCategories" ADD CONSTRAINT "profilesToCompanyCategories_profile_id_profile_id_fk" FOREIGN KEY ("profile_id") REFERENCES "public"."profile"("id") ON DELETE no action ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "profilesToCompanyCategories" ADD CONSTRAINT "profilesToCompanyCategories_company_category_id_companyCategory_id_fk" FOREIGN KEY ("company_category_id") REFERENCES "public"."companyCategory"("id") ON DELETE no action ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; diff --git a/apps/envited.ascs.digital/drizzle/staging/meta/0001_snapshot.json b/apps/envited.ascs.digital/drizzle/staging/meta/0001_snapshot.json new file mode 100644 index 00000000..24416c1d --- /dev/null +++ b/apps/envited.ascs.digital/drizzle/staging/meta/0001_snapshot.json @@ -0,0 +1,619 @@ +{ + "id": "ad23ddb4-78f2-4194-8dce-cee58ae52b5c", + "prevId": "0f18334e-00d5-49b3-a2e4-c4f1e330f663", + "version": "5", + "dialect": "pg", + "tables": { + "addressType": { + "name": "addressType", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "addressType_name_unique": { + "name": "addressType_name_unique", + "nullsNotDistinct": false, + "columns": [ + "name" + ] + } + } + }, + "companyCategory": { + "name": "companyCategory", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "companyCategory_id_unique": { + "name": "companyCategory_id_unique", + "nullsNotDistinct": false, + "columns": [ + "id" + ] + }, + "companyCategory_name_unique": { + "name": "companyCategory_name_unique", + "nullsNotDistinct": false, + "columns": [ + "name" + ] + } + } + }, + "credentialType": { + "name": "credentialType", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "issuer": { + "name": "issuer", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "issuer_id_unique": { + "name": "issuer_id_unique", + "nullsNotDistinct": false, + "columns": [ + "id" + ] + } + } + }, + "profile": { + "name": "profile", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "logo": { + "name": "logo", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "street_address": { + "name": "street_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "postal_code": { + "name": "postal_code", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "address_locality": { + "name": "address_locality", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "address_country": { + "name": "address_country", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "first_name": { + "name": "first_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_name": { + "name": "last_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "website": { + "name": "website", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "offerings": { + "name": "offerings", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "profile_name_unique": { + "name": "profile_name_unique", + "nullsNotDistinct": false, + "columns": [ + "name" + ] + } + } + }, + "profilesToCompanyCategories": { + "name": "profilesToCompanyCategories", + "schema": "", + "columns": { + "profile_id": { + "name": "profile_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "company_category_id": { + "name": "company_category_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "profilesToCompanyCategories_profile_id_profile_id_fk": { + "name": "profilesToCompanyCategories_profile_id_profile_id_fk", + "tableFrom": "profilesToCompanyCategories", + "tableTo": "profile", + "schemaTo": "public", + "columnsFrom": [ + "profile_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "profilesToCompanyCategories_company_category_id_companyCategory_id_fk": { + "name": "profilesToCompanyCategories_company_category_id_companyCategory_id_fk", + "tableFrom": "profilesToCompanyCategories", + "tableTo": "companyCategory", + "schemaTo": "public", + "columnsFrom": [ + "company_category_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "role": { + "name": "role", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "role_id_unique": { + "name": "role_id_unique", + "nullsNotDistinct": false, + "columns": [ + "id" + ] + } + } + }, + "user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_ascs_member": { + "name": "is_ascs_member", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "is_envited_member": { + "name": "is_envited_member", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "street_address": { + "name": "street_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "postal_code": { + "name": "postal_code", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "address_locality": { + "name": "address_locality", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "address_country": { + "name": "address_country", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "vat_id": { + "name": "vat_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "privacy_policy_accepted": { + "name": "privacy_policy_accepted", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "articles_of_association_accepted": { + "name": "articles_of_association_accepted", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "contribution_rules_accepted": { + "name": "contribution_rules_accepted", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "issuer_id": { + "name": "issuer_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "address_type_id": { + "name": "address_type_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "issuance_date": { + "name": "issuance_date", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "expiration_date": { + "name": "expiration_date", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "user_issuer_id_issuer_id_fk": { + "name": "user_issuer_id_issuer_id_fk", + "tableFrom": "user", + "tableTo": "issuer", + "schemaTo": "public", + "columnsFrom": [ + "issuer_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "user_address_type_id_addressType_id_fk": { + "name": "user_address_type_id_addressType_id_fk", + "tableFrom": "user", + "tableTo": "addressType", + "schemaTo": "public", + "columnsFrom": [ + "address_type_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_id_unique": { + "name": "user_id_unique", + "nullsNotDistinct": false, + "columns": [ + "id" + ] + } + } + }, + "usersToCredentialTypes": { + "name": "usersToCredentialTypes", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "credential_type_id": { + "name": "credential_type_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "usersToCredentialTypes_user_id_user_id_fk": { + "name": "usersToCredentialTypes_user_id_user_id_fk", + "tableFrom": "usersToCredentialTypes", + "tableTo": "user", + "schemaTo": "public", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "usersToCredentialTypes_credential_type_id_credentialType_id_fk": { + "name": "usersToCredentialTypes_credential_type_id_credentialType_id_fk", + "tableFrom": "usersToCredentialTypes", + "tableTo": "credentialType", + "schemaTo": "public", + "columnsFrom": [ + "credential_type_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "usersToRoles": { + "name": "usersToRoles", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "role_id": { + "name": "role_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "usersToRoles_user_id_user_id_fk": { + "name": "usersToRoles_user_id_user_id_fk", + "tableFrom": "usersToRoles", + "tableTo": "user", + "schemaTo": "public", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "usersToRoles_role_id_role_id_fk": { + "name": "usersToRoles_role_id_role_id_fk", + "tableFrom": "usersToRoles", + "tableTo": "role", + "schemaTo": "public", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + } + }, + "enums": {}, + "schemas": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/apps/envited.ascs.digital/drizzle/staging/meta/_journal.json b/apps/envited.ascs.digital/drizzle/staging/meta/_journal.json index d10c5148..ae71d345 100644 --- a/apps/envited.ascs.digital/drizzle/staging/meta/_journal.json +++ b/apps/envited.ascs.digital/drizzle/staging/meta/_journal.json @@ -8,6 +8,13 @@ "when": 1705574199077, "tag": "0000_sour_brood", "breakpoints": true + }, + { + "idx": 1, + "version": "5", + "when": 1706021765110, + "tag": "0001_rare_falcon", + "breakpoints": true } ] } \ No newline at end of file