mirror of
https://github.com/penpot/penpot.git
synced 2025-05-14 01:17:13 +02:00
✨ Add an internal approach to prevent xlog gc to remove file changes
This commit is contained in:
parent
804addfa66
commit
1190cf837b
3 changed files with 14 additions and 1 deletions
|
@ -324,6 +324,9 @@
|
||||||
{:name "0104-mod-file-thumbnail-table"
|
{:name "0104-mod-file-thumbnail-table"
|
||||||
:fn (mg/resource "app/migrations/sql/0104-mod-file-thumbnail-table.sql")}
|
:fn (mg/resource "app/migrations/sql/0104-mod-file-thumbnail-table.sql")}
|
||||||
|
|
||||||
|
{:name "0105-mod-file-change-table"
|
||||||
|
:fn (mg/resource "app/migrations/sql/0105-mod-file-change-table.sql")}
|
||||||
|
|
||||||
])
|
])
|
||||||
|
|
||||||
(defn apply-migrations!
|
(defn apply-migrations!
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
ALTER TABLE file_change
|
||||||
|
ADD COLUMN label text NULL;
|
||||||
|
|
||||||
|
ALTER TABLE file_change
|
||||||
|
ALTER COLUMN label SET STORAGE external;
|
||||||
|
|
||||||
|
CREATE INDEX file_change__label__idx
|
||||||
|
ON file_change (file_id, label)
|
||||||
|
WHERE label is not null;
|
|
@ -17,7 +17,8 @@
|
||||||
(def ^:private
|
(def ^:private
|
||||||
sql:delete-files-xlog
|
sql:delete-files-xlog
|
||||||
"delete from file_change
|
"delete from file_change
|
||||||
where created_at < now() - ?::interval")
|
where created_at < now() - ?::interval
|
||||||
|
and label is NULL")
|
||||||
|
|
||||||
(defmethod ig/pre-init-spec ::handler [_]
|
(defmethod ig/pre-init-spec ::handler [_]
|
||||||
(s/keys :req [::db/pool]))
|
(s/keys :req [::db/pool]))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue