- 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
83 lines
1.8 KiB
SQL
83 lines
1.8 KiB
SQL
-- Test comprehensive AI moderation for all content types
|
|
-- Clear existing test data
|
|
DELETE FROM moderation_flags WHERE flag_reason IN ('test_text', 'test_image', 'test_video', 'test_comment');
|
|
|
|
-- Test 1: Text-only post moderation
|
|
INSERT INTO moderation_flags (
|
|
post_id,
|
|
flag_reason,
|
|
scores,
|
|
status,
|
|
created_at
|
|
) VALUES (
|
|
gen_random_uuid(),
|
|
'test_text',
|
|
'{"hate": 0.7, "greed": 0.2, "delusion": 0.1}',
|
|
'pending',
|
|
NOW()
|
|
);
|
|
|
|
-- Test 2: Image content moderation
|
|
INSERT INTO moderation_flags (
|
|
post_id,
|
|
flag_reason,
|
|
scores,
|
|
status,
|
|
created_at
|
|
) VALUES (
|
|
gen_random_uuid(),
|
|
'test_image',
|
|
'{"hate": 0.3, "greed": 0.6, "delusion": 0.2}',
|
|
'pending',
|
|
NOW()
|
|
);
|
|
|
|
-- Test 3: Video content moderation
|
|
INSERT INTO moderation_flags (
|
|
post_id,
|
|
flag_reason,
|
|
scores,
|
|
status,
|
|
created_at
|
|
) VALUES (
|
|
gen_random_uuid(),
|
|
'test_video',
|
|
'{"hate": 0.4, "greed": 0.3, "delusion": 0.5}',
|
|
'pending',
|
|
NOW()
|
|
);
|
|
|
|
-- Test 4: Comment moderation
|
|
INSERT INTO moderation_flags (
|
|
comment_id,
|
|
flag_reason,
|
|
scores,
|
|
status,
|
|
created_at
|
|
) VALUES (
|
|
gen_random_uuid(),
|
|
'test_comment',
|
|
'{"hate": 0.8, "greed": 0.1, "delusion": 0.3}',
|
|
'pending',
|
|
NOW()
|
|
);
|
|
|
|
-- Verify all test flags were created
|
|
SELECT 'Comprehensive Moderation Test Results:' as info;
|
|
SELECT
|
|
flag_reason,
|
|
CASE
|
|
WHEN post_id IS NOT NULL AND comment_id IS NULL THEN 'Post'
|
|
WHEN comment_id IS NOT NULL AND post_id IS NULL THEN 'Comment'
|
|
ELSE 'Unknown'
|
|
END as content_type,
|
|
status,
|
|
scores,
|
|
created_at
|
|
FROM moderation_flags
|
|
WHERE flag_reason IN ('test_text', 'test_image', 'test_video', 'test_comment')
|
|
ORDER BY created_at;
|
|
|
|
SELECT 'Total flags in system:' as info;
|
|
SELECT COUNT(*) as total_flags FROM moderation_flags;
|