create : aspects, subAspects schema
This commit is contained in:
parent
a47373097c
commit
252148011e
16
apps/backend/src/drizzle/schema/aspects.ts
Normal file
16
apps/backend/src/drizzle/schema/aspects.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import { createId } from "@paralleldrive/cuid2";
|
||||
import {
|
||||
pgTable,
|
||||
timestamp,
|
||||
varchar,
|
||||
} from "drizzle-orm/pg-core";
|
||||
|
||||
export const aspects = pgTable("aspects", {
|
||||
id: varchar("id", { length: 50 })
|
||||
.primaryKey()
|
||||
.$defaultFn(() => createId()),
|
||||
name: varchar("name", { length: 255 }).notNull(),
|
||||
createdAt: timestamp("created_at", { mode: "date" }).defaultNow(),
|
||||
updatedAt: timestamp("updated_at", { mode: "date" }).defaultNow(),
|
||||
deletedAt: timestamp("deleted_at", { mode: "date" }),
|
||||
});
|
||||
18
apps/backend/src/drizzle/schema/subAspects.ts
Normal file
18
apps/backend/src/drizzle/schema/subAspects.ts
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { createId } from "@paralleldrive/cuid2";
|
||||
import {
|
||||
pgTable,
|
||||
timestamp,
|
||||
varchar,
|
||||
} from "drizzle-orm/pg-core";
|
||||
import { aspects } from "./aspects";
|
||||
|
||||
export const subAspects = pgTable("sub_aspects", {
|
||||
id: varchar("id", {length: 50})
|
||||
.primaryKey()
|
||||
.$defaultFn(() => createId()),
|
||||
name: varchar("name", { length: 255 }).notNull(),
|
||||
createdAt: timestamp("createdAt", { mode: "date" }).defaultNow(),
|
||||
updatedAt: timestamp("updatedAt", { mode: "date" }).defaultNow(),
|
||||
deletedAt: timestamp("deletedAt", { mode: "date" }),
|
||||
aspectId: varchar("aspectId").references(() => aspects.id)
|
||||
});
|
||||
Loading…
Reference in New Issue
Block a user