botserver/migrations/20250727000001_add_social_tables/down.sql
Rodrigo Rodriguez (Pragmatismo) a886478548 Implement database persistence for dashboards, legal, and compliance modules
- Add PostgreSQL persistence for dashboards module (was returning empty vec![])
  - Tables: dashboards, dashboard_widgets, dashboard_data_sources, dashboard_filters,
    dashboard_widget_data_sources, conversational_queries
  - Full CRUD operations with spawn_blocking pattern

- Add PostgreSQL persistence for legal module (was using in-memory HashMap)
  - Tables: legal_documents, legal_document_versions, cookie_consents, consent_history,
    legal_acceptances, data_deletion_requests, data_export_requests
  - GDPR-compliant consent tracking and document management

- Add PostgreSQL persistence for compliance module (was returning empty results)
  - Tables: compliance_checks, compliance_issues, compliance_audit_log, compliance_evidence,
    compliance_risk_assessments, compliance_risks, compliance_training_records,
    compliance_access_reviews
  - Support for GDPR, SOC2, ISO27001, HIPAA, PCI-DSS frameworks

- Add migration files for all new tables
- Update schema.rs with new table definitions and joinables
- Register new routes in main.rs
- Add recursion_limit = 512 for macro expansion
2026-01-13 00:07:22 -03:00

63 lines
2.5 KiB
SQL

DROP INDEX IF EXISTS idx_social_hashtags_popular;
DROP INDEX IF EXISTS idx_social_hashtags_tag;
DROP INDEX IF EXISTS idx_social_hashtags_org_bot;
DROP INDEX IF EXISTS idx_social_bookmarks_post;
DROP INDEX IF EXISTS idx_social_bookmarks_user;
DROP INDEX IF EXISTS idx_social_praises_created;
DROP INDEX IF EXISTS idx_social_praises_to;
DROP INDEX IF EXISTS idx_social_praises_from;
DROP INDEX IF EXISTS idx_social_praises_org_bot;
DROP INDEX IF EXISTS idx_social_announcements_pinned;
DROP INDEX IF EXISTS idx_social_announcements_priority;
DROP INDEX IF EXISTS idx_social_announcements_active;
DROP INDEX IF EXISTS idx_social_announcements_org_bot;
DROP INDEX IF EXISTS idx_social_poll_votes_user;
DROP INDEX IF EXISTS idx_social_poll_votes_poll;
DROP INDEX IF EXISTS idx_social_poll_options_poll;
DROP INDEX IF EXISTS idx_social_polls_post;
DROP INDEX IF EXISTS idx_social_reactions_user;
DROP INDEX IF EXISTS idx_social_reactions_comment;
DROP INDEX IF EXISTS idx_social_reactions_post;
DROP INDEX IF EXISTS idx_social_comments_created;
DROP INDEX IF EXISTS idx_social_comments_author;
DROP INDEX IF EXISTS idx_social_comments_parent;
DROP INDEX IF EXISTS idx_social_comments_post;
DROP INDEX IF EXISTS idx_social_posts_hashtags;
DROP INDEX IF EXISTS idx_social_posts_created;
DROP INDEX IF EXISTS idx_social_posts_announcement;
DROP INDEX IF EXISTS idx_social_posts_pinned;
DROP INDEX IF EXISTS idx_social_posts_visibility;
DROP INDEX IF EXISTS idx_social_posts_parent;
DROP INDEX IF EXISTS idx_social_posts_community;
DROP INDEX IF EXISTS idx_social_posts_author;
DROP INDEX IF EXISTS idx_social_posts_org_bot;
DROP INDEX IF EXISTS idx_social_community_members_role;
DROP INDEX IF EXISTS idx_social_community_members_user;
DROP INDEX IF EXISTS idx_social_community_members_community;
DROP INDEX IF EXISTS idx_social_communities_owner;
DROP INDEX IF EXISTS idx_social_communities_featured;
DROP INDEX IF EXISTS idx_social_communities_visibility;
DROP INDEX IF EXISTS idx_social_communities_slug;
DROP INDEX IF EXISTS idx_social_communities_org_bot;
DROP TABLE IF EXISTS social_hashtags;
DROP TABLE IF EXISTS social_bookmarks;
DROP TABLE IF EXISTS social_praises;
DROP TABLE IF EXISTS social_announcements;
DROP TABLE IF EXISTS social_poll_votes;
DROP TABLE IF EXISTS social_poll_options;
DROP TABLE IF EXISTS social_polls;
DROP TABLE IF EXISTS social_reactions;
DROP TABLE IF EXISTS social_comments;
DROP TABLE IF EXISTS social_posts;
DROP TABLE IF EXISTS social_community_members;
DROP TABLE IF EXISTS social_communities;