mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
add data migration script
This commit is contained in:
parent
6361759eef
commit
ffed903bb9
2 changed files with 25 additions and 0 deletions
18
packages/db/migrations/0171.do.migrate_webhooks_and_exporter.sql
Executable file
18
packages/db/migrations/0171.do.migrate_webhooks_and_exporter.sql
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
-- Type: DO
|
||||
-- Name: migrate_webhooks_and_exporter
|
||||
-- Description: Migrate data from webhooks and exporters to rules
|
||||
|
||||
BEGIN;
|
||||
|
||||
-- Migrate webhooks to rules
|
||||
INSERT INTO omnivore.rules (user_id, name, filter, actions, enabled, created_at, updated_at, event_types)
|
||||
SELECT user_id, 'webhook', 'in:all', jsonb_build_array(jsonb_build_object('type', 'WEBHOOK', 'params', jsonb_build_array(url))), enabled, created_at, updated_at, event_types
|
||||
FROM omnivore.webhooks;
|
||||
|
||||
-- Migrate exporters to rules
|
||||
INSERT INTO omnivore.rules (user_id, name, filter, actions, enabled, created_at, updated_at, event_types)
|
||||
SELECT user_id, 'export', 'in:all', jsonb_build_array(jsonb_build_object('type', 'EXPORT', 'params', jsonb_build_array(name))), enabled, created_at, updated_at, '{PAGE_CREATED,PAGE_UPDATED,HIGHLIGHT_CREATED,LABEL_CREATED}'
|
||||
FROM omnivore.integrations
|
||||
WHERE type = 'EXPORT';
|
||||
|
||||
COMMIT;
|
||||
7
packages/db/migrations/0171.undo.migrate_webhooks_and_exporter.sql
Executable file
7
packages/db/migrations/0171.undo.migrate_webhooks_and_exporter.sql
Executable file
|
|
@ -0,0 +1,7 @@
|
|||
-- Type: UNDO
|
||||
-- Name: migrate_webhooks_and_exporter
|
||||
-- Description: Migrate data from webhooks and exporters to rules
|
||||
|
||||
BEGIN;
|
||||
|
||||
COMMIT;
|
||||
Loading…
Reference in a new issue