Merge pull request #3488 from omnivore-app/drop-db-triggers
fix: drop db triggers which updates labels and highlights in library_item table for locking the table
This commit is contained in:
11
packages/db/migrations/0160.do.drop_slow_db_triggers.sql
Executable file
11
packages/db/migrations/0160.do.drop_slow_db_triggers.sql
Executable file
@ -0,0 +1,11 @@
|
||||
-- Type: DO
|
||||
-- Name: drop_slow_db_triggers
|
||||
-- Description: Drop some db triggers which are slow and have cascading effect
|
||||
|
||||
BEGIN;
|
||||
|
||||
DROP TRIGGER IF EXISTS library_item_labels_update ON omnivore.entity_labels;
|
||||
DROP TRIGGER IF EXISTS library_item_highlight_annotations_update ON omnivore.highlight;
|
||||
DROP TRIGGER IF EXISTS label_names_update ON omnivore.labels;
|
||||
|
||||
COMMIT;
|
||||
23
packages/db/migrations/0160.undo.drop_slow_db_triggers.sql
Executable file
23
packages/db/migrations/0160.undo.drop_slow_db_triggers.sql
Executable file
@ -0,0 +1,23 @@
|
||||
-- Type: UNDO
|
||||
-- Name: drop_slow_db_triggers
|
||||
-- Description: Drop some db triggers which are slow and have cascading effect
|
||||
|
||||
BEGIN;
|
||||
|
||||
CREATE TRIGGER label_names_update
|
||||
AFTER UPDATE ON omnivore.labels
|
||||
FOR EACH ROW
|
||||
WHEN (OLD.name <> NEW.name)
|
||||
EXECUTE FUNCTION update_label_names();
|
||||
|
||||
CREATE TRIGGER library_item_highlight_annotations_update
|
||||
AFTER INSERT OR UPDATE OR DELETE ON omnivore.highlight
|
||||
FOR EACH ROW
|
||||
EXECUTE FUNCTION update_library_item_highlight_annotations();
|
||||
|
||||
CREATE TRIGGER library_item_labels_update
|
||||
AFTER INSERT OR UPDATE OR DELETE ON omnivore.entity_labels
|
||||
FOR EACH ROW
|
||||
EXECUTE FUNCTION update_library_item_labels();
|
||||
|
||||
COMMIT;
|
||||
Reference in New Issue
Block a user