fix: preserve legacy accounting migration data

This commit is contained in:
Leon Tonhäuser committed 2026-08-10 11:39:44 +02:00
1 parent 3de1530074
commit 3cdca5c82c
10 files changed
+559 -177

No files matched your search

+7 -2
View File
@@ -1,4 +1,5 @@
import { index, pgTable, timestamp, uuid } from "drizzle-orm/pg-core";
import { sql } from "drizzle-orm";
import { check, index, pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";
import { users } from "./auth";
import { editorialAccounts } from "./editorials";
@@ -10,7 +11,7 @@ export const albumGrants = pgTable(
editorialAccountId: uuid("editorial_account_id")
.notNull()
.references(() => editorialAccounts.id, { onDelete: "restrict" }),
immichAlbumId: uuid("immich_album_id").notNull(),
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, {
@@ -20,5 +21,9 @@ export const albumGrants = pgTable(
(table) => [
index("album_grants_editorial_account_id_idx").on(table.editorialAccountId),
index("album_grants_immich_album_id_idx").on(table.immichAlbumId),
check(
"album_grants_canonical_immich_album_id_check",
sql`${table.immichAlbumId} ~ '^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$'`,
),
],
);