mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
fix(server): default current users to an onboarded state migration (#18929)
* on database migration, assume every user is onboarded * dont overwrite key if conflict in migration
This commit is contained in:
parent
19013af58f
commit
86f64fd0bf
1 changed files with 12 additions and 0 deletions
|
|
@ -0,0 +1,12 @@
|
|||
import { Kysely, sql } from 'kysely';
|
||||
import { UserMetadataKey } from 'src/enum';
|
||||
|
||||
export async function up(db: Kysely<any>): Promise<void> {
|
||||
await sql`INSERT INTO user_metadata SELECT id, ${UserMetadataKey.ONBOARDING}, '{"isOnboarded": true}' FROM users
|
||||
ON CONFLICT ("userId", key) DO NOTHING
|
||||
`.execute(db);
|
||||
}
|
||||
|
||||
export async function down(db: Kysely<any>): Promise<void> {
|
||||
await sql`DELETE FROM user_metadata WHERE key = ${UserMetadataKey.ONBOARDING}`.execute(db);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue