Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/rude-walls-hug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@example/erp": patch
"@kivotos/core": patch
"@kivotos/next": minor
---

- [[DRIZZ-54] Collection Records Display](https://app.plane.so/softnetics/browse/DRIZZ-54/)
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ yarn-error.log*
.DS_Store
*.pem

.data
.data
packages/drizzlify-next/drizzilify.code-workspace
7 changes: 4 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@
"editor.formatOnSaveMode": "file",
"typescript.tsdk": "node_modules/typescript/lib",
"tailwindCSS.experimental.configFile": {
"packages/drizzlify-next/src/styles/tailwind.css": "packages/drizzlify-next/**",
"apps-api/erp/src/app/global.css": "apps-api/erp/**",
"apps-api/erp/src/app/(admin)/admin/tailwind.css": "apps-api/erp/(admin)/**"
"packages/next/src/styles/tailwind.css": "packages/next/**",
"examples/erp/src/app/global.css": "examples/erp/**",
"examples/erp/src/app/(admin)/admin/tailwind.css": "examples/erp/(admin)/**",
"examples/erp/src/app/(admin)/playground/tailwind.css": "examples/erp/(admin)/playground/**"
}
}
22 changes: 15 additions & 7 deletions examples/erp/db/schema/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { relations } from 'drizzle-orm'
import { relations, sql } from 'drizzle-orm'
import { boolean, pgTable, text, timestamp, uuid, varchar } from 'drizzle-orm/pg-core'

const timestamps = {
Expand All @@ -8,7 +8,9 @@ const timestamps = {
}

export const users = pgTable('users', {
id: text('id').primaryKey(),
id: uuid('id')
.primaryKey()
.default(sql`gen_random_uuid()`),
name: text('name').notNull(),
email: text('email').notNull().unique(),
emailVerified: boolean('email_verified').notNull().default(false),
Expand All @@ -22,7 +24,7 @@ export const sessions = pgTable('session', {
token: text('token').notNull().unique(),
ipAddress: text('ip_address'),
userAgent: text('user_agent'),
userId: text('user_id')
userId: uuid('user_id')
.notNull()
.references(() => users.id, { onDelete: 'cascade' }),
...timestamps,
Expand All @@ -32,7 +34,7 @@ export const accounts = pgTable('account', {
id: text('id').primaryKey(),
accountId: text('account_id').notNull(),
providerId: text('provider_id').notNull(),
userId: text('user_id')
userId: uuid('user_id')
.notNull()
.references(() => users.id, { onDelete: 'cascade' }),
accessToken: text('access_token'),
Expand All @@ -54,7 +56,9 @@ export const verifications = pgTable('verification', {
})

export const posts = pgTable('posts', {
id: uuid().primaryKey(),
id: uuid()
.primaryKey()
.default(sql`gen_random_uuid()`),
title: varchar(),
content: text(),
authorId: uuid().references(() => users.id),
Expand All @@ -72,7 +76,9 @@ export const postsRelations = relations(posts, ({ one }) => ({
}))

export const categories = pgTable('categories', {
id: uuid().primaryKey(),
id: uuid()
.primaryKey()
.default(sql`gen_random_uuid()`),
name: varchar().notNull(),
ownerId: uuid().references(() => users.id),
...timestamps,
Expand All @@ -85,7 +91,9 @@ export const categoriesRelations = relations(categories, ({ many, one }) => ({
}))

export const categoryTags = pgTable('categoryTags', {
id: uuid().primaryKey(),
id: uuid()
.primaryKey()
.default(sql`gen_random_uuid()`),
name: varchar().notNull(),
category: uuid().references(() => categories.id),
...timestamps,
Expand Down
35 changes: 0 additions & 35 deletions examples/erp/drizzle/0000_eminent_sheva_callister.sql

This file was deleted.

87 changes: 87 additions & 0 deletions examples/erp/drizzle/0000_peaceful_leper_queen.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
CREATE TABLE "account" (
"id" text PRIMARY KEY NOT NULL,
"account_id" text NOT NULL,
"provider_id" text NOT NULL,
"user_id" uuid NOT NULL,
"access_token" text,
"refresh_token" text,
"id_token" text,
"access_token_expires_at" timestamp,
"refresh_token_expires_at" timestamp,
"scope" text,
"password" text,
"updatedAt" timestamp DEFAULT now(),
"createdAt" timestamp DEFAULT now() NOT NULL,
"deletedAt" timestamp
);
--> statement-breakpoint
CREATE TABLE "categories" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"name" varchar NOT NULL,
"ownerId" uuid,
"updatedAt" timestamp DEFAULT now(),
"createdAt" timestamp DEFAULT now() NOT NULL,
"deletedAt" timestamp
);
--> statement-breakpoint
CREATE TABLE "categoryTags" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"name" varchar NOT NULL,
"category" uuid,
"updatedAt" timestamp DEFAULT now(),
"createdAt" timestamp DEFAULT now() NOT NULL,
"deletedAt" timestamp
);
--> statement-breakpoint
CREATE TABLE "posts" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"title" varchar,
"content" text,
"authorId" uuid,
"categoryId" uuid,
"updatedAt" timestamp DEFAULT now(),
"createdAt" timestamp DEFAULT now() NOT NULL,
"deletedAt" timestamp
);
--> statement-breakpoint
CREATE TABLE "session" (
"id" text PRIMARY KEY NOT NULL,
"expires_at" timestamp NOT NULL,
"token" text NOT NULL,
"ip_address" text,
"user_agent" text,
"user_id" uuid NOT NULL,
"updatedAt" timestamp DEFAULT now(),
"createdAt" timestamp DEFAULT now() NOT NULL,
"deletedAt" timestamp,
CONSTRAINT "session_token_unique" UNIQUE("token")
);
--> statement-breakpoint
CREATE TABLE "users" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"name" text NOT NULL,
"email" text NOT NULL,
"email_verified" boolean DEFAULT false NOT NULL,
"image" text,
"updatedAt" timestamp DEFAULT now(),
"createdAt" timestamp DEFAULT now() NOT NULL,
"deletedAt" timestamp,
CONSTRAINT "users_email_unique" UNIQUE("email")
);
--> statement-breakpoint
CREATE TABLE "verification" (
"id" text PRIMARY KEY NOT NULL,
"identifier" text NOT NULL,
"value" text NOT NULL,
"expires_at" timestamp NOT NULL,
"updatedAt" timestamp DEFAULT now(),
"createdAt" timestamp DEFAULT now() NOT NULL,
"deletedAt" timestamp
);
--> statement-breakpoint
ALTER TABLE "account" ADD CONSTRAINT "account_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "categories" ADD CONSTRAINT "categories_ownerId_users_id_fk" FOREIGN KEY ("ownerId") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "categoryTags" ADD CONSTRAINT "categoryTags_category_categories_id_fk" FOREIGN KEY ("category") REFERENCES "public"."categories"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "posts" ADD CONSTRAINT "posts_authorId_users_id_fk" FOREIGN KEY ("authorId") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "posts" ADD CONSTRAINT "posts_categoryId_categories_id_fk" FOREIGN KEY ("categoryId") REFERENCES "public"."categories"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "session" ADD CONSTRAINT "session_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
10 changes: 0 additions & 10 deletions examples/erp/drizzle/0001_fixed_blue_blade.sql

This file was deleted.

Loading
Loading