upd
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import { pgTable, timestamp, uuid, varchar } from "drizzle-orm/pg-core";
|
||||
import { companiesTable } from "./companies";
|
||||
import { relations } from "drizzle-orm";
|
||||
|
||||
export const appsTable = pgTable("apps", {
|
||||
id: uuid("id").defaultRandom().primaryKey(),
|
||||
name: varchar("name").notNull(),
|
||||
fileName: varchar("filename").notNull(),
|
||||
companyId: uuid("company_id")
|
||||
.notNull()
|
||||
.references(() => companiesTable.id),
|
||||
createdAt: timestamp("created_at", { withTimezone: true })
|
||||
.notNull()
|
||||
.defaultNow(),
|
||||
updatedAt: timestamp("updated_at", { withTimezone: true })
|
||||
.notNull()
|
||||
.defaultNow()
|
||||
.$onUpdate(() => new Date()),
|
||||
});
|
||||
|
||||
export const appsRelations = relations(appsTable, ({ one }) => ({
|
||||
company: one(companiesTable, {
|
||||
fields: [appsTable.companyId],
|
||||
references: [companiesTable.id],
|
||||
}),
|
||||
}));
|
||||
Reference in New Issue
Block a user