Skip to content

Commit

Permalink
feat(envited.ascs.digital): updated staging migrations
Browse files Browse the repository at this point in the history
Signed-off-by: Roy Scheeren <[email protected]>
  • Loading branch information
royscheeren committed Jan 25, 2024
1 parent 95d5933 commit 8395c0c
Show file tree
Hide file tree
Showing 5 changed files with 246 additions and 675 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ CREATE TABLE IF NOT EXISTS "addressType" (
CONSTRAINT "addressType_name_unique" UNIQUE("name")
);
--> statement-breakpoint
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 "credentialType" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"name" text,
Expand All @@ -19,6 +27,29 @@ CREATE TABLE IF NOT EXISTS "issuer" (
CONSTRAINT "issuer_id_unique" UNIQUE("id")
);
--> 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
CREATE TABLE IF NOT EXISTS "role" (
"id" text PRIMARY KEY NOT NULL,
"name" text,
Expand All @@ -34,7 +65,7 @@ CREATE TABLE IF NOT EXISTS "user" (
"is_envited_member" boolean,
"street_address" text,
"postal_code" text,
"address_location" text,
"address_locality" text,
"address_country" text,
"vat_id" text,
"privacy_policy_accepted" text,
Expand All @@ -59,6 +90,18 @@ CREATE TABLE IF NOT EXISTS "usersToRoles" (
"role_id" text NOT NULL
);
--> 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 $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "user" ADD CONSTRAINT "user_issuer_id_issuer_id_fk" FOREIGN KEY ("issuer_id") REFERENCES "public"."issuer"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
Expand Down
43 changes: 0 additions & 43 deletions apps/envited.ascs.digital/drizzle/staging/0001_rare_falcon.sql

This file was deleted.

203 changes: 200 additions & 3 deletions apps/envited.ascs.digital/drizzle/staging/meta/0000_snapshot.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id": "0f18334e-00d5-49b3-a2e4-c4f1e330f663",
"id": "beab304d-1e10-46f3-9c54-1aed13b28857",
"prevId": "00000000-0000-0000-0000-000000000000",
"version": "5",
"dialect": "pg",
Expand Down Expand Up @@ -41,6 +41,49 @@
}
}
},
"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": "",
Expand Down Expand Up @@ -112,6 +155,160 @@
}
}
},
"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": "",
Expand Down Expand Up @@ -194,8 +391,8 @@
"primaryKey": false,
"notNull": false
},
"address_location": {
"name": "address_location",
"address_locality": {
"name": "address_locality",
"type": "text",
"primaryKey": false,
"notNull": false
Expand Down
Loading

0 comments on commit 8395c0c

Please sign in to comment.