This commit is contained in:
2025-03-20 14:41:31 +05:00
commit 1c31fce139
20 changed files with 1048 additions and 0 deletions
+26
View File
@@ -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],
}),
}));