Skip to content

Commit

Permalink
feat: add db generate staging
Browse files Browse the repository at this point in the history
Signed-off-by: Jeroen Branje <[email protected]>
  • Loading branch information
jeroenbranje committed Jan 18, 2024
1 parent 8697ec5 commit de1bb7c
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 49 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id": "96c668c6-208a-4336-907b-bd99e7497d16",
"id": "8fbe3d01-c68f-48ae-9a7f-49222e392a4a",
"prevId": "00000000-0000-0000-0000-000000000000",
"version": "5",
"dialect": "pg",
Expand Down Expand Up @@ -35,7 +35,9 @@
"addressType_name_unique": {
"name": "addressType_name_unique",
"nullsNotDistinct": false,
"columns": ["name"]
"columns": [
"name"
]
}
}
},
Expand Down Expand Up @@ -104,7 +106,9 @@
"issuer_id_unique": {
"name": "issuer_id_unique",
"nullsNotDistinct": false,
"columns": ["id"]
"columns": [
"id"
]
}
}
},
Expand Down Expand Up @@ -138,7 +142,9 @@
"role_id_unique": {
"name": "role_id_unique",
"nullsNotDistinct": false,
"columns": ["id"]
"columns": [
"id"
]
}
}
},
Expand Down Expand Up @@ -268,8 +274,12 @@
"tableFrom": "user",
"tableTo": "issuer",
"schemaTo": "public",
"columnsFrom": ["issuer_id"],
"columnsTo": ["id"],
"columnsFrom": [
"issuer_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
Expand All @@ -278,8 +288,12 @@
"tableFrom": "user",
"tableTo": "addressType",
"schemaTo": "public",
"columnsFrom": ["address_type_id"],
"columnsTo": ["id"],
"columnsFrom": [
"address_type_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
Expand All @@ -289,7 +303,9 @@
"user_id_unique": {
"name": "user_id_unique",
"nullsNotDistinct": false,
"columns": ["id"]
"columns": [
"id"
]
}
}
},
Expand Down Expand Up @@ -317,8 +333,12 @@
"tableFrom": "usersToCredentialTypes",
"tableTo": "user",
"schemaTo": "public",
"columnsFrom": ["user_id"],
"columnsTo": ["id"],
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
Expand All @@ -327,8 +347,12 @@
"tableFrom": "usersToCredentialTypes",
"tableTo": "credentialType",
"schemaTo": "public",
"columnsFrom": ["credential_type_id"],
"columnsTo": ["id"],
"columnsFrom": [
"credential_type_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
Expand Down Expand Up @@ -360,8 +384,12 @@
"tableFrom": "usersToRoles",
"tableTo": "user",
"schemaTo": "public",
"columnsFrom": ["user_id"],
"columnsTo": ["id"],
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
Expand All @@ -370,8 +398,12 @@
"tableFrom": "usersToRoles",
"tableTo": "role",
"schemaTo": "public",
"columnsFrom": ["role_id"],
"columnsTo": ["id"],
"columnsFrom": [
"role_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
Expand All @@ -387,4 +419,4 @@
"schemas": {},
"tables": {}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
{
"idx": 0,
"version": "5",
"when": 1705324440754,
"tag": "0000_lean_the_stranger",
"when": 1705574231633,
"tag": "0000_fantastic_the_fury",
"breakpoints": true
}
]
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
CREATE TABLE IF NOT EXISTS "addressType" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"name" text,
"description" text
"description" text,
CONSTRAINT "addressType_name_unique" UNIQUE("name")
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "credentialType" (
Expand Down Expand Up @@ -59,37 +60,37 @@ CREATE TABLE IF NOT EXISTS "usersToRoles" (
);
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "user" ADD CONSTRAINT "user_issuer_id_issuer_id_fk" FOREIGN KEY ("issuer_id") REFERENCES "issuer"("id") ON DELETE no action ON UPDATE no action;
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
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "user" ADD CONSTRAINT "user_address_type_id_addressType_id_fk" FOREIGN KEY ("address_type_id") REFERENCES "addressType"("id") ON DELETE no action ON UPDATE no action;
ALTER TABLE "user" ADD CONSTRAINT "user_address_type_id_addressType_id_fk" FOREIGN KEY ("address_type_id") REFERENCES "public"."addressType"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "usersToCredentialTypes" ADD CONSTRAINT "usersToCredentialTypes_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE no action ON UPDATE no action;
ALTER TABLE "usersToCredentialTypes" ADD CONSTRAINT "usersToCredentialTypes_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "usersToCredentialTypes" ADD CONSTRAINT "usersToCredentialTypes_credential_type_id_credentialType_id_fk" FOREIGN KEY ("credential_type_id") REFERENCES "credentialType"("id") ON DELETE no action ON UPDATE no action;
ALTER TABLE "usersToCredentialTypes" ADD CONSTRAINT "usersToCredentialTypes_credential_type_id_credentialType_id_fk" FOREIGN KEY ("credential_type_id") REFERENCES "public"."credentialType"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "usersToRoles" ADD CONSTRAINT "usersToRoles_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "user"("id") ON DELETE no action ON UPDATE no action;
ALTER TABLE "usersToRoles" ADD CONSTRAINT "usersToRoles_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "usersToRoles" ADD CONSTRAINT "usersToRoles_role_id_role_id_fk" FOREIGN KEY ("role_id") REFERENCES "role"("id") ON DELETE no action ON UPDATE no action;
ALTER TABLE "usersToRoles" ADD CONSTRAINT "usersToRoles_role_id_role_id_fk" FOREIGN KEY ("role_id") REFERENCES "public"."role"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
80 changes: 62 additions & 18 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": "9a29c149-759a-4275-b107-d83917a4a9ab",
"id": "0f18334e-00d5-49b3-a2e4-c4f1e330f663",
"prevId": "00000000-0000-0000-0000-000000000000",
"version": "5",
"dialect": "pg",
Expand Down Expand Up @@ -31,7 +31,15 @@
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
"uniqueConstraints": {
"addressType_name_unique": {
"name": "addressType_name_unique",
"nullsNotDistinct": false,
"columns": [
"name"
]
}
}
},
"credentialType": {
"name": "credentialType",
Expand Down Expand Up @@ -98,7 +106,9 @@
"issuer_id_unique": {
"name": "issuer_id_unique",
"nullsNotDistinct": false,
"columns": ["id"]
"columns": [
"id"
]
}
}
},
Expand Down Expand Up @@ -132,7 +142,9 @@
"role_id_unique": {
"name": "role_id_unique",
"nullsNotDistinct": false,
"columns": ["id"]
"columns": [
"id"
]
}
}
},
Expand Down Expand Up @@ -261,17 +273,27 @@
"name": "user_issuer_id_issuer_id_fk",
"tableFrom": "user",
"tableTo": "issuer",
"columnsFrom": ["issuer_id"],
"columnsTo": ["id"],
"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",
"columnsFrom": ["address_type_id"],
"columnsTo": ["id"],
"schemaTo": "public",
"columnsFrom": [
"address_type_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
Expand All @@ -281,7 +303,9 @@
"user_id_unique": {
"name": "user_id_unique",
"nullsNotDistinct": false,
"columns": ["id"]
"columns": [
"id"
]
}
}
},
Expand All @@ -308,17 +332,27 @@
"name": "usersToCredentialTypes_user_id_user_id_fk",
"tableFrom": "usersToCredentialTypes",
"tableTo": "user",
"columnsFrom": ["user_id"],
"columnsTo": ["id"],
"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",
"columnsFrom": ["credential_type_id"],
"columnsTo": ["id"],
"schemaTo": "public",
"columnsFrom": [
"credential_type_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
Expand Down Expand Up @@ -349,17 +383,27 @@
"name": "usersToRoles_user_id_user_id_fk",
"tableFrom": "usersToRoles",
"tableTo": "user",
"columnsFrom": ["user_id"],
"columnsTo": ["id"],
"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",
"columnsFrom": ["role_id"],
"columnsTo": ["id"],
"schemaTo": "public",
"columnsFrom": [
"role_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
Expand All @@ -375,4 +419,4 @@
"schemas": {},
"tables": {}
}
}
}
6 changes: 3 additions & 3 deletions apps/envited.ascs.digital/drizzle/staging/meta/_journal.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
{
"idx": 0,
"version": "5",
"when": 1704723156913,
"tag": "0000_nostalgic_mauler",
"when": 1705574199077,
"tag": "0000_sour_brood",
"breakpoints": true
}
]
}
}

0 comments on commit de1bb7c

Please sign in to comment.