mirror of
https://github.com/immich-app/immich
synced 2025-06-08 18:54:16 +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
@ -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…
x
Reference in New Issue
Block a user