diff --git a/apps/api/src/changelog/version/delete.ts b/apps/api/src/changelog/version/delete.ts index 0569d99..73d1850 100644 --- a/apps/api/src/changelog/version/delete.ts +++ b/apps/api/src/changelog/version/delete.ts @@ -1,4 +1,9 @@ -import { changelog, changelog_version, db } from '@boring.tools/database' +import { + changelog, + changelog_commit, + changelog_version, + db, +} from '@boring.tools/database' import { GeneralOutput } from '@boring.tools/schema' import { createRoute } from '@hono/zod-openapi' import { and, eq } from 'drizzle-orm' @@ -57,6 +62,11 @@ export const removeFunc = async ({ }) } + await db + .update(changelog_commit) + .set({ versionId: null }) + .where(eq(changelog_commit.versionId, id)) + return db .delete(changelog_version) .where(and(eq(changelog_version.id, id))) diff --git a/packages/database/src/migrations/0004_parallel_epoch.sql b/packages/database/src/migrations/0004_parallel_epoch.sql new file mode 100644 index 0000000..17f2161 --- /dev/null +++ b/packages/database/src/migrations/0004_parallel_epoch.sql @@ -0,0 +1,7 @@ +ALTER TABLE "changelog_commit" DROP CONSTRAINT "changelog_commit_versionId_changelog_version_id_fk"; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "changelog_commit" ADD CONSTRAINT "changelog_commit_versionId_changelog_version_id_fk" FOREIGN KEY ("versionId") REFERENCES "public"."changelog_version"("id") ON DELETE no action ON UPDATE no action; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; diff --git a/packages/database/src/migrations/0005_brief_polaris.sql b/packages/database/src/migrations/0005_brief_polaris.sql new file mode 100644 index 0000000..4e12af6 --- /dev/null +++ b/packages/database/src/migrations/0005_brief_polaris.sql @@ -0,0 +1,7 @@ +ALTER TABLE "changelog_commit" DROP CONSTRAINT "changelog_commit_versionId_changelog_version_id_fk"; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "changelog_commit" ADD CONSTRAINT "changelog_commit_versionId_changelog_version_id_fk" FOREIGN KEY ("versionId") REFERENCES "public"."changelog_version"("id") ON DELETE no action ON UPDATE set null; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; diff --git a/packages/database/src/migrations/meta/0004_snapshot.json b/packages/database/src/migrations/meta/0004_snapshot.json new file mode 100644 index 0000000..1f35657 --- /dev/null +++ b/packages/database/src/migrations/meta/0004_snapshot.json @@ -0,0 +1,521 @@ +{ + "id": "81b27d12-4e13-4495-a364-6487b3033e0c", + "prevId": "8c9df2bd-6fd4-4361-aecc-db781cfb7f9c", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.access_token": { + "name": "access_token", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "userId": { + "name": "userId", + "type": "varchar(32)", + "primaryKey": false, + "notNull": false + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "lastUsedOn": { + "name": "lastUsedOn", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "access_token_userId_user_id_fk": { + "name": "access_token_userId_user_id_fk", + "tableFrom": "access_token", + "tableTo": "user", + "columnsFrom": [ + "userId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.changelog": { + "name": "changelog", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updatedAt": { + "name": "updatedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "userId": { + "name": "userId", + "type": "varchar(32)", + "primaryKey": false, + "notNull": false + }, + "pageId": { + "name": "pageId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(256)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "isSemver": { + "name": "isSemver", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + } + }, + "indexes": {}, + "foreignKeys": { + "changelog_userId_user_id_fk": { + "name": "changelog_userId_user_id_fk", + "tableFrom": "changelog", + "tableTo": "user", + "columnsFrom": [ + "userId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "changelog_pageId_page_id_fk": { + "name": "changelog_pageId_page_id_fk", + "tableFrom": "changelog", + "tableTo": "page", + "columnsFrom": [ + "pageId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.changelog_commit": { + "name": "changelog_commit", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "changelogId": { + "name": "changelogId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "versionId": { + "name": "versionId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "commit": { + "name": "commit", + "type": "varchar(8)", + "primaryKey": false, + "notNull": true + }, + "parent": { + "name": "parent", + "type": "varchar(8)", + "primaryKey": false, + "notNull": false + }, + "subject": { + "name": "subject", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "author": { + "name": "author", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "comitter": { + "name": "comitter", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "body": { + "name": "body", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "unique": { + "name": "unique", + "columns": [ + { + "expression": "changelogId", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "commit", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "changelog_commit_changelogId_changelog_id_fk": { + "name": "changelog_commit_changelogId_changelog_id_fk", + "tableFrom": "changelog_commit", + "tableTo": "changelog", + "columnsFrom": [ + "changelogId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "changelog_commit_versionId_changelog_version_id_fk": { + "name": "changelog_commit_versionId_changelog_version_id_fk", + "tableFrom": "changelog_commit", + "tableTo": "changelog_version", + "columnsFrom": [ + "versionId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.changelog_version": { + "name": "changelog_version", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updatedAt": { + "name": "updatedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "releasedAt": { + "name": "releasedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "changelogId": { + "name": "changelogId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "version": { + "name": "version", + "type": "varchar(32)", + "primaryKey": false, + "notNull": true + }, + "markdown": { + "name": "markdown", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'draft'" + } + }, + "indexes": {}, + "foreignKeys": { + "changelog_version_changelogId_changelog_id_fk": { + "name": "changelog_version_changelogId_changelog_id_fk", + "tableFrom": "changelog_version", + "tableTo": "changelog", + "columnsFrom": [ + "changelogId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.changelogs_to_pages": { + "name": "changelogs_to_pages", + "schema": "", + "columns": { + "changelogId": { + "name": "changelogId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "pageId": { + "name": "pageId", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "changelogs_to_pages_changelogId_changelog_id_fk": { + "name": "changelogs_to_pages_changelogId_changelog_id_fk", + "tableFrom": "changelogs_to_pages", + "tableTo": "changelog", + "columnsFrom": [ + "changelogId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "changelogs_to_pages_pageId_page_id_fk": { + "name": "changelogs_to_pages_pageId_page_id_fk", + "tableFrom": "changelogs_to_pages", + "tableTo": "page", + "columnsFrom": [ + "pageId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "changelogs_to_pages_changelogId_pageId_pk": { + "name": "changelogs_to_pages_changelogId_pageId_pk", + "columns": [ + "changelogId", + "pageId" + ] + } + }, + "uniqueConstraints": {} + }, + "public.page": { + "name": "page", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "userId": { + "name": "userId", + "type": "varchar(32)", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "icon": { + "name": "icon", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "''" + } + }, + "indexes": {}, + "foreignKeys": { + "page_userId_user_id_fk": { + "name": "page_userId_user_id_fk", + "tableFrom": "page", + "tableTo": "user", + "columnsFrom": [ + "userId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar(32)", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_email_unique": { + "name": "user_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + } + } + }, + "enums": { + "public.status": { + "name": "status", + "schema": "public", + "values": [ + "draft", + "review", + "published" + ] + } + }, + "schemas": {}, + "sequences": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/packages/database/src/migrations/meta/0005_snapshot.json b/packages/database/src/migrations/meta/0005_snapshot.json new file mode 100644 index 0000000..770f1f7 --- /dev/null +++ b/packages/database/src/migrations/meta/0005_snapshot.json @@ -0,0 +1,521 @@ +{ + "id": "39fd75cc-7a80-4e4b-817f-394bbf086262", + "prevId": "81b27d12-4e13-4495-a364-6487b3033e0c", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.access_token": { + "name": "access_token", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "userId": { + "name": "userId", + "type": "varchar(32)", + "primaryKey": false, + "notNull": false + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "lastUsedOn": { + "name": "lastUsedOn", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "access_token_userId_user_id_fk": { + "name": "access_token_userId_user_id_fk", + "tableFrom": "access_token", + "tableTo": "user", + "columnsFrom": [ + "userId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.changelog": { + "name": "changelog", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updatedAt": { + "name": "updatedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "userId": { + "name": "userId", + "type": "varchar(32)", + "primaryKey": false, + "notNull": false + }, + "pageId": { + "name": "pageId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "varchar(256)", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "isSemver": { + "name": "isSemver", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + } + }, + "indexes": {}, + "foreignKeys": { + "changelog_userId_user_id_fk": { + "name": "changelog_userId_user_id_fk", + "tableFrom": "changelog", + "tableTo": "user", + "columnsFrom": [ + "userId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "changelog_pageId_page_id_fk": { + "name": "changelog_pageId_page_id_fk", + "tableFrom": "changelog", + "tableTo": "page", + "columnsFrom": [ + "pageId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.changelog_commit": { + "name": "changelog_commit", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "changelogId": { + "name": "changelogId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "versionId": { + "name": "versionId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "commit": { + "name": "commit", + "type": "varchar(8)", + "primaryKey": false, + "notNull": true + }, + "parent": { + "name": "parent", + "type": "varchar(8)", + "primaryKey": false, + "notNull": false + }, + "subject": { + "name": "subject", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "author": { + "name": "author", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "comitter": { + "name": "comitter", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "body": { + "name": "body", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "unique": { + "name": "unique", + "columns": [ + { + "expression": "changelogId", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "commit", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "changelog_commit_changelogId_changelog_id_fk": { + "name": "changelog_commit_changelogId_changelog_id_fk", + "tableFrom": "changelog_commit", + "tableTo": "changelog", + "columnsFrom": [ + "changelogId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "changelog_commit_versionId_changelog_version_id_fk": { + "name": "changelog_commit_versionId_changelog_version_id_fk", + "tableFrom": "changelog_commit", + "tableTo": "changelog_version", + "columnsFrom": [ + "versionId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "set null" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.changelog_version": { + "name": "changelog_version", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updatedAt": { + "name": "updatedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "releasedAt": { + "name": "releasedAt", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "changelogId": { + "name": "changelogId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "version": { + "name": "version", + "type": "varchar(32)", + "primaryKey": false, + "notNull": true + }, + "markdown": { + "name": "markdown", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "status", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'draft'" + } + }, + "indexes": {}, + "foreignKeys": { + "changelog_version_changelogId_changelog_id_fk": { + "name": "changelog_version_changelogId_changelog_id_fk", + "tableFrom": "changelog_version", + "tableTo": "changelog", + "columnsFrom": [ + "changelogId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.changelogs_to_pages": { + "name": "changelogs_to_pages", + "schema": "", + "columns": { + "changelogId": { + "name": "changelogId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "pageId": { + "name": "pageId", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "changelogs_to_pages_changelogId_changelog_id_fk": { + "name": "changelogs_to_pages_changelogId_changelog_id_fk", + "tableFrom": "changelogs_to_pages", + "tableTo": "changelog", + "columnsFrom": [ + "changelogId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "changelogs_to_pages_pageId_page_id_fk": { + "name": "changelogs_to_pages_pageId_page_id_fk", + "tableFrom": "changelogs_to_pages", + "tableTo": "page", + "columnsFrom": [ + "pageId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "changelogs_to_pages_changelogId_pageId_pk": { + "name": "changelogs_to_pages_changelogId_pageId_pk", + "columns": [ + "changelogId", + "pageId" + ] + } + }, + "uniqueConstraints": {} + }, + "public.page": { + "name": "page", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "userId": { + "name": "userId", + "type": "varchar(32)", + "primaryKey": false, + "notNull": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "icon": { + "name": "icon", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "''" + } + }, + "indexes": {}, + "foreignKeys": { + "page_userId_user_id_fk": { + "name": "page_userId_user_id_fk", + "tableFrom": "page", + "tableTo": "user", + "columnsFrom": [ + "userId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "public.user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "varchar(32)", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_email_unique": { + "name": "user_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + } + } + } + }, + "enums": { + "public.status": { + "name": "status", + "schema": "public", + "values": [ + "draft", + "review", + "published" + ] + } + }, + "schemas": {}, + "sequences": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/packages/database/src/migrations/meta/_journal.json b/packages/database/src/migrations/meta/_journal.json index b010f55..18ec30c 100644 --- a/packages/database/src/migrations/meta/_journal.json +++ b/packages/database/src/migrations/meta/_journal.json @@ -29,6 +29,20 @@ "when": 1730403108797, "tag": "0003_messy_big_bertha", "breakpoints": true + }, + { + "idx": 4, + "version": "7", + "when": 1730405808764, + "tag": "0004_parallel_epoch", + "breakpoints": true + }, + { + "idx": 5, + "version": "7", + "when": 1730406390071, + "tag": "0005_brief_polaris", + "breakpoints": true } ] } \ No newline at end of file diff --git a/packages/database/src/schema/changelog.ts b/packages/database/src/schema/changelog.ts index 573eae8..832ba46 100644 --- a/packages/database/src/schema/changelog.ts +++ b/packages/database/src/schema/changelog.ts @@ -102,7 +102,7 @@ export const changelog_commit = pgTable( onDelete: 'cascade', }), versionId: uuid('versionId').references(() => changelog_version.id, { - onDelete: 'cascade', + onUpdate: 'set null', }), commit: varchar('commit', { length: 8 }).notNull(),