Use asset-backed company logos
This commit is contained in:
18
packages/db/src/schema/company_logos.ts
Normal file
18
packages/db/src/schema/company_logos.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { pgTable, uuid, timestamp, uniqueIndex } from "drizzle-orm/pg-core";
|
||||
import { companies } from "./companies.js";
|
||||
import { assets } from "./assets.js";
|
||||
|
||||
export const companyLogos = pgTable(
|
||||
"company_logos",
|
||||
{
|
||||
id: uuid("id").primaryKey().defaultRandom(),
|
||||
companyId: uuid("company_id").notNull().references(() => companies.id, { onDelete: "cascade" }),
|
||||
assetId: uuid("asset_id").notNull().references(() => assets.id, { onDelete: "cascade" }),
|
||||
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
||||
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
||||
},
|
||||
(table) => ({
|
||||
companyUq: uniqueIndex("company_logos_company_uq").on(table.companyId),
|
||||
assetUq: uniqueIndex("company_logos_asset_uq").on(table.assetId),
|
||||
}),
|
||||
);
|
||||
Reference in New Issue
Block a user