feat: add portal database schema

This commit is contained in:
Leon Tonhäuser committed 2026-08-09 20:26:18 +02:00
1 parent 763098b129
commit 7acaacb92e
17 files changed
+4410 -111

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
import { index, pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";
import { users } from "./auth";
import { editorialAccounts } from "./editorials";
export const albumGrants = pgTable(
"album_grants",
{
id: uuid("id").defaultRandom().primaryKey(),
editorialAccountId: uuid("editorial_account_id")
.notNull()
.references(() => editorialAccounts.id, { onDelete: "restrict" }),
immichAlbumId: text("immich_album_id").notNull(),
grantedAt: timestamp("granted_at", { withTimezone: true }).notNull().defaultNow(),
revokedAt: timestamp("revoked_at", { withTimezone: true }),
grantedByUserId: uuid("granted_by_user_id").references(() => users.id, {
onDelete: "restrict",
}),
},
(table) => [
index("album_grants_editorial_account_id_idx").on(table.editorialAccountId),
index("album_grants_immich_album_id_idx").on(table.immichAlbumId),
],
);