mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-19 12:10:37 +09:00
Use asset-backed company logos
This commit is contained in:
parent
1a5eaba622
commit
e538329b0a
17 changed files with 307 additions and 57 deletions
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),
|
||||
}),
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue