- 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
65 lines
1.4 KiB
SQL
65 lines
1.4 KiB
SQL
-- Fix Directus UI collection registration
|
|
-- First, let's see what's currently in directus_collections
|
|
SELECT 'Current collections in Directus:' as info;
|
|
SELECT collection, icon, note, hidden FROM directus_collections ORDER BY collection;
|
|
|
|
-- Remove any existing entries to avoid conflicts
|
|
DELETE FROM directus_collections WHERE collection IN ('moderation_flags', 'user_status_history');
|
|
|
|
-- Re-add with complete required fields
|
|
INSERT INTO directus_collections (
|
|
collection,
|
|
icon,
|
|
note,
|
|
hidden,
|
|
singleton,
|
|
translations,
|
|
archive_field,
|
|
archive_value,
|
|
unarchive_field,
|
|
unarchive_value,
|
|
sort_field,
|
|
accountability,
|
|
item_duplication_field,
|
|
preview_url,
|
|
display_template
|
|
) VALUES
|
|
(
|
|
'moderation_flags',
|
|
'flag',
|
|
'AI-powered content moderation flags for managing toxic content',
|
|
false,
|
|
false,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL
|
|
),
|
|
(
|
|
'user_status_history',
|
|
'history',
|
|
'User status change history for audit trail',
|
|
false,
|
|
false,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL,
|
|
NULL
|
|
);
|
|
|
|
-- Verify the collections were added
|
|
SELECT 'Updated collections:' as info;
|
|
SELECT collection, icon, note, hidden FROM directus_collections WHERE collection IN ('moderation_flags', 'user_status_history');
|