Immich升级手记2.0.1到2.4.1

利用数据库文件恢复

前言
使用rsync同步数据后,一言不合就在目录下面执行了命令进行升级

1
docker compose pull && docker compose up -d

来自https://docs.immich.app/install/upgrading/
运行后发现项目无法启动

跟着“智谱清言”操作了如下方法后
查看报错日志

1
2
3
4
5
6
7
root@immich:/mnt/all/picture/immich# docker logs immich_postgres --tail 100
chown: changing ownership of '/var/lib/postgresql/data': Operation not permitted
chown: changing ownership of '/var/lib/postgresql/data': Operation not permitted
chown: changing ownership of '/var/lib/postgresql/data': Operation not permitted
chown: changing ownership of '/var/lib/postgresql/data': Operation not permitted
chown: changing ownership of '/var/lib/postgresql/data': Operation not permitted
chown: changing ownership of '/var/lib/postgresql/data': Operation not permitted

查看目录的格式

1
2
3
root@immich:/mnt/all/picture/immich# df -T /mnt/all/picture/immich
Filesystem Type 1K-blocks Used Available Use% Mounted on
/dev/sdf3 exfat 11230944256 486737664 10744206592 5% /mnt/all
1
2
3
4
找到问题了!你的数据目录挂载在 exFAT 文件系统上(/dev/sdf3 类型是 exfat),这是问题所在。

问题根源:
exFAT 文件系统不支持 Unix 文件权限(所有者/组/权限位),所以 PostgreSQL 容器无法执行 chown 操作来改变数据目录的所有权。

在docker的yaml目录下停止容器docker compose down

将现有数据库数据移动到系统盘或其他 ext4/xfs 分区

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 创建新的数据库目录(在系统盘上)
sudo mkdir -p /var/lib/immich/postgres

# 复制现有数据
sudo cp -r /mnt/all/picture/immich/postgres/* /var/lib/immich/postgres/

# 设置正确的权限
sudo chown -R 999:999 /var/lib/immich/postgres
# 或者
sudo chown -R 70:70 /var/lib/immich/postgres

#修改 .env 文件
nano .env
DB_DATA_LOCATION=/var/lib/immich/postgres

重新启动服务
docker compose up -d

修改过docker-compose.yml中的以root运行

1
2
3
4
database:
container_name: immich_postgres
image: docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
user: root # 添加这一行

修改.env

1
DB_DATA_LOCATION=/var/lib/immich/postgres
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
root@immich:/mnt/all/picture/immich# ls -lha /var/lib/immich/postgres
total 12K
drwx------ 3 999 root 4.0K Dec 31 02:51 .
drwxr-xr-x 3 root root 4.0K Dec 31 02:49 ..
drwxr-xr-x 2 999 root 4.0K Dec 31 02:51 postgres
root@immich:/mnt/all/picture/immich# docker logs immich_postgres --tail 20

Data page checksums are enabled.

initdb: error: directory "/var/lib/postgresql/data" exists but is not empty
If you want to create a new database system, either remove or empty
the directory "/var/lib/postgresql/data" or run initdb
with an argument other than "/var/lib/postgresql/data".
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are enabled.

initdb: error: directory "/var/lib/postgresql/data" exists but is not empty
If you want to create a new database system, either remove or empty
the directory "/var/lib/postgresql/data" or run initdb
with an argument other than "/var/lib/postgresql/data".
root@immich:/mnt/all/picture/immich#

根据“AI”的操作

1
2
3
# 删除之前不完整的数据
sudo rm -rf /var/lib/immich/postgres/*
docker compose up -d

是启动了,但数据也都没了


请教Gemini
大概流程
将原本的数据库文件拷贝一份到/opt里面,创建对应版本的数据库并运行
使用原本的版本运行,创建文件docker-compose-recovery.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
root@immich:/opt# cat docker-compose-recovery.yml 
name: immich-restore

services:
database:
container_name: immich_db_restore
image: tensorchord/pgvecto-rs:pg14-v0.2.0
environment:
POSTGRES_PASSWORD: #{这里是之前.env里面的,数据库信息}
POSTGRES_USER: postgres
POSTGRES_DB: immich
volumes:
- ./data:/var/lib/postgresql/data
restart: always
root@immich:/opt#

创建后,可以运行,使用命令导出数据

1
docker exec -t immich_db_restore pg_dumpall -c -U postgres > full_dump.sql

把刚刚的数据库down了,
复制原本的docker信息,在新的目录里面运行,包括挂载点也用之前的。运行后导入

1
docker exec -i immich_postgres psql -U postgres -d postgres < full_dump.sql

导入后发现数据大相径庭。使用如下命令将旧的数据强行融到新的里面

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
root@immich:/opt/immich-recovery# docker exec -it immich_postgres psql -U postgres -d immich
immich=#
immich=# INSERT INTO "asset" (
id, "deviceAssetId", "deviceId", "ownerId", "type", "originalPath",
"createdAt", "updatedAt", "fileCreatedAt", "fileModifiedAt",
"localDateTime", "isFavorite", "duration", "checksum", "originalFileName"
)
SELECT
id, "deviceAssetId", "deviceId", "ownerId", "type", "originalPath",
"createdAt", "updatedAt", "createdAt", "updatedAt",
"createdAt", "isFavorite", "duration", "checksum",
reverse(split_part(reverse("originalPath"), '/', 1))
FROM assets;
INSERT 0 5204
immich=#
immich=#
immich=# INSERT INTO asset_exif (
"assetId", "make", "model", "exifImageWidth", "exifImageHeight",
"exposureTime", "dateTimeOriginal"
)
SELECT
"assetId", "make", "model", "exifImageWidth", "exifImageHeight",
"exposureTime", "dateTimeOriginal"
FROM exif;
INSERT 0 5204
immich=#
immich=# UPDATE "asset" SET "originalPath" = regexp_replace("originalPath", 'library/[^/]+/', 'library/admin/');
UPDATE 5204
immich=#
immich=# \q
root@immich:/opt/immich-recovery#
#

中途有个插曲,每次登录都会过一遍引导,但引导页无法继续,如果直接刷新浏览器就能直接进去

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
root@immich:/opt/immich-recovery# docker exec -it immich_postgres psql -U postgres -d immich
immich=#

immich=# INSERT INTO "asset" (

id, "deviceAssetId", "deviceId", "ownerId", "type", "originalPath",

"createdAt", "updatedAt", "fileCreatedAt", "fileModifiedAt",

"isFavorite", "duration", "checksum"

)

SELECT

id, "deviceAssetId", "deviceId", "ownerId", "type", "originalPath",

"createdAt", "updatedAt", "createdAt", "updatedAt",

"isFavorite", "duration", "checksum"

FROM assets;

ERROR: null value in column "originalFileName" of relation "asset" violates not-null constraint

DETAIL: Failing row contains (0eafb85e-cec3-4d3b-8f2d-fbbd358b911c, 1000134192, 5fd448a9-458d-4c78-93c9-9ff9d0466628, bd5ab73a8e6ca31ef461fbd4c524f4145f4531b5cede307122d8dbe249631a1b, IMAGE, upload/library/admin/2020/01/18/38.gif, 2025-02-26 04:13:31.791762+00, 2025-02-26 04:13:32.255595+00, f, null, , \x336cb3cbe0fd6cac96cd7cd5ca847c6a01f95b50, null, 2025-02-26 04:13:32.255595+00, 2025-02-26 04:13:31.791762+00, null, null, f, null, f, null, null, null, null, active, 019b7504-be88-7c0c-8cdc-93445ee028dd, timeline).

immich=#

immich=# INSERT INTO asset_exif (

"assetId", "make", "model", "exifImageWidth", "exifImageHeight",

"exposureTime", "dateTimeOriginal"

)

SELECT

"assetId", "make", "model", "exifImageWidth", "exifImageHeight",

"exposureTime", "dateTimeOriginal"

FROM exif;

ERROR: insert or update on table "asset_exif" violates foreign key constraint "asset_exif_assetId_fkey"

DETAIL: Key (assetId)=(b3de2ff3-0cb2-47e0-8552-9d74e7901581) is not present in table "asset".

immich=#

immich=# UPDATE "asset" SET "originalPath" = regexp_replace("originalPath", 'library/[^/]+/', 'library/admin/');

UPDATE 0

immich=#

root@immich:/opt/immich-recovery# docker compose restart

[+] Restarting 4/4

✔ Container immich_postgres Started 16.4s

✔ Container immich_server Started 8.1s

✔ Container immich_machine_learning Started 9.4s

✔ Container immich_redis Started 10.4s

root@immich:/opt/immich-recovery#

root@immich:/opt/immich-recovery# docker ps

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

fa31f5c7e1b3 ghcr.io/immich-app/immich-server:release "tini -- /bin/bash -…" 41 minutes ago Up 34 seconds (health: starting) 0.0.0.0:2283->2283/tcp, [::]:2283->2283/tcp immich_server

0e632e7716e4 ghcr.io/immich-app/immich-machine-learning:release "tini -- python -m i…" 41 minutes ago Up 33 seconds (health: starting) immich_machine_learning

54110efd5159 valkey/valkey:8-bookworm "docker-entrypoint.s…" 2 hours ago Up 32 seconds (health: starting) 6379/tcp immich_redis

bf6a38ff065b ghcr.io/immich-app/postgres:14-vectorchord0.3.0-pgvectors0.2.0 "/usr/local/bin/immi…" 2 hours ago Up 25 seconds (health: starting) 5432/tcp immich_postgres

root@immich:/opt/immich-recovery#

root@immich:/opt/immich-recovery# docker logs --tail 20 immich_server

[Nest] 7 - 12/31/2025, 3:28:29 PM LOG [Microservices:InstanceLoader] ClsCommonModule dependencies initialized

[Nest] 7 - 12/31/2025, 3:28:29 PM LOG [Microservices:InstanceLoader] KyselyModule$1 dependencies initialized

[Nest] 7 - 12/31/2025, 3:28:29 PM LOG [Microservices:InstanceLoader] OpenTelemetryModule dependencies initialized

[Nest] 7 - 12/31/2025, 3:28:29 PM LOG [Microservices:InstanceLoader] KyselyCoreModule$1 dependencies initialized

[Nest] 7 - 12/31/2025, 3:28:29 PM LOG [Microservices:InstanceLoader] DiscoveryModule dependencies initialized

[Nest] 7 - 12/31/2025, 3:28:29 PM LOG [Microservices:InstanceLoader] OpenTelemetryCoreModule dependencies initialized

[Nest] 7 - 12/31/2025, 3:28:29 PM LOG [Microservices:InstanceLoader] ClsRootModule dependencies initialized

[Nest] 7 - 12/31/2025, 3:28:29 PM LOG [Microservices:InstanceLoader] BullModule dependencies initialized

[Nest] 7 - 12/31/2025, 3:28:29 PM LOG [Microservices:InstanceLoader] BullModule dependencies initialized

[Nest] 7 - 12/31/2025, 3:28:29 PM LOG [Microservices:InstanceLoader] MicroservicesModule dependencies initialized

[Nest] 7 - 12/31/2025, 3:28:29 PM LOG [Microservices:NestApplication] Nest application successfully started

[Nest] 7 - 12/31/2025, 3:28:29 PM LOG [Microservices:Bootstrap] Immich Microservices is running [v2.4.1] [production]

[Nest] 43 - 12/31/2025, 3:28:31 PM LOG [Api:WebsocketRepository] Websocket Connect: e5zgCBw0k40EZiY-AAAB

[Nest] 43 - 12/31/2025, 3:28:31 PM ERROR [Api:WebsocketRepository] Websocket connection error: UnauthorizedException: Invalid user token

UnauthorizedException: Invalid user token

at AuthService.validateSession (/usr/src/app/server/dist/services/auth.service.js:381:15)

at process.processTicksAndRejections (node:internal/process/task_queues:105:5)

at async AuthService.authenticate (/usr/src/app/server/dist/services/auth.service.js:126:25)

at async WebsocketRepository.handleConnection (/usr/src/app/server/dist/repositories/websocket.repository.js:43:26)

[Nest] 43 - 12/31/2025, 3:28:31 PM LOG [Api:WebsocketRepository] Websocket Disconnect: e5zgCBw0k40EZiY-AAAB

root@immich:/opt/immich-recovery#

结束后登录web,发现所有图片都是“加载失败”
头像-> 系统管理-> 服务器状态能看到图片数量不是0
头像-> 系统管理-> 任务队列 【提取元数据】点击全部结束后点击【生成缩略图】的全部

等扫完后,再次回到”首页“(点logo),就会发现图片出现了


利用备份的数据库文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
root@immich:/mnt/all/picture/immich/immich-app# nano .env 
root@immich:/mnt/all/picture/immich/immich-app# ls
docker-compose.yml library postgres postgres1
root@immich:/mnt/all/picture/immich/immich-app# cd library/
root@immich:/mnt/all/picture/immich/immich-app/library# ls
backups encoded-video library profile thumbs upload
root@immich:/mnt/all/picture/immich/immich-app/library# cd ..
root@immich:/mnt/all/picture/immich/immich-app# ls
docker-compose.yml library postgres postgres1
root@immich:/mnt/all/picture/immich/immich-app# docker compose up -d
[+] Running 5/5
✔ Network immich_default Created 0.3s
✔ Container immich_redis Started 9.5s
✔ Container immich_postgres Started 9.9s
✔ Container immich_machine_learning Started 8.4s
✔ Container immich_server Started 10.3s
root@immich:/mnt/all/picture/immich/immich-app# cat .env
# You can find documentation for all the supported env variables at https://immich.app/docs/install/environment-variables

# The location where your uploaded files are stored
UPLOAD_LOCATION=./library
# The location where your database files are stored
#DB_DATA_LOCATION=./postgres
DB_DATA_LOCATION=/opt/immich_data

# To set a timezone, uncomment the next line and change Etc/UTC to a TZ identifier from this list: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
# TZ=Etc/UTC

# The Immich version to use. You can pin this to a specific version like "v1.71.0"
IMMICH_VERSION=release

# Connection secret for postgres. You should change it to a random password
# Please use only the characters `A-Za-z0-9`, without special characters or spaces
DB_PASSWORD=xxxx

# The values below this line do not need to be changed
###################################################################################
DB_USERNAME=postgres
DB_DATABASE_NAME=immich
root@immich:/mnt/all/picture/immich/immich-app# du -sh /opt/immich_data
217M /opt/immich_data
root@immich:/mnt/all/picture/immich/immich-app# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c23ae1c73f92 ghcr.io/immich-app/immich-server:release "tini -- /bin/bash -…" 2 minutes ago Up About a minute (healthy) 0.0.0.0:2283->2283/tcp, [::]:2283->2283/tcp immich_server
74924070d6ab ghcr.io/immich-app/immich-machine-learning:release "tini -- python -m i…" 2 minutes ago Up 2 minutes (healthy) immich_machine_learning
ce92db21ca2e ghcr.io/immich-app/postgres:14-vectorchord0.3.0-pgvectors0.2.0 "/usr/local/bin/immi…" 2 minutes ago Up 2 minutes (healthy) 5432/tcp immich_postgres
f0d59f4a67da valkey/valkey:8-bookworm "docker-entrypoint.s…" 2 minutes ago Up 2 minutes (healthy) 6379/tcp immich_redis
root@immich:/mnt/all/picture/immich/immich-app#
root@immich:/mnt/all/picture/immich/immich-app#
root@immich:/mnt/all/picture/immich/immich-app#
root@immich:/mnt/all/picture/immich/immich-app#
root@immich:/mnt/all/picture/immich/immich-app#
root@immich:/mnt/all/picture/immich/immich-app#
root@immich:/mnt/all/picture/immich/immich-app# docker exec -it immich_postgres psql -U postgres -d immich -c "SELECT id, email, name FROM \"user\";"
id | email | name
----+-------+------
(0 rows)

root@immich:/mnt/all/picture/immich/immich-app# docker exec -it immich_postgres psql -U postgres -d immich -c "SELECT count(*) FROM asset;"
count
-------
0
(1 row)

root@immich:/mnt/all/picture/immich/immich-app# cat /opt/immich-recovery/dec_backup.sql | docker exec -i immich_postgres psql -U postgres -d immich
invalid command \restrict
SET
SET
SET
ERROR: cannot drop the currently open database
ERROR: current user cannot be dropped
ERROR: role "postgres" already exists
ALTER ROLE
invalid command \unrestrict
invalid command \restrict
SET
SET
SET
SET
SET
set_config
------------

(1 row)

SET
SET
SET
SET
UPDATE 1
DROP DATABASE
CREATE DATABASE
invalid command \unrestrict
ALTER DATABASE
You are now connected to database "template1" as user "postgres".
invalid command \restrict
SET
SET
SET
SET
SET
set_config
------------

(1 row)

SET
SET
SET
SET
COMMENT
ALTER DATABASE
invalid command \unrestrict
You are now connected to database "template1" as user "postgres".
invalid command \restrict
SET
SET
SET
SET
SET
set_config
------------

(1 row)

SET
SET
SET
SET
REVOKE
GRANT
invalid command \unrestrict
invalid command \restrict
SET
SET
SET
SET
SET
set_config
------------

(1 row)

SET
SET
SET
SET
ERROR: database "immich" already exists
ALTER DATABASE
invalid command \unrestrict
You are now connected to database "immich" as user "postgres".
invalid command \restrict
SET
SET
SET
SET
SET
set_config
------------

(1 row)

SET
SET
SET
SET
ALTER DATABASE
ALTER DATABASE
invalid command \unrestrict
You are now connected to database "immich" as user "postgres".
invalid command \restrict
SET
SET
SET
SET
SET
set_config
------------

(1 row)

SET
SET
SET
SET
CREATE EXTENSION
COMMENT
CREATE EXTENSION
COMMENT
CREATE EXTENSION
COMMENT
CREATE EXTENSION
COMMENT
CREATE EXTENSION
COMMENT
CREATE EXTENSION
COMMENT
CREATE EXTENSION
COMMENT
ERROR: type "asset_visibility_enum" already exists
ALTER TYPE
ERROR: type "assets_status_enum" already exists
ALTER TYPE
ERROR: type "sourcetype" already exists
ALTER TYPE
ERROR: function "album_asset_delete_audit" already exists with same argument types
ALTER FUNCTION
ERROR: function "album_delete_audit" already exists with same argument types
ALTER FUNCTION
ERROR: function "album_user_after_insert" already exists with same argument types
ALTER FUNCTION
ERROR: function "album_user_delete_audit" already exists with same argument types
ALTER FUNCTION
ERROR: function "asset_delete_audit" already exists with same argument types
ALTER FUNCTION
ERROR: function "asset_face_audit" already exists with same argument types
ALTER FUNCTION
ERROR: function "asset_metadata_audit" already exists with same argument types
ALTER FUNCTION
ERROR: function "f_concat_ws" already exists with same argument types
ALTER FUNCTION
ERROR: function "f_unaccent" already exists with same argument types
ALTER FUNCTION
ERROR: function "immich_uuid_v7" already exists with same argument types
ALTER FUNCTION
ALTER FUNCTION
ERROR: function "ll_to_earth_public" already exists with same argument types
ERROR: function "memory_asset_delete_audit" already exists with same argument types
ALTER FUNCTION
ERROR: function "memory_delete_audit" already exists with same argument types
ALTER FUNCTION
ERROR: function "partner_delete_audit" already exists with same argument types
ALTER FUNCTION
ALTER FUNCTION
ERROR: function "person_delete_audit" already exists with same argument types
ERROR: function "stack_delete_audit" already exists with same argument types
ALTER FUNCTION
ERROR: function "updated_at" already exists with same argument types
ALTER FUNCTION
ERROR: function "user_delete_audit" already exists with same argument types
ALTER FUNCTION
ERROR: function "user_metadata_audit" already exists with same argument types
ALTER FUNCTION
SET
SET
ERROR: relation "activity" already exists
ALTER TABLE
ERROR: relation "album" already exists
ALTER TABLE
COMMENT
ERROR: relation "album_asset" already exists
ALTER TABLE
ERROR: relation "album_asset_audit" already exists
ALTER TABLE
ERROR: relation "album_audit" already exists
ALTER TABLE
ERROR: relation "album_user" already exists
ALTER TABLE
ERROR: relation "album_user_audit" already exists
ALTER TABLE
ERROR: relation "api_key" already exists
ALTER TABLE
ERROR: relation "asset" already exists
ALTER TABLE
ERROR: relation "asset_audit" already exists
ALTER TABLE
ERROR: relation "asset_exif" already exists
ALTER TABLE
ERROR: relation "asset_face" already exists
ALTER TABLE
ERROR: relation "asset_face_audit" already exists
ALTER TABLE
ERROR: relation "asset_file" already exists
ALTER TABLE
ERROR: relation "asset_job_status" already exists
ALTER TABLE
ERROR: relation "asset_metadata" already exists
ALTER TABLE
ERROR: relation "asset_metadata_audit" already exists
ALTER TABLE
ERROR: relation "audit" already exists
ALTER TABLE
ERROR: relation "audit_id_seq" already exists
ALTER TABLE
ALTER SEQUENCE
ERROR: relation "face_search" already exists
ALTER TABLE
ERROR: relation "geodata_places" already exists
ALTER TABLE
ERROR: relation "kysely_migrations" already exists
ALTER TABLE
ERROR: relation "kysely_migrations_lock" already exists
ALTER TABLE
ERROR: relation "library" already exists
ALTER TABLE
ERROR: relation "memory" already exists
ALTER TABLE
ERROR: relation "memory_asset" already exists
ALTER TABLE
ERROR: relation "memory_asset_audit" already exists
ALTER TABLE
ERROR: relation "memory_audit" already exists
ALTER TABLE
ERROR: relation "migration_overrides" already exists
ALTER TABLE
ERROR: relation "move_history" already exists
ALTER TABLE
ERROR: relation "naturalearth_countries" already exists
ALTER TABLE
ERROR: column "id" of relation "naturalearth_countries" is already an identity column
ERROR: relation "notification" already exists
ALTER TABLE
ERROR: relation "partner" already exists
ALTER TABLE
ERROR: relation "partner_audit" already exists
ALTER TABLE
ERROR: relation "person" already exists
ALTER TABLE
ERROR: relation "person_audit" already exists
ALTER TABLE
ERROR: relation "session" already exists
ALTER TABLE
ERROR: relation "session_sync_checkpoint" already exists
ALTER TABLE
ERROR: relation "shared_link" already exists
ALTER TABLE
ERROR: relation "shared_link_asset" already exists
ALTER TABLE
ERROR: relation "smart_search" already exists
ALTER TABLE
ERROR: relation "stack" already exists
ALTER TABLE
ERROR: relation "stack_audit" already exists
ALTER TABLE
ERROR: relation "system_metadata" already exists
ALTER TABLE
ERROR: relation "tag" already exists
ALTER TABLE
ERROR: relation "tag_asset" already exists
ALTER TABLE
ERROR: relation "tag_closure" already exists
ALTER TABLE
ERROR: relation "user" already exists
ALTER TABLE
ERROR: relation "user_audit" already exists
ALTER TABLE
ERROR: relation "user_metadata" already exists
ALTER TABLE
ERROR: relation "user_metadata_audit" already exists
ALTER TABLE
ERROR: relation "version_history" already exists
ALTER TABLE
ALTER TABLE
COPY 0
ERROR: insert or update on table "album" violates foreign key constraint "album_ownerId_fkey"
DETAIL: Key (ownerId)=(991284a3-2abc-4a84-9dca-dfc49552d1ca) is not present in table "user".
ERROR: column "albumsId" of relation "album_asset" does not exist
invalid command \.
ERROR: syntax error at or near "90"
LINE 1: 90bd5db7-b76e-48b1-b8b5-535e220e405e c7133e11-e968-43ee-ab3f...
^
invalid command \.
COPY 0
ERROR: column "albumsId" of relation "album_user" does not exist
invalid command \.
COPY 0
COPY 0
ERROR: column "sidecarPath" of relation "asset" does not exist
invalid command \N
invalid command \
invalid command \N
invalid command \N
invalid command \N
ERROR: syntax error at or near "c86c5c40"
LINE 1: c86c5c40-3eb2-4972-ac08-151a2d44a7bc CCC8E63F-0B6A-4B9A-952C...
^
invalid command \
invalid command \N
invalid command \N
invalid command \N
invalid command \N
ERROR: syntax error at or near "9e4"
LINE 1: 9e4edf+1.mp4 2024-02-06 17:15:06+00 2024-02-06 17:15:06+00 f...
^
invalid command \
invalid command \
invalid command \N
ERROR: syntax error at or near "f07ed9"
LINE 1: f07ed9+1.mp4 2024-04-10 04:23:04+00 2024-04-10 04:23:04+00 f...
^
invalid command \
invalid command \N
ERROR: syntax error at or near "55327"
LINE 1: 55327d+1.mp4 2024-04-09 16:39:38+00 2024-04-09 16:39:38+00 f...
^
invalid command \
ERROR: syntax error at or near "20"
LINE 1: 20d425+1.mp4 2024-05-27 16:42:33+00 2024-05-27 16:42:33+00 f...
^
invalid command \
ERROR: syntax error at or near "330"
LINE 1: 330d44+1.mp4 2024-03-28 09:49:59+00 2024-03-28 09:49:59+00 f...
^
invalid command \
ERROR: syntax error at or near "c9a91a"
LINE 1: c9a91a+1.mp4 2024-03-28 09:40:21+00 2024-03-28 09:40:21+00 f...
^
invalid command \
invalid command \.
ERROR: syntax error at or near "f3ef5f"
LINE 1: f3ef5f+1.mp4 2023-11-27 13:06:02+00 2023-11-27 13:06:02+00 f...
^
invalid command \.
ERROR: insert or update on table "asset_exif" violates foreign key constraint "asset_exif_assetId_fkey"
DETAIL: Key (assetId)=(d9717bdc-1b4f-4c9c-851a-3be9342bb3c8) is not present in table "asset".
ERROR: insert or update on table "asset_face" violates foreign key constraint "asset_face_assetId_fkey"
DETAIL: Key (assetId)=(4cb328b6-31f3-4cfd-ba8e-b2975fc40302) is not present in table "asset".
COPY 0
ERROR: insert or update on table "asset_file" violates foreign key constraint "asset_file_assetId_fkey"
DETAIL: Key (assetId)=(c7133e11-e968-43ee-ab3f-703842d30c7b) is not present in table "asset".
ERROR: insert or update on table "asset_job_status" violates foreign key constraint "asset_job_status_assetId_fkey"
DETAIL: Key (assetId)=(d9717bdc-1b4f-4c9c-851a-3be9342bb3c8) is not present in table "asset".
COPY 0
COPY 0
COPY 0
ERROR: insert or update on table "face_search" violates foreign key constraint "face_search_faceId_fkey"
DETAIL: Key (faceId)=(2a10a76a-b887-4c1d-a76f-31ad75cff80c) is not present in table "asset_face".
ERROR: duplicate key value violates unique constraint "geodata_places_pkey"
DETAIL: Key (id)=(2781727) already exists.
CONTEXT: COPY geodata_places, line 1
ERROR: duplicate key value violates unique constraint "kysely_migrations_pkey"
DETAIL: Key (name)=(1744910873969-InitialMigration) already exists.
CONTEXT: COPY kysely_migrations, line 1
ERROR: duplicate key value violates unique constraint "kysely_migrations_lock_pkey"
DETAIL: Key (id)=(migration_lock) already exists.
CONTEXT: COPY kysely_migrations_lock, line 1
ERROR: insert or update on table "library" violates foreign key constraint "library_ownerId_fkey"
DETAIL: Key (ownerId)=(991284a3-2abc-4a84-9dca-dfc49552d1ca) is not present in table "user".
ERROR: insert or update on table "memory" violates foreign key constraint "memory_ownerId_fkey"
DETAIL: Key (ownerId)=(991284a3-2abc-4a84-9dca-dfc49552d1ca) is not present in table "user".
ERROR: column "assetsId" of relation "memory_asset" does not exist
invalid command \.
ERROR: syntax error at or near "cbb590ed"
LINE 1: cbb590ed-d241-4b3b-aa42-07dd551dbbcc 43f57ff0-50be-44d4-8020...
^
invalid command \.
COPY 7
ERROR: duplicate key value violates unique constraint "migration_overrides_pkey"
DETAIL: Key (name)=(function_immich_uuid_v7) already exists.
CONTEXT: COPY migration_overrides, line 1
COPY 1
ERROR: duplicate key value violates unique constraint "naturalearth_countries_pkey"
DETAIL: Key (id)=(1) already exists.
CONTEXT: COPY naturalearth_countries, line 1
COPY 0
COPY 0
COPY 0
ERROR: insert or update on table "person" violates foreign key constraint "person_ownerId_fkey"
DETAIL: Key (ownerId)=(991284a3-2abc-4a84-9dca-dfc49552d1ca) is not present in table "user".
COPY 0
ERROR: insert or update on table "session" violates foreign key constraint "session_userId_fkey"
DETAIL: Key (userId)=(991284a3-2abc-4a84-9dca-dfc49552d1ca) is not present in table "user".
ERROR: insert or update on table "session_sync_checkpoint" violates foreign key constraint "session_sync_checkpoint_sessionId_fkey"
DETAIL: Key (sessionId)=(12adf9f6-d7b0-4f9c-bd18-59d1b10b9484) is not present in table "session".
COPY 0
ERROR: column "assetsId" of relation "shared_link_asset" does not exist
invalid command \.
ERROR: insert or update on table "smart_search" violates foreign key constraint "smart_search_assetId_fkey"
DETAIL: Key (assetId)=(354598f8-f288-450f-8a2a-46c9a0f6e677) is not present in table "asset".
COPY 0
COPY 0
ERROR: duplicate key value violates unique constraint "system_metadata_pkey"
DETAIL: Key (key)=(system-flags) already exists.
CONTEXT: COPY system_metadata, line 1
COPY 0
ERROR: column "assetsId" of relation "tag_asset" does not exist
invalid command \.
COPY 0
COPY 1
COPY 0
COPY 2
COPY 0
COPY 2
setval
--------
1
(1 row)

ERROR: relation "public.naturalearth_countries_tmp_id_seq1" does not exist
LINE 1: SELECT pg_catalog.setval('public.naturalearth_countries_tmp_...
^
ERROR: relation "UQ_entityId_pathType" already exists
ERROR: relation "UQ_newPath" already exists
ERROR: multiple primary keys for table "activity" are not allowed
ERROR: multiple primary keys for table "album_asset_audit" are not allowed
ERROR: column "albumsId" of relation "album_asset" does not exist
ERROR: multiple primary keys for table "album_audit" are not allowed
ERROR: multiple primary keys for table "album" are not allowed
ERROR: multiple primary keys for table "album_user_audit" are not allowed
ERROR: column "albumsId" of relation "album_user" does not exist
ERROR: multiple primary keys for table "api_key" are not allowed
ERROR: multiple primary keys for table "asset_audit" are not allowed
ERROR: multiple primary keys for table "asset_exif" are not allowed
ERROR: multiple primary keys for table "asset_face_audit" are not allowed
ERROR: multiple primary keys for table "asset_face" are not allowed
ERROR: relation "asset_file_assetId_type_uq" already exists
ERROR: multiple primary keys for table "asset_file" are not allowed
ERROR: multiple primary keys for table "asset_job_status" are not allowed
ERROR: multiple primary keys for table "asset_metadata_audit" are not allowed
ERROR: multiple primary keys for table "asset_metadata" are not allowed
ERROR: multiple primary keys for table "asset" are not allowed
ERROR: multiple primary keys for table "audit" are not allowed
ERROR: multiple primary keys for table "face_search" are not allowed
ERROR: multiple primary keys for table "geodata_places" are not allowed
ERROR: multiple primary keys for table "kysely_migrations_lock" are not allowed
ERROR: multiple primary keys for table "kysely_migrations" are not allowed
ERROR: multiple primary keys for table "library" are not allowed
ERROR: multiple primary keys for table "memory_asset_audit" are not allowed
ERROR: column "assetsId" of relation "memory_asset" does not exist
ERROR: multiple primary keys for table "memory_audit" are not allowed
ERROR: multiple primary keys for table "memory" are not allowed
ERROR: multiple primary keys for table "migration_overrides" are not allowed
ERROR: multiple primary keys for table "move_history" are not allowed
ERROR: multiple primary keys for table "naturalearth_countries" are not allowed
ERROR: multiple primary keys for table "notification" are not allowed
ERROR: multiple primary keys for table "partner_audit" are not allowed
ERROR: multiple primary keys for table "partner" are not allowed
ERROR: multiple primary keys for table "person_audit" are not allowed
ERROR: multiple primary keys for table "person" are not allowed
ERROR: multiple primary keys for table "session" are not allowed
ERROR: multiple primary keys for table "session_sync_checkpoint" are not allowed
ERROR: column "assetsId" of relation "shared_link_asset" does not exist
ERROR: relation "shared_link_key_uq" already exists
ERROR: multiple primary keys for table "shared_link" are not allowed
ERROR: relation "shared_link_slug_uq" already exists
ERROR: multiple primary keys for table "smart_search" are not allowed
ERROR: multiple primary keys for table "stack_audit" are not allowed
ERROR: multiple primary keys for table "stack" are not allowed
ERROR: relation "stack_primaryAssetId_uq" already exists
ERROR: multiple primary keys for table "system_metadata" are not allowed
ERROR: column "assetsId" of relation "tag_asset" does not exist
ERROR: multiple primary keys for table "tag_closure" are not allowed
ERROR: multiple primary keys for table "tag" are not allowed
ERROR: relation "tag_userId_value_uq" already exists
ERROR: multiple primary keys for table "user_audit" are not allowed
ERROR: relation "user_email_uq" already exists
ERROR: multiple primary keys for table "user_metadata_audit" are not allowed
ERROR: multiple primary keys for table "user_metadata" are not allowed
ERROR: multiple primary keys for table "user" are not allowed
ERROR: relation "user_storageLabel_uq" already exists
ERROR: multiple primary keys for table "version_history" are not allowed
ERROR: relation "IDX_geodata_gist_earthcoord" already exists
ERROR: relation "IDX_user_metadata_audit_deleted_at" already exists
ERROR: relation "IDX_user_metadata_audit_key" already exists
ERROR: relation "IDX_user_metadata_audit_user_id" already exists
ERROR: relation "IDX_user_metadata_update_id" already exists
ERROR: relation "IDX_user_metadata_updated_at" already exists
ERROR: relation "UQ_assets_owner_checksum" already exists
ERROR: relation "activity_albumId_assetId_idx" already exists
ERROR: relation "activity_albumId_idx" already exists
ERROR: relation "activity_assetId_idx" already exists
ERROR: relation "activity_like_idx" already exists
ERROR: relation "activity_updateId_idx" already exists
ERROR: relation "activity_userId_idx" already exists
ERROR: relation "album_albumThumbnailAssetId_idx" already exists
ERROR: column "albumsId" does not exist
ERROR: column "assetsId" does not exist
ERROR: relation "album_asset_audit_albumId_idx" already exists
ERROR: relation "album_asset_audit_assetId_idx" already exists
ERROR: relation "album_asset_audit_deletedAt_idx" already exists
ERROR: relation "album_asset_updateId_idx" already exists
ERROR: relation "album_audit_albumId_idx" already exists
ERROR: relation "album_audit_deletedAt_idx" already exists
ERROR: relation "album_audit_userId_idx" already exists
ERROR: relation "album_ownerId_idx" already exists
ERROR: relation "album_updateId_idx" already exists
ERROR: column "albumsId" does not exist
ERROR: relation "album_user_audit_albumId_idx" already exists
ERROR: relation "album_user_audit_deletedAt_idx" already exists
ERROR: relation "album_user_audit_userId_idx" already exists
ERROR: relation "album_user_createId_idx" already exists
ERROR: relation "album_user_updateId_idx" already exists
ERROR: column "usersId" does not exist
ERROR: relation "api_key_updateId_idx" already exists
ERROR: relation "api_key_userId_idx" already exists
ERROR: relation "asset_audit_assetId_idx" already exists
ERROR: relation "asset_audit_deletedAt_idx" already exists
ERROR: relation "asset_audit_ownerId_idx" already exists
ERROR: relation "asset_checksum_idx" already exists
ERROR: relation "asset_duplicateId_idx" already exists
ERROR: relation "asset_exif_autoStackId_idx" already exists
ERROR: relation "asset_exif_city_idx" already exists
ERROR: relation "asset_exif_livePhotoCID_idx" already exists
ERROR: relation "asset_exif_updateId_idx" already exists
ERROR: relation "asset_face_assetId_personId_idx" already exists
ERROR: relation "asset_face_audit_assetFaceId_idx" already exists
ERROR: relation "asset_face_audit_assetId_idx" already exists
ERROR: relation "asset_face_audit_deletedAt_idx" already exists
ERROR: relation "asset_face_personId_assetId_idx" already exists
ERROR: relation "asset_fileCreatedAt_idx" already exists
ERROR: relation "asset_file_assetId_idx" already exists
ERROR: relation "asset_file_updateId_idx" already exists
ERROR: relation "asset_id_stackId_idx" already exists
ERROR: relation "asset_libraryId_idx" already exists
ERROR: relation "asset_livePhotoVideoId_idx" already exists
ERROR: relation "asset_localDateTime_idx" already exists
ERROR: relation "asset_localDateTime_month_idx" already exists
ERROR: relation "asset_metadata_audit_assetId_idx" already exists
ERROR: relation "asset_metadata_audit_deletedAt_idx" already exists
ERROR: relation "asset_metadata_audit_key_idx" already exists
ERROR: relation "asset_metadata_updateId_idx" already exists
ERROR: relation "asset_metadata_updatedAt_idx" already exists
ERROR: relation "asset_originalFileName_idx" already exists
ERROR: relation "asset_originalFilename_trigram_idx" already exists
ERROR: relation "asset_originalPath_libraryId_idx" already exists
ERROR: relation "asset_ownerId_idx" already exists
ERROR: relation "asset_ownerId_libraryId_checksum_idx" already exists
ERROR: relation "asset_stackId_idx" already exists
ERROR: relation "asset_updateId_idx" already exists
ERROR: relation "audit_ownerId_createdAt_idx" already exists
ERROR: relation "clip_index" already exists
ERROR: relation "face_index" already exists
ERROR: relation "idx_geodata_places_admin1_name" already exists
ERROR: relation "idx_geodata_places_admin2_name" already exists
ERROR: relation "idx_geodata_places_alternate_names" already exists
ERROR: relation "idx_geodata_places_name" already exists
ERROR: relation "library_ownerId_idx" already exists
ERROR: relation "library_updateId_idx" already exists
ERROR: column "assetsId" does not exist
ERROR: relation "memory_asset_audit_assetId_idx" already exists
ERROR: relation "memory_asset_audit_deletedAt_idx" already exists
ERROR: relation "memory_asset_audit_memoryId_idx" already exists
ERROR: relation "memory_asset_memoriesId_idx" already exists
ERROR: relation "memory_asset_updateId_idx" already exists
ERROR: relation "memory_audit_deletedAt_idx" already exists
ERROR: relation "memory_audit_memoryId_idx" already exists
ERROR: relation "memory_audit_userId_idx" already exists
ERROR: relation "memory_ownerId_idx" already exists
ERROR: relation "memory_updateId_idx" already exists
ERROR: relation "notification_updateId_idx" already exists
ERROR: relation "notification_userId_idx" already exists
ERROR: relation "partner_audit_deletedAt_idx" already exists
ERROR: relation "partner_audit_sharedById_idx" already exists
ERROR: relation "partner_audit_sharedWithId_idx" already exists
ERROR: relation "partner_createId_idx" already exists
ERROR: relation "partner_sharedWithId_idx" already exists
ERROR: relation "partner_updateId_idx" already exists
ERROR: relation "person_audit_deletedAt_idx" already exists
ERROR: relation "person_audit_ownerId_idx" already exists
ERROR: relation "person_audit_personId_idx" already exists
ERROR: relation "person_faceAssetId_idx" already exists
ERROR: relation "person_ownerId_idx" already exists
ERROR: relation "person_updateId_idx" already exists
ERROR: relation "session_parentId_idx" already exists
ERROR: relation "session_sync_checkpoint_sessionId_idx" already exists
ERROR: relation "session_sync_checkpoint_updateId_idx" already exists
ERROR: relation "session_updateId_idx" already exists
ERROR: relation "session_userId_idx" already exists
ERROR: relation "shared_link_albumId_idx" already exists
ERROR: column "assetsId" does not exist
ERROR: column "sharedLinksId" does not exist
ERROR: relation "shared_link_key_idx" already exists
ERROR: relation "shared_link_userId_idx" already exists
ERROR: relation "stack_audit_deletedAt_idx" already exists
ERROR: relation "stack_ownerId_idx" already exists
ERROR: relation "stack_primaryAssetId_idx" already exists
ERROR: column "assetsId" does not exist
ERROR: column "assetsId" does not exist
ERROR: column "tagsId" does not exist
ERROR: relation "tag_closure_id_ancestor_idx" already exists
ERROR: relation "tag_closure_id_descendant_idx" already exists
ERROR: relation "tag_parentId_idx" already exists
ERROR: relation "tag_updateId_idx" already exists
ERROR: relation "user_audit_deletedAt_idx" already exists
ERROR: relation "user_updateId_idx" already exists
ERROR: relation "user_updatedAt_id_idx" already exists
ERROR: trigger "activity_updatedAt" for relation "activity" already exists
ERROR: trigger "album_asset_delete_audit" for relation "album_asset" already exists
ERROR: trigger "album_asset_updatedAt" for relation "album_asset" already exists
ERROR: trigger "album_delete_audit" for relation "album" already exists
ERROR: trigger "album_updatedAt" for relation "album" already exists
ERROR: trigger "album_user_after_insert" for relation "album_user" already exists
ERROR: trigger "album_user_delete_audit" for relation "album_user" already exists
ERROR: trigger "album_user_updatedAt" for relation "album_user" already exists
ERROR: trigger "api_key_updatedAt" for relation "api_key" already exists
ERROR: trigger "asset_delete_audit" for relation "asset" already exists
ERROR: trigger "asset_exif_updatedAt" for relation "asset_exif" already exists
ERROR: trigger "asset_face_audit" for relation "asset_face" already exists
ERROR: trigger "asset_face_updatedAt" for relation "asset_face" already exists
ERROR: trigger "asset_file_updatedAt" for relation "asset_file" already exists
ERROR: trigger "asset_metadata_audit" for relation "asset_metadata" already exists
ERROR: trigger "asset_metadata_updated_at" for relation "asset_metadata" already exists
ERROR: trigger "asset_updatedAt" for relation "asset" already exists
ERROR: trigger "library_updatedAt" for relation "library" already exists
ERROR: trigger "memory_asset_delete_audit" for relation "memory_asset" already exists
ERROR: trigger "memory_asset_updatedAt" for relation "memory_asset" already exists
ERROR: trigger "memory_delete_audit" for relation "memory" already exists
ERROR: trigger "memory_updatedAt" for relation "memory" already exists
ERROR: trigger "notification_updatedAt" for relation "notification" already exists
ERROR: trigger "partner_delete_audit" for relation "partner" already exists
ERROR: trigger "partner_updatedAt" for relation "partner" already exists
ERROR: trigger "person_delete_audit" for relation "person" already exists
ERROR: trigger "person_updatedAt" for relation "person" already exists
ERROR: trigger "session_sync_checkpoint_updatedAt" for relation "session_sync_checkpoint" already exists
ERROR: trigger "session_updatedAt" for relation "session" already exists
ERROR: trigger "stack_delete_audit" for relation "stack" already exists
ERROR: trigger "stack_updatedAt" for relation "stack" already exists
ERROR: trigger "tag_updatedAt" for relation "tag" already exists
ERROR: trigger "user_delete_audit" for relation "user" already exists
ERROR: trigger "user_metadata_audit" for relation "user_metadata" already exists
ERROR: trigger "user_metadata_updated_at" for relation "user_metadata" already exists
ERROR: trigger "user_updatedAt" for relation "user" already exists
ERROR: constraint "activity_albumId_assetId_fkey" for relation "activity" already exists
ERROR: constraint "activity_albumId_fkey" for relation "activity" already exists
ERROR: constraint "activity_assetId_fkey" for relation "activity" already exists
ERROR: constraint "activity_userId_fkey" for relation "activity" already exists
ERROR: constraint "album_albumThumbnailAssetId_fkey" for relation "album" already exists
ERROR: column "albumsId" referenced in foreign key constraint does not exist
ERROR: column "assetsId" referenced in foreign key constraint does not exist
ERROR: constraint "album_asset_audit_albumId_fkey" for relation "album_asset_audit" already exists
ERROR: constraint "album_ownerId_fkey" for relation "album" already exists
ERROR: column "albumsId" referenced in foreign key constraint does not exist
ERROR: column "usersId" referenced in foreign key constraint does not exist
ERROR: constraint "api_key_userId_fkey" for relation "api_key" already exists
ERROR: constraint "asset_exif_assetId_fkey" for relation "asset_exif" already exists
ERROR: constraint "asset_face_assetId_fkey" for relation "asset_face" already exists
ERROR: constraint "asset_face_personId_fkey" for relation "asset_face" already exists
ERROR: constraint "asset_file_assetId_fkey" for relation "asset_file" already exists
ERROR: constraint "asset_job_status_assetId_fkey" for relation "asset_job_status" already exists
ERROR: constraint "asset_libraryId_fkey" for relation "asset" already exists
ERROR: constraint "asset_livePhotoVideoId_fkey" for relation "asset" already exists
ERROR: constraint "asset_metadata_assetId_fkey" for relation "asset_metadata" already exists
ERROR: constraint "asset_ownerId_fkey" for relation "asset" already exists
ERROR: constraint "asset_stackId_fkey" for relation "asset" already exists
ERROR: constraint "face_search_faceId_fkey" for relation "face_search" already exists
ERROR: constraint "library_ownerId_fkey" for relation "library" already exists
ERROR: column "assetsId" referenced in foreign key constraint does not exist
ERROR: constraint "memory_asset_audit_memoryId_fkey" for relation "memory_asset_audit" already exists
ERROR: constraint "memory_asset_memoriesId_fkey" for relation "memory_asset" already exists
ERROR: constraint "memory_ownerId_fkey" for relation "memory" already exists
ERROR: constraint "notification_userId_fkey" for relation "notification" already exists
ERROR: constraint "partner_sharedById_fkey" for relation "partner" already exists
ERROR: constraint "partner_sharedWithId_fkey" for relation "partner" already exists
ERROR: constraint "person_faceAssetId_fkey" for relation "person" already exists
ERROR: constraint "person_ownerId_fkey" for relation "person" already exists
ERROR: constraint "session_parentId_fkey" for relation "session" already exists
ERROR: constraint "session_sync_checkpoint_sessionId_fkey" for relation "session_sync_checkpoint" already exists
ERROR: constraint "session_userId_fkey" for relation "session" already exists
ERROR: constraint "shared_link_albumId_fkey" for relation "shared_link" already exists
ERROR: column "assetsId" referenced in foreign key constraint does not exist
ERROR: column "sharedLinksId" referenced in foreign key constraint does not exist
ERROR: constraint "shared_link_userId_fkey" for relation "shared_link" already exists
ERROR: constraint "smart_search_assetId_fkey" for relation "smart_search" already exists
ERROR: constraint "stack_ownerId_fkey" for relation "stack" already exists
ERROR: constraint "stack_primaryAssetId_fkey" for relation "stack" already exists
ERROR: column "assetsId" referenced in foreign key constraint does not exist
ERROR: column "tagsId" referenced in foreign key constraint does not exist
ERROR: constraint "tag_closure_id_ancestor_fkey" for relation "tag_closure" already exists
ERROR: constraint "tag_closure_id_descendant_fkey" for relation "tag_closure" already exists
ERROR: constraint "tag_parentId_fkey" for relation "tag" already exists
ERROR: constraint "tag_userId_fkey" for relation "tag" already exists
ERROR: constraint "user_metadata_userId_fkey" for relation "user_metadata" already exists
invalid command \unrestrict
invalid command \restrict
SET
SET
SET
SET
SET
set_config
------------

(1 row)

SET
SET
SET
SET
DROP DATABASE
CREATE DATABASE
ALTER DATABASE
invalid command \unrestrict
invalid command \restrict
You are now connected to database "postgres" as user "postgres".
SET
SET
SET
SET
SET
set_config
------------

(1 row)

SET
SET
SET
SET
invalid command \unrestrict
COMMENT
root@immich:/mnt/all/picture/immich/immich-app# docker exec -it immich_postgres psql -U postgres -d immich -c "UPDATE asset SET \"originalPath\" = regexp_replace(\"originalPath\", 'library/[^/]+/', 'library/admin/');"
UPDATE 0
root@immich:/mnt/all/picture/immich/immich-app# docker exec -it immich_postgres psql -U postgres -d immich -c "SELECT id, email, name FROM \"user\";"
id | email | name
--------------------------------------+---------------+------
991284a3-2abc-4a84-9dca-dfc49552d1ca | ucu520@qq.com | ucu
(1 row)

root@immich:/mnt/all/picture/immich/immich-app# docker exec -it immich_postgres psql -U postgres -d immich -c "SELECT count(*) FROM asset;"
count
-------
0
(1 row)

root@immich:/mnt/all/picture/immich/immich-app# docker exec -it immich_postgres psql -U postgres -d immich -c "SELECT \"originalPath\" FROM asset LIMIT 5;"
originalPath
--------------
(0 rows)

root@immich:/mnt/all/picture/immich/immich-app# docker exec -it immich_postgres psql -U postgres -d immich -c "SELECT count(*) FROM asset;"
count
-------
0
(1 row)

root@immich:/mnt/all/picture/immich/immich-app# docker compose stop immich-server immich-machine-learning
[+] Stopping 2/2
✔ Container immich_machine_learning Stopped 2.2s
✔ Container immich_server Stopped 2.2s
root@immich:/mnt/all/picture/immich/immich-app# docker exec -it immich_postgres psql -U postgres -c "DROP DATABASE IF EXISTS immich;"
DROP DATABASE
root@immich:/mnt/all/picture/immich/immich-app# du -sh /opt/immich_data
217M /opt/immich_data
root@immich:/mnt/all/picture/immich/immich-app# docker exec -it immich_postgres psql -U postgres -c "CREATE DATABASE immich;"
CREATE DATABASE
root@immich:/mnt/all/picture/immich/immich-app# cat /opt/immich-recovery/dec_backup.sql | docker exec -i immich_postgres psql -U postgres -d immich
invalid command \restrict
SET
SET
SET
ERROR: cannot drop the currently open database
ERROR: current user cannot be dropped
ERROR: role "postgres" already exists
ALTER ROLE
invalid command \unrestrict
invalid command \restrict
SET
SET
SET
SET
SET
set_config
------------

(1 row)

SET
SET
SET
SET
UPDATE 1
DROP DATABASE
CREATE DATABASE
ALTER DATABASE
invalid command \unrestrict
invalid command \restrict
You are now connected to database "template1" as user "postgres".
SET
SET
SET
SET
SET
set_config
------------

(1 row)

SET
SET
SET
SET
COMMENT
ALTER DATABASE
invalid command \unrestrict
invalid command \restrict
You are now connected to database "template1" as user "postgres".
SET
SET
SET
SET
SET
set_config
------------

(1 row)

SET
SET
SET
SET
REVOKE
GRANT
invalid command \unrestrict
invalid command \restrict
SET
SET
SET
SET
SET
set_config
------------

(1 row)

SET
SET
SET
SET
ERROR: database "immich" already exists
invalid command \unrestrict
ALTER DATABASE
invalid command \restrict
You are now connected to database "immich" as user "postgres".
SET
SET
SET
SET
SET
set_config
------------

(1 row)

SET
SET
SET
SET
ALTER DATABASE
ALTER DATABASE
invalid command \unrestrict
You are now connected to database "immich" as user "postgres".
invalid command \restrict
SET
SET
SET
SET
SET
set_config
------------

(1 row)

SET
CREATE TYPE
ALTER TYPE
CREATE TYPE
ALTER TYPE
CREATE TYPE
ALTER TYPE
CREATE FUNCTION
ALTER FUNCTION
SET
SET
CREATE TABLE
ALTER TABLE
CREATE TABLE
ALTER TABLE
COMMENT
ALTER TABLE
CREATE TABLE
ALTER TABLE
ALTER TABLE
COPY 0
COPY 289
COPY 4447
COPY 0
COPY 0
COPY 0
COPY 0
COPY 0
COPY 14970
COPY 0
COPY 14970
COPY 2090
COPY 0
COPY 26236
COPY 14969
COPY 0
COPY 0
COPY 0
COPY 2090
COPY 218655
COPY 35
COPY 1
COPY 1
COPY 7
COPY 43
COPY 0
COPY 7
COPY 67
COPY 1
COPY 4274
COPY 0
COPY 0
COPY 0
COPY 124
COPY 0
COPY 7
COPY 59
COPY 0
COPY 0
COPY 11368
COPY 0
COPY 0
COPY 8
COPY 0
COPY 0
COPY 0
COPY 1
COPY 0
COPY 2
COPY 0
COPY 2
setval
--------
1
(1 row)

setval
--------
4274
(1 row)

ALTER TABLE
ALTER TABLE
CREATE INDEX
CREATE INDEX
CREATE TRIGGER
CREATE TRIGGER
ALTER TABLE
ALTER TABLE
invalid command \unrestrict
invalid command \restrict
SET
SET
SET
SET
SET
set_config
------------

(1 row)

SET
SET
SET
SET
DROP DATABASE
CREATE DATABASE
ALTER DATABASE
invalid command \unrestrict
You are now connected to database "postgres" as user "postgres".
invalid command \restrict
SET
SET
SET
SET
SET
set_config
------------

(1 row)

SET
SET
SET
SET
COMMENT
invalid command \unrestrict
root@immich:/mnt/all/picture/immich/immich-app# docker exec -it immich_postgres psql -U postgres -d immich -c "UPDATE asset SET \"originalPath\" = regexp_replace(\"originalPath\", 'library/[^/]+/', 'library/admin/');"
UPDATE 14970
root@immich:/mnt/all/picture/immich/immich-app# docker exec -it immich_postgres psql -U postgres -d immich -c "SELECT count(*) FROM asset;"
count
-------
14970
(1 row)

root@immich:/mnt/all/picture/immich/immich-app# du -sh /opt/immich_data
217M /opt/immich_data
root@immich:/mnt/all/picture/immich/immich-app# docker compose up -d
[+] Running 4/4
✔ Container immich_postgres Running 0.0s
✔ Container immich_redis Running 0.0s
✔ Container immich_machine_learning Started 3.1s
✔ Container immich_server Started 3.7s