sojorn/migrations/archive/setup_cms.sql
Patrick Britton 0bb1dd4055 feat: organize SQL scripts into structured migration folders
- Create organized migration folder structure:
  - database/ - Core schema changes and migrations
  - tests/ - Test scripts and verification queries
  - directus/ - Directus CMS configuration scripts
  - fixes/ - Database fixes and patches
  - archive/ - Historical and deprecated scripts

- Move 60+ SQL files from root to appropriate folders
- Add comprehensive README with usage guidelines
- Consolidate old migrations_archive into new archive folder
- Maintain clear separation of concerns for different script types

Benefits:
- Cleaner project root directory
- Easier to find specific types of SQL scripts
- Better organization for maintenance and development
- Clear documentation for migration procedures
- Proper separation of production vs development scripts
2026-02-05 09:13:47 -06:00

17 lines
1.5 KiB
SQL

-- Enable public collections in Directus by adding them to directus_collections
INSERT INTO directus_collections (collection, icon, note, display_template, hidden, singleton, translations, archive_field, archive_app_filter, archive_value, unarchive_value, sort_field, accountability)
VALUES
('profiles', 'account_circle', 'User Profiles', '{{handle}}', false, false, NULL, NULL, true, NULL, NULL, 'created_at', 'all'),
('posts', 'post_add', 'User Posts', '{{body}}', false, false, NULL, 'status', true, 'archived', 'active', 'created_at', 'all'),
('categories', 'category', 'Content Categories', '{{name}}', false, false, NULL, NULL, true, NULL, NULL, 'name', 'all'),
('comments', 'comment', 'Post Comments', '{{body}}', false, false, NULL, 'status', true, 'archived', 'active', 'created_at', 'all'),
('trust_state', 'verified', 'User Trust Scores', '{{harmony_score}}', false, false, NULL, NULL, true, NULL, NULL, NULL, 'all'),
('post_metrics', 'analytics', 'Post Analytics', '{{like_count}} likes', false, false, NULL, NULL, true, NULL, NULL, NULL, 'all'),
('users', 'lock', 'Auth Users', '{{email}}', false, false, NULL, NULL, true, NULL, NULL, 'created_at', 'all')
ON CONFLICT (collection) DO UPDATE
SET icon = EXCLUDED.icon, note = EXCLUDED.note, display_template = EXCLUDED.display_template;
-- Optional: Configure Display Fields (This is usually roughly done by Directus introspection but explicit fields help)
-- We won't inject into directus_fields blindly as that is complex, but the collections are the main step.