feat: refactor user id to own id and save clerk id as providerId

This commit is contained in:
Lars Hampe 2024-11-04 23:29:00 +01:00
parent a8392312c1
commit a7ee7bf981
37 changed files with 475 additions and 3280 deletions

@ -35,7 +35,7 @@ export const route = createRoute({
export const registerAccessTokenCreate = (api: typeof accessTokenApi) => {
return api.openapi(route, async (c) => {
const userId = verifyAuthentication(c)
const userId = await verifyAuthentication(c)
const data: z.infer<typeof AccessTokenCreateInput> = await c.req.json()
const token = crypto.randomBytes(20).toString('hex')

@ -29,7 +29,7 @@ export const route = createRoute({
export const registerAccessTokenDelete = (api: typeof accessTokenApi) => {
return api.openapi(route, async (c) => {
const id = c.req.param('id')
const userId = verifyAuthentication(c)
const userId = await verifyAuthentication(c)
const result = await db
.delete(access_token)

@ -30,7 +30,7 @@ const route = createRoute({
export const registerAccessTokenList = (api: typeof accessTokenApi) => {
return api.openapi(route, async (c) => {
const userId = verifyAuthentication(c)
const userId = await verifyAuthentication(c)
const result = await db.query.access_token.findMany({
where: eq(changelog.userId, userId),
})

@ -35,7 +35,7 @@ export const route = createRoute({
export const registerCommitCreate = (api: typeof changelogCommitApi) => {
return api.openapi(route, async (c) => {
const userId = verifyAuthentication(c)
const userId = await verifyAuthentication(c)
const data: z.infer<typeof CommitCreateInput> = await c.req.json()
const changelogResult = await db.query.changelog.findFirst({

@ -34,7 +34,7 @@ const route = createRoute({
export const registerCommitList = (api: typeof changelogCommitApi) => {
return api.openapi(route, async (c) => {
const userId = verifyAuthentication(c)
const userId = await verifyAuthentication(c)
const { changelogId, limit, offset, hasVersion } = c.req.valid('query')
const result = await db.query.changelog.findFirst({
where: and(eq(changelog.userId, userId), eq(changelog.id, changelogId)),

@ -18,7 +18,7 @@ const module: ContextModule = {
app.route('/commit', changelogCommitApi)
app.route('/version', version)
app.openapi(ById.route, async (c) => {
const userId = verifyAuthentication(c)
const userId = await verifyAuthentication(c)
try {
const id = c.req.param('id')
const result = await ById.func({ userId, id })
@ -36,7 +36,7 @@ app.openapi(ById.route, async (c) => {
})
app.openapi(List.route, async (c) => {
const userId = verifyAuthentication(c)
const userId = await verifyAuthentication(c)
try {
const result = await List.func({ userId })
return c.json(result, 200)
@ -53,7 +53,7 @@ app.openapi(List.route, async (c) => {
})
app.openapi(Create.route, async (c) => {
const userId = verifyAuthentication(c)
const userId = await verifyAuthentication(c)
try {
const [result] = await Create.func({
@ -74,7 +74,7 @@ app.openapi(Create.route, async (c) => {
})
app.openapi(Delete.route, async (c) => {
const userId = verifyAuthentication(c)
const userId = await verifyAuthentication(c)
try {
const id = c.req.param('id')
@ -98,7 +98,7 @@ app.openapi(Delete.route, async (c) => {
})
app.openapi(Update.route, async (c) => {
const userId = verifyAuthentication(c)
const userId = await verifyAuthentication(c)
try {
const id = c.req.param('id')

@ -76,7 +76,7 @@ const getNextVersion = ({
export const registerVersionCreateAuto = (api: typeof changelogVersionApi) => {
return api.openapi(route, async (c) => {
const userId = verifyAuthentication(c)
const userId = await verifyAuthentication(c)
const data: z.infer<typeof VersionCreateAutoInput> = await c.req.json()
const changelogResult = await db.query.changelog.findFirst({
where: and(

@ -18,7 +18,7 @@ const module: ContextModule = {
registerVersionCreateAuto(changelogVersionApi)
changelogVersionApi.openapi(create, async (c) => {
const userId = verifyAuthentication(c)
const userId = await verifyAuthentication(c)
try {
const payload = await c.req.json()
const result = await createFunc({ userId, payload })
@ -41,7 +41,7 @@ changelogVersionApi.openapi(create, async (c) => {
})
changelogVersionApi.openapi(byId, async (c) => {
const userId = verifyAuthentication(c)
const userId = await verifyAuthentication(c)
try {
const id = c.req.param('id')
const result = await byIdFunc({ userId, id })
@ -76,7 +76,7 @@ changelogVersionApi.openapi(byId, async (c) => {
})
changelogVersionApi.openapi(update, async (c) => {
const userId = verifyAuthentication(c)
const userId = await verifyAuthentication(c)
try {
const id = c.req.param('id')
@ -104,7 +104,7 @@ changelogVersionApi.openapi(update, async (c) => {
})
changelogVersionApi.openapi(remove, async (c) => {
const userId = verifyAuthentication(c)
const userId = await verifyAuthentication(c)
try {
const id = c.req.param('id')
const result = await removeFunc({ userId, id })

@ -35,7 +35,7 @@ const route = createRoute({
export const registerPageById = (api: typeof pageApi) => {
return api.openapi(route, async (c) => {
const userId = verifyAuthentication(c)
const userId = await verifyAuthentication(c)
const { id } = c.req.valid('param')
const result = await db.query.page.findFirst({

@ -38,7 +38,7 @@ const route = createRoute({
export const registerPageCreate = (api: typeof pageApi) => {
return api.openapi(route, async (c) => {
const userId = verifyAuthentication(c)
const userId = await verifyAuthentication(c)
const { changelogIds, ...rest }: z.infer<typeof PageCreateInput> =
await c.req.json()

@ -34,7 +34,7 @@ const route = createRoute({
export const registerPageDelete = (api: typeof pageApi) => {
return api.openapi(route, async (c) => {
const userId = verifyAuthentication(c)
const userId = await verifyAuthentication(c)
const { id } = c.req.valid('param')
const result = await db
.delete(page)

@ -32,7 +32,7 @@ const route = createRoute({
export const registerPageList = (api: typeof pageApi) => {
return api.openapi(route, async (c) => {
const userId = verifyAuthentication(c)
const userId = await verifyAuthentication(c)
const result = await db.query.page.findMany({
where: and(eq(page.userId, userId)),

@ -44,7 +44,7 @@ const route = createRoute({
export const registerPageUpdate = (api: typeof pageApi) => {
return api.openapi(route, async (c) => {
const userId = verifyAuthentication(c)
const userId = await verifyAuthentication(c)
const { id } = c.req.valid('param')
const { changelogIds, ...rest }: z.infer<typeof PageUpdateInput> =

@ -27,7 +27,7 @@ const route = createRoute({
export const registerStatisticGet = (api: typeof statisticApi) => {
return api.openapi(route, async (c) => {
const userId = verifyAuthentication(c)
const userId = await verifyAuthentication(c)
const pageResult = await db.query.page.findMany({
where: eq(page.userId, userId),
})

@ -39,7 +39,7 @@ const userCreate = async ({
payload: z.infer<typeof UserWebhookInput>
}) => {
const data = {
id: payload.data.id,
providerId: payload.data.id,
name: `${payload.data.first_name} ${payload.data.last_name}`,
email: payload.data.email_addresses[0].email_address,
}
@ -50,7 +50,7 @@ const userCreate = async ({
...data,
})
.onConflictDoUpdate({
target: user.id,
target: user.providerId,
set: data,
})

@ -1,4 +1,4 @@
import { access_token, db } from '@boring.tools/database'
import { access_token, db, user } from '@boring.tools/database'
import { clerkMiddleware, getAuth } from '@hono/clerk-auth'
import { eq } from 'drizzle-orm'
import type { Context, Next } from 'hono'
@ -36,7 +36,7 @@ const generatedToken = async (c: Context, next: Next) => {
export const authentication = some(generatedToken, clerkMiddleware())
export const verifyAuthentication = (c: Context) => {
export const verifyAuthentication = async (c: Context) => {
const auth = getAuth(c)
if (!auth?.userId) {
const accessTokenUser = c.get('user')
@ -45,5 +45,15 @@ export const verifyAuthentication = (c: Context) => {
}
return accessTokenUser.id
}
return auth.userId
const [userEntry] = await db
.select()
.from(user)
.where(eq(user.providerId, auth.userId))
if (!userEntry) {
throw new HTTPException(401, { message: 'Unauthorized' })
}
// console.log(userEntry)
return userEntry.id
}

@ -1,86 +0,0 @@
DO $$ BEGIN
CREATE TYPE "public"."status" AS ENUM('draft', 'review', 'published');
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "user" (
"id" varchar(32) PRIMARY KEY NOT NULL,
"name" text,
"email" text NOT NULL,
CONSTRAINT "user_email_unique" UNIQUE("email")
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "access_token" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"userId" varchar(32),
"token" text NOT NULL,
"name" text NOT NULL,
"createdAt" timestamp DEFAULT now() NOT NULL,
"lastUsedOn" timestamp
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "changelog" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"createdAt" timestamp DEFAULT now(),
"updatedAt" timestamp,
"userId" varchar(32),
"title" varchar(256),
"description" text,
"isSemver" boolean DEFAULT true
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "changelog_commit" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"createdAt" timestamp,
"changelogId" uuid,
"versionId" uuid,
"shortHash" varchar(8) NOT NULL,
"author" json,
"body" text,
"message" text NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "changelog_version" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"createdAt" timestamp DEFAULT now(),
"updatedAt" timestamp,
"releasedAt" timestamp,
"changelogId" uuid NOT NULL,
"version" varchar(32) NOT NULL,
"markdown" text NOT NULL,
"status" "status" DEFAULT 'draft' NOT NULL,
"shortHash" varchar(8) NOT NULL
);
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "access_token" ADD CONSTRAINT "access_token_userId_user_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "changelog" ADD CONSTRAINT "changelog_userId_user_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "changelog_commit" ADD CONSTRAINT "changelog_commit_changelogId_changelog_id_fk" FOREIGN KEY ("changelogId") REFERENCES "public"."changelog"("id") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> 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 cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "changelog_version" ADD CONSTRAINT "changelog_version_changelogId_changelog_id_fk" FOREIGN KEY ("changelogId") REFERENCES "public"."changelog"("id") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
CREATE UNIQUE INDEX IF NOT EXISTS "unique" ON "changelog_commit" USING btree ("changelogId","shortHash");

@ -0,0 +1,130 @@
CREATE TYPE "public"."status" AS ENUM('draft', 'review', 'published');--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "access_token" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"createdAt" timestamp with time zone DEFAULT now() NOT NULL,
"updatedAt" timestamp with time zone,
"userId" uuid,
"token" text NOT NULL,
"name" text NOT NULL,
"lastUsedOn" timestamp
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "changelog" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"createdAt" timestamp with time zone DEFAULT now() NOT NULL,
"updatedAt" timestamp with time zone,
"userId" uuid,
"pageId" uuid,
"title" varchar(256),
"description" text,
"isSemver" boolean DEFAULT true,
"isConventional" boolean DEFAULT true
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "changelog_commit" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"createdAt" timestamp with time zone DEFAULT now() NOT NULL,
"updatedAt" timestamp with time zone,
"changelogId" uuid,
"versionId" uuid,
"commit" varchar(8) NOT NULL,
"parent" varchar(8),
"subject" text NOT NULL,
"author" json,
"commiter" json,
"body" text
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "changelog_version" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"createdAt" timestamp with time zone DEFAULT now() NOT NULL,
"updatedAt" timestamp with time zone,
"releasedAt" timestamp,
"changelogId" uuid NOT NULL,
"version" varchar(32) NOT NULL,
"markdown" text NOT NULL,
"status" "status" DEFAULT 'draft' NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "changelogs_to_pages" (
"changelogId" uuid NOT NULL,
"pageId" uuid NOT NULL,
CONSTRAINT "changelogs_to_pages_changelogId_pageId_pk" PRIMARY KEY("changelogId","pageId")
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "page" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"createdAt" timestamp with time zone DEFAULT now() NOT NULL,
"updatedAt" timestamp with time zone,
"userId" uuid,
"title" text NOT NULL,
"description" text NOT NULL,
"icon" text DEFAULT ''
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "user" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"createdAt" timestamp with time zone DEFAULT now() NOT NULL,
"updatedAt" timestamp with time zone,
"providerId" varchar(32) NOT NULL,
"name" text,
"email" text NOT NULL,
CONSTRAINT "user_providerId_unique" UNIQUE("providerId"),
CONSTRAINT "user_email_unique" UNIQUE("email")
);
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "access_token" ADD CONSTRAINT "access_token_userId_user_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "changelog" ADD CONSTRAINT "changelog_userId_user_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "changelog" ADD CONSTRAINT "changelog_pageId_page_id_fk" FOREIGN KEY ("pageId") REFERENCES "public"."page"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "changelog_commit" ADD CONSTRAINT "changelog_commit_changelogId_changelog_id_fk" FOREIGN KEY ("changelogId") REFERENCES "public"."changelog"("id") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> 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 $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "changelog_version" ADD CONSTRAINT "changelog_version_changelogId_changelog_id_fk" FOREIGN KEY ("changelogId") REFERENCES "public"."changelog"("id") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "changelogs_to_pages" ADD CONSTRAINT "changelogs_to_pages_changelogId_changelog_id_fk" FOREIGN KEY ("changelogId") REFERENCES "public"."changelog"("id") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "changelogs_to_pages" ADD CONSTRAINT "changelogs_to_pages_pageId_page_id_fk" FOREIGN KEY ("pageId") REFERENCES "public"."page"("id") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "page" ADD CONSTRAINT "page_userId_user_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
CREATE UNIQUE INDEX IF NOT EXISTS "unique" ON "changelog_commit" USING btree ("changelogId","commit");

@ -1 +0,0 @@
ALTER TABLE "changelog_version" DROP COLUMN IF EXISTS "shortHash";

@ -1,38 +0,0 @@
CREATE TABLE IF NOT EXISTS "changelogs_to_pages" (
"changelogId" uuid NOT NULL,
"pageId" uuid NOT NULL,
CONSTRAINT "changelogs_to_pages_changelogId_pageId_pk" PRIMARY KEY("changelogId","pageId")
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "page" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"userId" varchar(32),
"title" text NOT NULL,
"description" text NOT NULL,
"icon" text DEFAULT ''
);
--> statement-breakpoint
ALTER TABLE "changelog" ADD COLUMN "pageId" uuid;--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "changelogs_to_pages" ADD CONSTRAINT "changelogs_to_pages_changelogId_changelog_id_fk" FOREIGN KEY ("changelogId") REFERENCES "public"."changelog"("id") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "changelogs_to_pages" ADD CONSTRAINT "changelogs_to_pages_pageId_page_id_fk" FOREIGN KEY ("pageId") REFERENCES "public"."page"("id") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "page" ADD CONSTRAINT "page_userId_user_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "changelog" ADD CONSTRAINT "changelog_pageId_page_id_fk" FOREIGN KEY ("pageId") REFERENCES "public"."page"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;

@ -1,8 +0,0 @@
ALTER TABLE "changelog_commit" RENAME COLUMN "shortHash" TO "commit";--> statement-breakpoint
ALTER TABLE "changelog_commit" RENAME COLUMN "message" TO "parent";--> statement-breakpoint
DROP INDEX IF EXISTS "unique";--> statement-breakpoint
ALTER TABLE "changelog_commit" ALTER COLUMN "parent" SET DATA TYPE varchar(8);--> statement-breakpoint
ALTER TABLE "changelog_commit" ALTER COLUMN "parent" DROP NOT NULL;--> statement-breakpoint
ALTER TABLE "changelog_commit" ADD COLUMN "subject" text NOT NULL;--> statement-breakpoint
ALTER TABLE "changelog_commit" ADD COLUMN "comitter" json;--> statement-breakpoint
CREATE UNIQUE INDEX IF NOT EXISTS "unique" ON "changelog_commit" USING btree ("changelogId","commit");

@ -1,7 +0,0 @@
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 $$;

@ -1,7 +0,0 @@
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 $$;

@ -1 +0,0 @@
ALTER TABLE "changelog" ADD COLUMN "isConventional" boolean DEFAULT true;

@ -1,45 +1,9 @@
{
"id": "33a139be-9cb3-4dfd-a14c-c196e17b053d",
"id": "e49ebf64-703c-4248-8828-12c78337fbd2",
"prevId": "00000000-0000-0000-0000-000000000000",
"version": "7",
"dialect": "postgresql",
"tables": {
"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"
]
}
}
},
"public.access_token": {
"name": "access_token",
"schema": "",
@ -51,9 +15,22 @@
"notNull": true,
"default": "gen_random_uuid()"
},
"createdAt": {
"name": "createdAt",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updatedAt": {
"name": "updatedAt",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"userId": {
"name": "userId",
"type": "varchar(32)",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
@ -69,13 +46,6 @@
"primaryKey": false,
"notNull": true
},
"createdAt": {
"name": "createdAt",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"lastUsedOn": {
"name": "lastUsedOn",
"type": "timestamp",
@ -100,7 +70,10 @@
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.changelog": {
"name": "changelog",
@ -115,20 +88,26 @@
},
"createdAt": {
"name": "createdAt",
"type": "timestamp",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false,
"notNull": true,
"default": "now()"
},
"updatedAt": {
"name": "updatedAt",
"type": "timestamp",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"userId": {
"name": "userId",
"type": "varchar(32)",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"pageId": {
"name": "pageId",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
@ -150,6 +129,13 @@
"primaryKey": false,
"notNull": false,
"default": true
},
"isConventional": {
"name": "isConventional",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
}
},
"indexes": {},
@ -166,10 +152,26 @@
],
"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": {}
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.changelog_commit": {
"name": "changelog_commit",
@ -184,7 +186,14 @@
},
"createdAt": {
"name": "createdAt",
"type": "timestamp",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updatedAt": {
"name": "updatedAt",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
@ -200,29 +209,41 @@
"primaryKey": false,
"notNull": false
},
"shortHash": {
"name": "shortHash",
"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
},
"commiter": {
"name": "commiter",
"type": "json",
"primaryKey": false,
"notNull": false
},
"body": {
"name": "body",
"type": "text",
"primaryKey": false,
"notNull": false
},
"message": {
"name": "message",
"type": "text",
"primaryKey": false,
"notNull": true
}
},
"indexes": {
@ -236,7 +257,7 @@
"nulls": "last"
},
{
"expression": "shortHash",
"expression": "commit",
"isExpression": false,
"asc": true,
"nulls": "last"
@ -272,12 +293,15 @@
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
"onDelete": "no action",
"onUpdate": "set null"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.changelog_version": {
"name": "changelog_version",
@ -292,14 +316,14 @@
},
"createdAt": {
"name": "createdAt",
"type": "timestamp",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false,
"notNull": true,
"default": "now()"
},
"updatedAt": {
"name": "updatedAt",
"type": "timestamp",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
@ -334,12 +358,6 @@
"primaryKey": false,
"notNull": true,
"default": "'draft'"
},
"shortHash": {
"name": "shortHash",
"type": "varchar(8)",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
@ -359,7 +377,208 @@
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"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": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.page": {
"name": "page",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"createdAt": {
"name": "createdAt",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updatedAt": {
"name": "updatedAt",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"userId": {
"name": "userId",
"type": "uuid",
"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": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.user": {
"name": "user",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"createdAt": {
"name": "createdAt",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updatedAt": {
"name": "updatedAt",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": false
},
"providerId": {
"name": "providerId",
"type": "varchar(32)",
"primaryKey": false,
"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_providerId_unique": {
"name": "user_providerId_unique",
"nullsNotDistinct": false,
"columns": [
"providerId"
]
},
"user_email_unique": {
"name": "user_email_unique",
"nullsNotDistinct": false,
"columns": [
"email"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
}
},
"enums": {
@ -375,6 +594,9 @@
},
"schemas": {},
"sequences": {},
"roles": {},
"policies": {},
"views": {},
"_meta": {
"columns": {},
"schemas": {},

@ -1,377 +0,0 @@
{
"id": "6217594b-c287-4f69-b0f2-9c80ed3f7f83",
"prevId": "33a139be-9cb3-4dfd-a14c-c196e17b053d",
"version": "7",
"dialect": "postgresql",
"tables": {
"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"
]
}
}
},
"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
},
"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"
}
},
"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
},
"shortHash": {
"name": "shortHash",
"type": "varchar(8)",
"primaryKey": false,
"notNull": true
},
"author": {
"name": "author",
"type": "json",
"primaryKey": false,
"notNull": false
},
"body": {
"name": "body",
"type": "text",
"primaryKey": false,
"notNull": false
},
"message": {
"name": "message",
"type": "text",
"primaryKey": false,
"notNull": true
}
},
"indexes": {
"unique": {
"name": "unique",
"columns": [
{
"expression": "changelogId",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "shortHash",
"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": "cascade",
"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": {}
}
},
"enums": {
"public.status": {
"name": "status",
"schema": "public",
"values": [
"draft",
"review",
"published"
]
}
},
"schemas": {},
"sequences": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}

@ -1,509 +0,0 @@
{
"id": "3dd358bb-891a-46fa-b49d-6018c900ce5f",
"prevId": "6217594b-c287-4f69-b0f2-9c80ed3f7f83",
"version": "7",
"dialect": "postgresql",
"tables": {
"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"
]
}
}
},
"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
},
"shortHash": {
"name": "shortHash",
"type": "varchar(8)",
"primaryKey": false,
"notNull": true
},
"author": {
"name": "author",
"type": "json",
"primaryKey": false,
"notNull": false
},
"body": {
"name": "body",
"type": "text",
"primaryKey": false,
"notNull": false
},
"message": {
"name": "message",
"type": "text",
"primaryKey": false,
"notNull": true
}
},
"indexes": {
"unique": {
"name": "unique",
"columns": [
{
"expression": "changelogId",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "shortHash",
"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": "cascade",
"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": {}
}
},
"enums": {
"public.status": {
"name": "status",
"schema": "public",
"values": [
"draft",
"review",
"published"
]
}
},
"schemas": {},
"sequences": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}

@ -1,521 +0,0 @@
{
"id": "8c9df2bd-6fd4-4361-aecc-db781cfb7f9c",
"prevId": "3dd358bb-891a-46fa-b49d-6018c900ce5f",
"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": "cascade",
"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": {}
}
}

@ -1,521 +0,0 @@
{
"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": {}
}
}

@ -1,521 +0,0 @@
{
"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": {}
}
}

@ -1,528 +0,0 @@
{
"id": "5cd85168-eaf9-4071-be24-3a5ff9430629",
"prevId": "39fd75cc-7a80-4e4b-817f-394bbf086262",
"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
},
"isConventional": {
"name": "isConventional",
"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": {}
}
}

@ -5,50 +5,8 @@
{
"idx": 0,
"version": "7",
"when": 1727807735760,
"tag": "0000_crazy_mindworm",
"breakpoints": true
},
{
"idx": 1,
"version": "7",
"when": 1728640705376,
"tag": "0001_daffy_rattler",
"breakpoints": true
},
{
"idx": 2,
"version": "7",
"when": 1729804659796,
"tag": "0002_fantastic_sleeper",
"breakpoints": true
},
{
"idx": 3,
"version": "7",
"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
},
{
"idx": 6,
"version": "7",
"when": 1730465968252,
"tag": "0006_pretty_maginty",
"when": 1730750779611,
"tag": "0000_dark_doomsday",
"breakpoints": true
}
]

@ -1,7 +1,7 @@
import { timestamp, uuid } from 'drizzle-orm/pg-core'
export const _basic_schema = {
id: uuid().primaryKey(),
id: uuid().primaryKey().defaultRandom(),
createdAt: timestamp({ withTimezone: true }).defaultNow().notNull(),
updatedAt: timestamp({ withTimezone: true }),
}

@ -6,7 +6,7 @@ import { _basic_schema } from './_basic'
export const access_token = pgTable('access_token', {
..._basic_schema,
userId: varchar({ length: 32 }).references(() => user.id, {
userId: uuid().references(() => user.id, {
onDelete: 'cascade',
}),
token: text().notNull(),

@ -18,7 +18,7 @@ import { user } from './user'
export const changelog = pgTable('changelog', {
..._basic_schema,
userId: varchar({ length: 32 }).references(() => user.id, {
userId: uuid().references(() => user.id, {
onDelete: 'cascade',
}),
@ -76,9 +76,7 @@ export const changelog_version_status = pgEnum('status', [
])
export const changelog_version = pgTable('changelog_version', {
id: uuid().primaryKey().defaultRandom(),
createdAt: timestamp().defaultNow(),
updatedAt: timestamp(),
..._basic_schema,
releasedAt: timestamp(),
changelogId: uuid()
@ -95,8 +93,7 @@ export const changelog_version = pgTable('changelog_version', {
export const changelog_commit = pgTable(
'changelog_commit',
{
id: uuid().primaryKey().defaultRandom(),
createdAt: timestamp(),
..._basic_schema,
changelogId: uuid().references(() => changelog.id, {
onDelete: 'cascade',

@ -7,7 +7,7 @@ import { user } from './user'
export const page = pgTable('page', {
..._basic_schema,
userId: varchar({ length: 32 }).references(() => user.id, {
userId: uuid().references(() => user.id, {
onDelete: 'cascade',
}),

@ -1,10 +1,13 @@
import { relations } from 'drizzle-orm'
import { pgTable, text, varchar } from 'drizzle-orm/pg-core'
import { pgTable, text, uuid, varchar } from 'drizzle-orm/pg-core'
import { access_token } from '.'
import { _basic_schema } from './_basic'
import { changelog } from './changelog'
export const user = pgTable('user', {
id: varchar({ length: 32 }).primaryKey(), // Clerk User Id
..._basic_schema,
providerId: varchar({ length: 32 }).notNull().unique(), // Provider User Id
name: text(),
email: text().notNull().unique(),
})