Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Add Photos and Locker file count state

Neeraj Gupta00b1f7c430da
diff --git a/server/migrations/133_file_counts.down.sql b/server/migrations/133_file_counts.down.sql
new file mode 100644
index 0000000000..f6e4e5aeb7
--- /dev/null
+++ b/server/migrations/133_file_counts.down.sql
@@ -0,0 +1,9 @@
+SET lock_timeout = '5s';
+
+ALTER TABLE usage
+ DROP CONSTRAINT usage_file_counts_both_ready_or_both_unknown,
+ DROP COLUMN file_count_source_version,
+ DROP COLUMN locker_file_count,
+ DROP COLUMN photos_file_count;
+
+RESET lock_timeout;
diff --git a/server/migrations/133_file_counts.up.sql b/server/migrations/133_file_counts.up.sql
new file mode 100644
index 0000000000..87fb076c28
--- /dev/null
+++ b/server/migrations/133_file_counts.up.sql
@@ -0,0 +1,11 @@
+SET lock_timeout = '5s';
+
+ALTER TABLE usage
+ ADD COLUMN photos_file_count BIGINT,
+ ADD COLUMN locker_file_count BIGINT,
+ ADD COLUMN file_count_source_version BIGINT NOT NULL DEFAULT 0,
+ ADD CONSTRAINT usage_file_counts_both_ready_or_both_unknown
+ CHECK ((photos_file_count IS NULL) = (locker_file_count IS NULL))
+ NOT VALID;
+
+RESET lock_timeout;