mirror of
https://github.com/penpot/penpot.git
synced 2026-05-03 15:18:59 +00:00
Merge pull request #5932 from penpot/niwinz-objects-gc-bugfix
✨ Remove automatic cascade on file_change table fk constraint
This commit is contained in:
commit
9896275fa8
@ -435,7 +435,10 @@
|
||||
:fn (mg/resource "app/migrations/sql/0137-add-file-migration-table.sql")}
|
||||
|
||||
{:name "0138-mod-file-data-fragment-table.sql"
|
||||
:fn (mg/resource "app/migrations/sql/0138-mod-file-data-fragment-table.sql")}])
|
||||
:fn (mg/resource "app/migrations/sql/0138-mod-file-data-fragment-table.sql")}
|
||||
|
||||
{:name "0139-mod-file-change-table.sql"
|
||||
:fn (mg/resource "app/migrations/sql/0139-mod-file-change-table.sql")}])
|
||||
|
||||
(defn apply-migrations!
|
||||
[pool name migrations]
|
||||
|
||||
@ -0,0 +1,5 @@
|
||||
ALTER TABLE file_change
|
||||
DROP CONSTRAINT file_change_file_id_fkey,
|
||||
DROP CONSTRAINT file_change_profile_id_fkey,
|
||||
ADD FOREIGN KEY (file_id) REFERENCES file(id) DEFERRABLE,
|
||||
ADD FOREIGN KEY (profile_id) REFERENCES profile(id) ON DELETE SET NULL DEFERRABLE;
|
||||
@ -40,6 +40,11 @@
|
||||
:file-id id
|
||||
:cause cause))))
|
||||
|
||||
;; Mark file change to be deleted
|
||||
(db/update! conn :file-change
|
||||
{:deleted-at deleted-at}
|
||||
{:file-id id})
|
||||
|
||||
;; Mark file media objects to be deleted
|
||||
(db/update! conn :file-media-object
|
||||
{:deleted-at deleted-at}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user