teableio/teable

View on GitHub
packages/db-main-prisma/prisma/postgres/migrations/20241008161823_share_meta/migration.sql

Summary

Maintainability
Test Coverage
BEGIN;
-- update share meta for all views

UPDATE view
SET share_meta = COALESCE(
    jsonb_set(share_meta::jsonb, '{includeRecords}', 'true'::jsonb),
    '{"includeRecords": true}'::jsonb
)
WHERE (type = 'grid' OR type = 'kanban')
AND share_id IS NOT NULL;

UPDATE view
SET share_meta = COALESCE(
    jsonb_set(share_meta::jsonb, '{submit}', '{"allow": true}'::jsonb),
    '{"submit": {"allow": true}}'::jsonb
)
WHERE type = 'form'
AND share_id IS NOT NULL;

COMMIT;