From 4e44cd544462f151bec0a0d6570b12d1a3de3131 Mon Sep 17 00:00:00 2001 From: Kevin McConnell Date: Tue, 11 Nov 2025 12:28:34 +0000 Subject: [PATCH] Flatten schema migrations --- .../20240621144855_create_organizations.rb | 9 - db/migrate/20240621144902_create_users.rb | 14 - db/migrate/20240723192954_create_splats.rb | 11 - .../20240724161006_create_categories.rb | 9 - .../20240724163519_create_categorizations.rb | 10 - ...200622_rename_organizations_to_accounts.rb | 6 - .../20240814210043_add_creator_to_splats.rb | 5 - db/migrate/20240814214252_create_comments.rb | 11 - db/migrate/20240819192804_create_boosts.rb | 11 - db/migrate/20240826201811_align_models.rb | 5 - ...te_active_storage_tables.active_storage.rb | 57 -- ...20240904180510_rename_splats_to_bubbles.rb | 9 - ...0240905191233_rename_categories_to_tags.rb | 8 - .../20240913172737_add_due_date_to_bubbles.rb | 5 - db/migrate/20240916191616_create_projects.rb | 11 - db/migrate/20240916191638_create_accesses.rb | 11 - .../20240916193936_add_project_to_bubbles.rb | 11 - .../20240917174301_create_assignments.rb | 10 - ...20240919141003_remove_body_from_bubbles.rb | 5 - .../20240919141018_remove_body_from_boosts.rb | 5 - ...0240919191155_add_join_code_to_accounts.rb | 7 - ...20240924191654_rename_project_to_bucket.rb | 8 - ..._remove_fk_constraints_from_assignments.rb | 6 - .../20241001200953_add_account_to_tags.rb | 11 - .../20241002103608_create_search_indexes.rb | 7 - db/migrate/20241002125904_create_pops.rb | 10 - ...1258_rename_assignment_user_to_assignee.rb | 5 - ...41002163242_add_assigner_to_assignments.rb | 7 - ...9181806_add_unique_index_to_assignments.rb | 5 - ...1009182303_make_comment_bodies_not_null.rb | 5 - db/migrate/20241009183354_create_events.rb | 14 - db/migrate/20241009191253_drop_boosts.rb | 5 - ...241009191318_add_boost_count_to_bubbles.rb | 5 - ...remove_assignments_index_on_assignee_id.rb | 5 - db/migrate/20241015224007_create_views.rb | 11 - ...7202003_make_bucket_view_filters_unique.rb | 11 - db/migrate/20241018175019_create_workflows.rb | 10 - .../20241018175057_create_workflow_stages.rb | 10 - ...018223027_add_workflow_stage_to_bubbles.rb | 5 - db/migrate/20241022174801_create_messages.rb | 10 - .../20241022180042_create_event_summaries.rb | 7 - ...2180133_add_summary_reference_to_events.rb | 9 - ...2_remove_bubble_reference_from_comments.rb | 5 - ...41028183212_make_event_summary_not_null.rb | 5 - ...05181312_rename_bucket_views_to_filters.rb | 20 - ...0241105224305_create_filter_join_tables.rb | 18 - .../20241108205445_hash_filter_params.rb | 10 - ...85136_create_filter_assigner_join_table.rb | 8 - ...115234456_add_comments_count_to_bubbles.rb | 5 - ...115234505_add_activity_score_to_bubbles.rb | 5 - ...1943_rename_boost_count_to_boosts_count.rb | 5 - ...0222444_make_taggings_unique_per_bubble.rb | 9 - ...0241126232658_remove_body_from_comments.rb | 5 - ...20241209223551_add_all_access_to_bucket.rb | 5 - .../20250107165422_add_status_to_bubbles.rb | 5 - .../20250109153649_create_notifications.rb | 15 - ...0_ensure_existing_bubbles_are_published.rb | 5 - ...344_change_notification_read_to_read_at.rb | 12 - ...117142146_associate_events_with_bubbles.rb | 17 - ...1174109_create_filter_stages_join_table.rb | 8 - .../20250204211520_add_due_date_to_events.rb | 5 - ...ange_bubbles_status_default_to_creating.rb | 5 - .../20250212094743_add_role_to_users.rb | 10 - ...250212103251_add_auto_pop_at_to_bubbles.rb | 21 - db/migrate/20250214222911_create_reactions.rb | 14 - ...0416_create_creators_filters_join_table.rb | 11 - ...20424_drop_assigners_filters_join_table.rb | 7 - db/migrate/20250224111311_create_watches.rb | 11 - .../20250224152047_create_subscriptions.rb | 18 - ...140641_add_activity_score_at_to_bubbles.rb | 11 - db/migrate/20250318005138_create_pins.rb | 11 - ...50319092704_add_involvement_to_accesses.rb | 7 - .../20250319161627_drop_subscriptions.rb | 16 - .../20250327191456_add_workflow_to_buckets.rb | 5 - ...0250403094604_create_bubble_engagements.rb | 9 - ...404072651_add_last_active_at_to_bubbles.rb | 20 - ...250404074315_remove_bubbles_auto_pop_at.rb | 5 - .../20250404083727_add_reason_to_pops.rb | 18 - ...33310_add_index_to_sort_pops_by_recency.rb | 5 - .../20250409043626_rename_bubbles_to_cards.rb | 55 -- ...0409200631_add_color_to_workflow_stages.rb | 5 - .../20250409201424_remove_color_from_cards.rb | 5 - ...50410120631_add_accessed_at_to_accesses.rb | 6 - .../20250410141409_create_card_goldnesses.rb | 9 - ...20250412084635_drop_card_comments_count.rb | 5 - ...12162339_remove_boosts_count_from_cards.rb | 5 - .../20250412170620_remove_account_ids.rb | 9 - ...250415131630_remove_accounts_name_index.rb | 5 - ...5131804_remove_accounts_join_code_index.rb | 5 - ...250418150259_remove_activity_from_cards.rb | 8 - db/migrate/20250421120008_create_mentions.rb | 11 - ...50422054950_add_source_to_notifications.rb | 11 - ...emove_unused_columns_from_notifications.rb | 6 - ...50422091602_remove_due_date_from_events.rb | 5 - ...0422112857_add_creator_to_notifications.rb | 18 - ...423114737_remove_notification_resources.rb | 5 - .../20250424045407_make_events_eventable.rb | 14 - ...ke_notifications_source_id_not_nullable.rb | 5 - ...50424051059_add_collection_id_to_events.rb | 17 - ...50424105223_make_event_summary_optional.rb | 5 - ...070025_migrate_existing_events_prefixes.rb | 20 - ...27_add_auto_close_period_to_collections.rb | 11 - ...429162506_flatten_messages_and_comments.rb | 21 - db/migrate/20250505123008_create_commands.rb | 13 - .../20250507095113_add_line_to_commands.rb | 5 - ...515125505_add_parent_column_to_commands.rb | 6 - ...4_create_action_text_tables.action_text.rb | 26 - ...604071718_create_entropy_configurations.rb | 15 - ...move_auto_close_period_from_collections.rb | 5 - .../20250604120033_create_activity_spikes.rb | 8 - ...09102553_create_collection_publications.rb | 10 - ...50611203906_add_queenbee_id_to_accounts.rb | 6 - ...50612163028_add_signal_user_id_to_users.rb | 6 - ...0_add_description_to_cards_search_index.rb | 9 - .../20250624063244_create_search_results.rb | 7 - .../20250624080408_create_search_queries.rb | 15 - .../20250625073215_drop_search_embeddings.rb | 5 - db/migrate/20250625111932_add_stemming.rb | 10 - .../20250625120000_add_steps_to_cards.rb | 13 - ...00000_create_closers_filters_join_table.rb | 11 - ...30_add_not_null_to_accounts_queenbee_id.rb | 5 - .../20250702211937_change_steps_index.rb | 6 - ...50703193928_add_index_to_search_queries.rb | 5 - .../20250714222221_add_push_subscriptions.rb | 17 - ...1110000_create_event_activity_summaries.rb | 13 - ...name_column_in_event_activity_summaries.rb | 6 - ...20250723165724_create_search_embeddings.rb | 16 - .../20250728131423_create_conversations.rb | 10 - ...0728131624_create_conversation_messages.rb | 17 - ...718_allow_null_for_accounts_queenbee_id.rb | 5 - ...12195130_add_status_to_card_engagements.rb | 6 - db/migrate/20250819101032_create_ai_quotas.rb | 12 - .../20250819105245_drop_commands_table.rb | 5 - ...50826084559_create_notification_bundles.rb | 15 - ...raint_from_notification_bundles_user_id.rb | 6 - ..._add_cost_microcents_to_event_summaries.rb | 12 - ...s_cost_microcents_to_cost_in_microcents.rb | 7 - ...s_cost_microcents_to_cost_in_microcents.rb | 5 - ...0828084732_create_notification_settings.rb | 12 - ..._notification_settings_to_user_settings.rb | 5 - ...20250901114009_create_period_highlights.rb | 15 - ...902093943_drop_event_activity_summaries.rb | 5 - ...3718_add_timezone_name_to_user_settings.rb | 5 - ...432_remove_dates_from_period_highlights.rb | 6 - db/migrate/20250909113219_create_webhooks.rb | 16 - ...0250909115638_create_webhook_deliveries.rb | 13 - ...541_create_webhook_delinquency_trackers.rb | 12 - ...igrate_everything_acccesses_to_watching.rb | 13 - ...ange_default_involvement_to_access_only.rb | 5 - ...913150256_add_collection_id_to_webhooks.rb | 5 - ...s_count_to_webhook_delinquency_trackers.rb | 10 - .../20250915170056_rename_37id_columns.rb | 6 - ...s_count_to_webhook_delinquency_trackers.rb | 5 - ...eate_columns_and_add_column_id_to_cards.rb | 12 - .../20250924123001_create_card_not_nows.rb | 8 - ...20250924124737_add_auto_postpone_period.rb | 17 - .../20250924190529_create_identities.rb | 7 - .../20250924190729_create_memberships.rb | 15 - ...1713_remove_external_user_id_from_users.rb | 5 - ...counts_tenant_id_to_external_account_id.rb | 5 - .../20251006091442_create_user_highlights.rb | 13 - .../20251007084223_cleanup_workflows.rb | 15 - ...51007112917_create_identity_magic_links.rb | 11 - ...20251014204033_ensure_consistent_schema.rb | 15 - ...0251015081645_create_account_join_codes.rb | 32 -- ...1015112653_add_creator_to_card_not_nows.rb | 5 - ...rename_creator_to_user_in_card_not_nows.rb | 5 - ...null_constraint_from_card_not_nows_user.rb | 5 - ...23003_remove_creator_from_card_not_nows.rb | 4 - .../20251015170934_move_email_to_identity.rb | 49 -- ...452_associate_magic_links_to_identities.rb | 18 - .../20251015204327_remove_closure_reasons.rb | 5 - ...51015205212_remove_reason_from_closures.rb | 5 - ...collection_id_and_action_and_created_at.rb | 5 - ...20251024081104_create_identity_sessions.rb | 11 - ...e_period_highlights_to_period_summaries.rb | 5 - ...kly_highlights_to_user_weekly_summaries.rb | 6 - db/migrate/20251027113216_delete_ai_models.rb | 7 - ...1027131911_add_join_code_to_memberships.rb | 5 - ...251028135758_add_membership_id_to_users.rb | 6 - db/migrate/20251029104115_drop_ai_tables.rb | 7 - .../20251029142418_add_position_to_columns.rb | 9 - ...x_on_collection_and_position_to_columns.rb | 5 - ..._change_cards_status_default_to_drafted.rb | 5 - ...ame_entropy_configurations_to_entropies.rb | 5 - ..._address_and_password_digest_from_users.rb | 6 - ...email_addresses_mandatory_on_identities.rb | 5 - ...n_identity_id_and_tenant_to_memberships.rb | 17 - ...251105122933_rename_collection_to_board.rb | 21 - ...4151_add_user_and_card_index_to_watches.rb | 5 - ...0251110175021_add_account_id_everywhere.rb | 18 - db/migrate/20251111122540_initial_schema.rb | 520 ++++++++++++++++++ db/schema.rb | 2 +- 193 files changed, 521 insertions(+), 1904 deletions(-) delete mode 100644 db/migrate/20240621144855_create_organizations.rb delete mode 100644 db/migrate/20240621144902_create_users.rb delete mode 100644 db/migrate/20240723192954_create_splats.rb delete mode 100644 db/migrate/20240724161006_create_categories.rb delete mode 100644 db/migrate/20240724163519_create_categorizations.rb delete mode 100644 db/migrate/20240813200622_rename_organizations_to_accounts.rb delete mode 100644 db/migrate/20240814210043_add_creator_to_splats.rb delete mode 100644 db/migrate/20240814214252_create_comments.rb delete mode 100644 db/migrate/20240819192804_create_boosts.rb delete mode 100644 db/migrate/20240826201811_align_models.rb delete mode 100644 db/migrate/20240828215240_create_active_storage_tables.active_storage.rb delete mode 100644 db/migrate/20240904180510_rename_splats_to_bubbles.rb delete mode 100644 db/migrate/20240905191233_rename_categories_to_tags.rb delete mode 100644 db/migrate/20240913172737_add_due_date_to_bubbles.rb delete mode 100644 db/migrate/20240916191616_create_projects.rb delete mode 100644 db/migrate/20240916191638_create_accesses.rb delete mode 100644 db/migrate/20240916193936_add_project_to_bubbles.rb delete mode 100644 db/migrate/20240917174301_create_assignments.rb delete mode 100644 db/migrate/20240919141003_remove_body_from_bubbles.rb delete mode 100644 db/migrate/20240919141018_remove_body_from_boosts.rb delete mode 100644 db/migrate/20240919191155_add_join_code_to_accounts.rb delete mode 100644 db/migrate/20240924191654_rename_project_to_bucket.rb delete mode 100644 db/migrate/20240930164803_remove_fk_constraints_from_assignments.rb delete mode 100644 db/migrate/20241001200953_add_account_to_tags.rb delete mode 100644 db/migrate/20241002103608_create_search_indexes.rb delete mode 100644 db/migrate/20241002125904_create_pops.rb delete mode 100644 db/migrate/20241002161258_rename_assignment_user_to_assignee.rb delete mode 100644 db/migrate/20241002163242_add_assigner_to_assignments.rb delete mode 100644 db/migrate/20241009181806_add_unique_index_to_assignments.rb delete mode 100644 db/migrate/20241009182303_make_comment_bodies_not_null.rb delete mode 100644 db/migrate/20241009183354_create_events.rb delete mode 100644 db/migrate/20241009191253_drop_boosts.rb delete mode 100644 db/migrate/20241009191318_add_boost_count_to_bubbles.rb delete mode 100644 db/migrate/20241009211414_remove_assignments_index_on_assignee_id.rb delete mode 100644 db/migrate/20241015224007_create_views.rb delete mode 100644 db/migrate/20241017202003_make_bucket_view_filters_unique.rb delete mode 100644 db/migrate/20241018175019_create_workflows.rb delete mode 100644 db/migrate/20241018175057_create_workflow_stages.rb delete mode 100644 db/migrate/20241018223027_add_workflow_stage_to_bubbles.rb delete mode 100644 db/migrate/20241022174801_create_messages.rb delete mode 100644 db/migrate/20241022180042_create_event_summaries.rb delete mode 100644 db/migrate/20241022180133_add_summary_reference_to_events.rb delete mode 100644 db/migrate/20241025224942_remove_bubble_reference_from_comments.rb delete mode 100644 db/migrate/20241028183212_make_event_summary_not_null.rb delete mode 100644 db/migrate/20241105181312_rename_bucket_views_to_filters.rb delete mode 100644 db/migrate/20241105224305_create_filter_join_tables.rb delete mode 100644 db/migrate/20241108205445_hash_filter_params.rb delete mode 100644 db/migrate/20241113185136_create_filter_assigner_join_table.rb delete mode 100644 db/migrate/20241115234456_add_comments_count_to_bubbles.rb delete mode 100644 db/migrate/20241115234505_add_activity_score_to_bubbles.rb delete mode 100644 db/migrate/20241119201943_rename_boost_count_to_boosts_count.rb delete mode 100644 db/migrate/20241120222444_make_taggings_unique_per_bubble.rb delete mode 100644 db/migrate/20241126232658_remove_body_from_comments.rb delete mode 100644 db/migrate/20241209223551_add_all_access_to_bucket.rb delete mode 100644 db/migrate/20250107165422_add_status_to_bubbles.rb delete mode 100644 db/migrate/20250109153649_create_notifications.rb delete mode 100644 db/migrate/20250115122810_ensure_existing_bubbles_are_published.rb delete mode 100644 db/migrate/20250116163344_change_notification_read_to_read_at.rb delete mode 100644 db/migrate/20250117142146_associate_events_with_bubbles.rb delete mode 100644 db/migrate/20250121174109_create_filter_stages_join_table.rb delete mode 100644 db/migrate/20250204211520_add_due_date_to_events.rb delete mode 100644 db/migrate/20250206141302_change_bubbles_status_default_to_creating.rb delete mode 100644 db/migrate/20250212094743_add_role_to_users.rb delete mode 100644 db/migrate/20250212103251_add_auto_pop_at_to_bubbles.rb delete mode 100644 db/migrate/20250214222911_create_reactions.rb delete mode 100644 db/migrate/20250220220416_create_creators_filters_join_table.rb delete mode 100644 db/migrate/20250220220424_drop_assigners_filters_join_table.rb delete mode 100644 db/migrate/20250224111311_create_watches.rb delete mode 100644 db/migrate/20250224152047_create_subscriptions.rb delete mode 100644 db/migrate/20250304140641_add_activity_score_at_to_bubbles.rb delete mode 100644 db/migrate/20250318005138_create_pins.rb delete mode 100644 db/migrate/20250319092704_add_involvement_to_accesses.rb delete mode 100644 db/migrate/20250319161627_drop_subscriptions.rb delete mode 100644 db/migrate/20250327191456_add_workflow_to_buckets.rb delete mode 100644 db/migrate/20250403094604_create_bubble_engagements.rb delete mode 100644 db/migrate/20250404072651_add_last_active_at_to_bubbles.rb delete mode 100644 db/migrate/20250404074315_remove_bubbles_auto_pop_at.rb delete mode 100644 db/migrate/20250404083727_add_reason_to_pops.rb delete mode 100644 db/migrate/20250404133310_add_index_to_sort_pops_by_recency.rb delete mode 100644 db/migrate/20250409043626_rename_bubbles_to_cards.rb delete mode 100644 db/migrate/20250409200631_add_color_to_workflow_stages.rb delete mode 100644 db/migrate/20250409201424_remove_color_from_cards.rb delete mode 100644 db/migrate/20250410120631_add_accessed_at_to_accesses.rb delete mode 100644 db/migrate/20250410141409_create_card_goldnesses.rb delete mode 100644 db/migrate/20250412084635_drop_card_comments_count.rb delete mode 100644 db/migrate/20250412162339_remove_boosts_count_from_cards.rb delete mode 100644 db/migrate/20250412170620_remove_account_ids.rb delete mode 100644 db/migrate/20250415131630_remove_accounts_name_index.rb delete mode 100644 db/migrate/20250415131804_remove_accounts_join_code_index.rb delete mode 100644 db/migrate/20250418150259_remove_activity_from_cards.rb delete mode 100644 db/migrate/20250421120008_create_mentions.rb delete mode 100644 db/migrate/20250422054950_add_source_to_notifications.rb delete mode 100644 db/migrate/20250422062930_remove_unused_columns_from_notifications.rb delete mode 100644 db/migrate/20250422091602_remove_due_date_from_events.rb delete mode 100644 db/migrate/20250422112857_add_creator_to_notifications.rb delete mode 100644 db/migrate/20250423114737_remove_notification_resources.rb delete mode 100644 db/migrate/20250424045407_make_events_eventable.rb delete mode 100644 db/migrate/20250424045639_make_notifications_source_id_not_nullable.rb delete mode 100644 db/migrate/20250424051059_add_collection_id_to_events.rb delete mode 100644 db/migrate/20250424105223_make_event_summary_optional.rb delete mode 100644 db/migrate/20250425070025_migrate_existing_events_prefixes.rb delete mode 100644 db/migrate/20250425092727_add_auto_close_period_to_collections.rb delete mode 100644 db/migrate/20250429162506_flatten_messages_and_comments.rb delete mode 100644 db/migrate/20250505123008_create_commands.rb delete mode 100644 db/migrate/20250507095113_add_line_to_commands.rb delete mode 100644 db/migrate/20250515125505_add_parent_column_to_commands.rb delete mode 100644 db/migrate/20250523084734_create_action_text_tables.action_text.rb delete mode 100644 db/migrate/20250604071718_create_entropy_configurations.rb delete mode 100644 db/migrate/20250604080022_remove_auto_close_period_from_collections.rb delete mode 100644 db/migrate/20250604120033_create_activity_spikes.rb delete mode 100644 db/migrate/20250609102553_create_collection_publications.rb delete mode 100644 db/migrate/20250611203906_add_queenbee_id_to_accounts.rb delete mode 100644 db/migrate/20250612163028_add_signal_user_id_to_users.rb delete mode 100644 db/migrate/20250624055720_add_description_to_cards_search_index.rb delete mode 100644 db/migrate/20250624063244_create_search_results.rb delete mode 100644 db/migrate/20250624080408_create_search_queries.rb delete mode 100644 db/migrate/20250625073215_drop_search_embeddings.rb delete mode 100644 db/migrate/20250625111932_add_stemming.rb delete mode 100644 db/migrate/20250625120000_add_steps_to_cards.rb delete mode 100644 db/migrate/20250626000000_create_closers_filters_join_table.rb delete mode 100644 db/migrate/20250702160230_add_not_null_to_accounts_queenbee_id.rb delete mode 100644 db/migrate/20250702211937_change_steps_index.rb delete mode 100644 db/migrate/20250703193928_add_index_to_search_queries.rb delete mode 100644 db/migrate/20250714222221_add_push_subscriptions.rb delete mode 100644 db/migrate/20250721110000_create_event_activity_summaries.rb delete mode 100644 db/migrate/20250722132226_remove_data_and_rename_column_in_event_activity_summaries.rb delete mode 100644 db/migrate/20250723165724_create_search_embeddings.rb delete mode 100644 db/migrate/20250728131423_create_conversations.rb delete mode 100644 db/migrate/20250728131624_create_conversation_messages.rb delete mode 100644 db/migrate/20250806174718_allow_null_for_accounts_queenbee_id.rb delete mode 100644 db/migrate/20250812195130_add_status_to_card_engagements.rb delete mode 100644 db/migrate/20250819101032_create_ai_quotas.rb delete mode 100644 db/migrate/20250819105245_drop_commands_table.rb delete mode 100644 db/migrate/20250826084559_create_notification_bundles.rb delete mode 100644 db/migrate/20250826131458_remove_unique_constraint_from_notification_bundles_user_id.rb delete mode 100644 db/migrate/20250827065003_add_cost_microcents_to_event_summaries.rb delete mode 100644 db/migrate/20250827072523_rename_conversation_messages_cost_microcents_to_cost_in_microcents.rb delete mode 100644 db/migrate/20250827072601_rename_event_activity_summaries_cost_microcents_to_cost_in_microcents.rb delete mode 100644 db/migrate/20250828084732_create_notification_settings.rb delete mode 100644 db/migrate/20250828092106_rename_notification_settings_to_user_settings.rb delete mode 100644 db/migrate/20250901114009_create_period_highlights.rb delete mode 100644 db/migrate/20250902093943_drop_event_activity_summaries.rb delete mode 100644 db/migrate/20250905093718_add_timezone_name_to_user_settings.rb delete mode 100644 db/migrate/20250905101432_remove_dates_from_period_highlights.rb delete mode 100644 db/migrate/20250909113219_create_webhooks.rb delete mode 100644 db/migrate/20250909115638_create_webhook_deliveries.rb delete mode 100644 db/migrate/20250911124541_create_webhook_delinquency_trackers.rb delete mode 100644 db/migrate/20250912123359_migrate_everything_acccesses_to_watching.rb delete mode 100644 db/migrate/20250912205016_change_default_involvement_to_access_only.rb delete mode 100644 db/migrate/20250913150256_add_collection_id_to_webhooks.rb delete mode 100644 db/migrate/20250915143513_add_consecutive_failures_count_to_webhook_delinquency_trackers.rb delete mode 100644 db/migrate/20250915170056_rename_37id_columns.rb delete mode 100644 db/migrate/20250917064006_add_default_value_for_consecutive_failures_count_to_webhook_delinquency_trackers.rb delete mode 100644 db/migrate/20250924100149_create_columns_and_add_column_id_to_cards.rb delete mode 100644 db/migrate/20250924123001_create_card_not_nows.rb delete mode 100644 db/migrate/20250924124737_add_auto_postpone_period.rb delete mode 100644 db/migrate/20250924190529_create_identities.rb delete mode 100644 db/migrate/20250924190729_create_memberships.rb delete mode 100644 db/migrate/20251001181713_remove_external_user_id_from_users.rb delete mode 100644 db/migrate/20251003205559_rename_accounts_tenant_id_to_external_account_id.rb delete mode 100644 db/migrate/20251006091442_create_user_highlights.rb delete mode 100644 db/migrate/20251007084223_cleanup_workflows.rb delete mode 100644 db/migrate/20251007112917_create_identity_magic_links.rb delete mode 100644 db/migrate/20251014204033_ensure_consistent_schema.rb delete mode 100644 db/migrate/20251015081645_create_account_join_codes.rb delete mode 100644 db/migrate/20251015112653_add_creator_to_card_not_nows.rb delete mode 100644 db/migrate/20251015114014_rename_creator_to_user_in_card_not_nows.rb delete mode 100644 db/migrate/20251015122204_remove_null_constraint_from_card_not_nows_user.rb delete mode 100644 db/migrate/20251015123003_remove_creator_from_card_not_nows.rb delete mode 100644 db/migrate/20251015170934_move_email_to_identity.rb delete mode 100644 db/migrate/20251015173452_associate_magic_links_to_identities.rb delete mode 100644 db/migrate/20251015204327_remove_closure_reasons.rb delete mode 100644 db/migrate/20251015205212_remove_reason_from_closures.rb delete mode 100644 db/migrate/20251016153034_add_index_to_events_on_collection_id_and_action_and_created_at.rb delete mode 100644 db/migrate/20251024081104_create_identity_sessions.rb delete mode 100644 db/migrate/20251025174549_rename_period_highlights_to_period_summaries.rb delete mode 100644 db/migrate/20251025174618_rename_user_weekly_highlights_to_user_weekly_summaries.rb delete mode 100644 db/migrate/20251027113216_delete_ai_models.rb delete mode 100644 db/migrate/20251027131911_add_join_code_to_memberships.rb delete mode 100644 db/migrate/20251028135758_add_membership_id_to_users.rb delete mode 100644 db/migrate/20251029104115_drop_ai_tables.rb delete mode 100644 db/migrate/20251029142418_add_position_to_columns.rb delete mode 100644 db/migrate/20251029161222_add_index_on_collection_and_position_to_columns.rb delete mode 100644 db/migrate/20251102095019_change_cards_status_default_to_drafted.rb delete mode 100644 db/migrate/20251102115338_rename_entropy_configurations_to_entropies.rb delete mode 100644 db/migrate/20251103125353_remove_email_address_and_password_digest_from_users.rb delete mode 100644 db/migrate/20251103125952_make_email_addresses_mandatory_on_identities.rb delete mode 100644 db/migrate/20251105082803_add_unique_constraint_on_identity_id_and_tenant_to_memberships.rb delete mode 100644 db/migrate/20251105122933_rename_collection_to_board.rb delete mode 100644 db/migrate/20251106154151_add_user_and_card_index_to_watches.rb delete mode 100644 db/migrate/20251110175021_add_account_id_everywhere.rb create mode 100644 db/migrate/20251111122540_initial_schema.rb diff --git a/db/migrate/20240621144855_create_organizations.rb b/db/migrate/20240621144855_create_organizations.rb deleted file mode 100644 index ec00d3169..000000000 --- a/db/migrate/20240621144855_create_organizations.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CreateOrganizations < ActiveRecord::Migration[8.0] - def change - create_table :organizations do |t| - t.string :name, null: false, index: { unique: true } - - t.timestamps - end - end -end diff --git a/db/migrate/20240621144902_create_users.rb b/db/migrate/20240621144902_create_users.rb deleted file mode 100644 index 7839f7ebe..000000000 --- a/db/migrate/20240621144902_create_users.rb +++ /dev/null @@ -1,14 +0,0 @@ -class CreateUsers < ActiveRecord::Migration[8.0] - def change - create_table :users do |t| - t.references :organization, null: false, foreign_key: true - - t.string :name, null: false - t.string :email_address, null: false, index: { unique: true } - t.string :password_digest, null: false - t.boolean :active, null: false, default: true - - t.timestamps - end - end -end diff --git a/db/migrate/20240723192954_create_splats.rb b/db/migrate/20240723192954_create_splats.rb deleted file mode 100644 index 3cb276548..000000000 --- a/db/migrate/20240723192954_create_splats.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateSplats < ActiveRecord::Migration[8.0] - def change - create_table :splats do |t| - t.string :title - t.text :body - t.string :color - - t.timestamps - end - end -end diff --git a/db/migrate/20240724161006_create_categories.rb b/db/migrate/20240724161006_create_categories.rb deleted file mode 100644 index 8b00791f6..000000000 --- a/db/migrate/20240724161006_create_categories.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CreateCategories < ActiveRecord::Migration[8.0] - def change - create_table :categories do |t| - t.string :title - - t.timestamps - end - end -end diff --git a/db/migrate/20240724163519_create_categorizations.rb b/db/migrate/20240724163519_create_categorizations.rb deleted file mode 100644 index 2ccee708d..000000000 --- a/db/migrate/20240724163519_create_categorizations.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateCategorizations < ActiveRecord::Migration[8.0] - def change - create_table :categorizations do |t| - t.references :splat, null: false, foreign_key: true - t.references :category, null: false, foreign_key: true - - t.timestamps - end - end -end diff --git a/db/migrate/20240813200622_rename_organizations_to_accounts.rb b/db/migrate/20240813200622_rename_organizations_to_accounts.rb deleted file mode 100644 index a0fbe2ec2..000000000 --- a/db/migrate/20240813200622_rename_organizations_to_accounts.rb +++ /dev/null @@ -1,6 +0,0 @@ -class RenameOrganizationsToAccounts < ActiveRecord::Migration[8.0] - def change - rename_table :organizations, :accounts - rename_column :users, :organization_id, :account_id - end -end diff --git a/db/migrate/20240814210043_add_creator_to_splats.rb b/db/migrate/20240814210043_add_creator_to_splats.rb deleted file mode 100644 index 496d39428..000000000 --- a/db/migrate/20240814210043_add_creator_to_splats.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddCreatorToSplats < ActiveRecord::Migration[8.0] - def change - add_column :splats, :creator_id, :integer, null: false - end -end diff --git a/db/migrate/20240814214252_create_comments.rb b/db/migrate/20240814214252_create_comments.rb deleted file mode 100644 index 874e17e9f..000000000 --- a/db/migrate/20240814214252_create_comments.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateComments < ActiveRecord::Migration[8.0] - def change - create_table :comments do |t| - t.text :body - t.integer :creator_id, null: false - t.integer :splat_id, null: false - - t.timestamps - end - end -end diff --git a/db/migrate/20240819192804_create_boosts.rb b/db/migrate/20240819192804_create_boosts.rb deleted file mode 100644 index ea5139c92..000000000 --- a/db/migrate/20240819192804_create_boosts.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateBoosts < ActiveRecord::Migration[8.0] - def change - create_table :boosts do |t| - t.string :content - t.integer :creator_id, null: false - t.references :splat, null: false - - t.timestamps - end - end -end diff --git a/db/migrate/20240826201811_align_models.rb b/db/migrate/20240826201811_align_models.rb deleted file mode 100644 index 5736b9b4e..000000000 --- a/db/migrate/20240826201811_align_models.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AlignModels < ActiveRecord::Migration[8.0] - def change - rename_column :boosts, :content, :body - end -end diff --git a/db/migrate/20240828215240_create_active_storage_tables.active_storage.rb b/db/migrate/20240828215240_create_active_storage_tables.active_storage.rb deleted file mode 100644 index 6bd8bd082..000000000 --- a/db/migrate/20240828215240_create_active_storage_tables.active_storage.rb +++ /dev/null @@ -1,57 +0,0 @@ -# This migration comes from active_storage (originally 20170806125915) -class CreateActiveStorageTables < ActiveRecord::Migration[7.0] - def change - # Use Active Record's configured type for primary and foreign keys - primary_key_type, foreign_key_type = primary_and_foreign_key_types - - create_table :active_storage_blobs, id: primary_key_type do |t| - t.string :key, null: false - t.string :filename, null: false - t.string :content_type - t.text :metadata - t.string :service_name, null: false - t.bigint :byte_size, null: false - t.string :checksum - - if connection.supports_datetime_with_precision? - t.datetime :created_at, precision: 6, null: false - else - t.datetime :created_at, null: false - end - - t.index [ :key ], unique: true - end - - create_table :active_storage_attachments, id: primary_key_type do |t| - t.string :name, null: false - t.references :record, null: false, polymorphic: true, index: false, type: foreign_key_type - t.references :blob, null: false, type: foreign_key_type - - if connection.supports_datetime_with_precision? - t.datetime :created_at, precision: 6, null: false - else - t.datetime :created_at, null: false - end - - t.index [ :record_type, :record_id, :name, :blob_id ], name: :index_active_storage_attachments_uniqueness, unique: true - t.foreign_key :active_storage_blobs, column: :blob_id - end - - create_table :active_storage_variant_records, id: primary_key_type do |t| - t.belongs_to :blob, null: false, index: false, type: foreign_key_type - t.string :variation_digest, null: false - - t.index [ :blob_id, :variation_digest ], name: :index_active_storage_variant_records_uniqueness, unique: true - t.foreign_key :active_storage_blobs, column: :blob_id - end - end - - private - def primary_and_foreign_key_types - config = Rails.configuration.generators - setting = config.options[config.orm][:primary_key_type] - primary_key_type = setting || :primary_key - foreign_key_type = setting || :bigint - [ primary_key_type, foreign_key_type ] - end -end diff --git a/db/migrate/20240904180510_rename_splats_to_bubbles.rb b/db/migrate/20240904180510_rename_splats_to_bubbles.rb deleted file mode 100644 index f7ae9c055..000000000 --- a/db/migrate/20240904180510_rename_splats_to_bubbles.rb +++ /dev/null @@ -1,9 +0,0 @@ -class RenameSplatsToBubbles < ActiveRecord::Migration[8.0] - def change - rename_table :splats, :bubbles - - rename_column :categorizations, :splat_id, :bubble_id - rename_column :boosts, :splat_id, :bubble_id - rename_column :comments, :splat_id, :bubble_id - end -end diff --git a/db/migrate/20240905191233_rename_categories_to_tags.rb b/db/migrate/20240905191233_rename_categories_to_tags.rb deleted file mode 100644 index a294472e5..000000000 --- a/db/migrate/20240905191233_rename_categories_to_tags.rb +++ /dev/null @@ -1,8 +0,0 @@ -class RenameCategoriesToTags < ActiveRecord::Migration[8.0] - def change - rename_table :categories, :tags - rename_table :categorizations, :taggings - - rename_column :taggings, :category_id, :tag_id - end -end diff --git a/db/migrate/20240913172737_add_due_date_to_bubbles.rb b/db/migrate/20240913172737_add_due_date_to_bubbles.rb deleted file mode 100644 index bac2015ec..000000000 --- a/db/migrate/20240913172737_add_due_date_to_bubbles.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddDueDateToBubbles < ActiveRecord::Migration[8.0] - def change - add_column :bubbles, :due_on, :date - end -end diff --git a/db/migrate/20240916191616_create_projects.rb b/db/migrate/20240916191616_create_projects.rb deleted file mode 100644 index 9d12b0066..000000000 --- a/db/migrate/20240916191616_create_projects.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateProjects < ActiveRecord::Migration[8.0] - def change - create_table :projects do |t| - t.references :account, null: false - t.references :creator, null: false - t.string :name, null: false - - t.timestamps - end - end -end diff --git a/db/migrate/20240916191638_create_accesses.rb b/db/migrate/20240916191638_create_accesses.rb deleted file mode 100644 index 00529d84d..000000000 --- a/db/migrate/20240916191638_create_accesses.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateAccesses < ActiveRecord::Migration[8.0] - def change - create_table :accesses do |t| - t.references :project, null: false - t.references :user, null: false - t.timestamps - - t.index [ :project_id, :user_id ], unique: true - end - end -end diff --git a/db/migrate/20240916193936_add_project_to_bubbles.rb b/db/migrate/20240916193936_add_project_to_bubbles.rb deleted file mode 100644 index 5ec29cbba..000000000 --- a/db/migrate/20240916193936_add_project_to_bubbles.rb +++ /dev/null @@ -1,11 +0,0 @@ -class AddProjectToBubbles < ActiveRecord::Migration[8.0] - def change - change_table :bubbles do |t| - t.references :project, null: true - end - - execute "update bubbles set project_id = (select id from projects limit 1)" - - change_column_null :bubbles, :project_id, false - end -end diff --git a/db/migrate/20240917174301_create_assignments.rb b/db/migrate/20240917174301_create_assignments.rb deleted file mode 100644 index 0c2fc5928..000000000 --- a/db/migrate/20240917174301_create_assignments.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateAssignments < ActiveRecord::Migration[8.0] - def change - create_table :assignments do |t| - t.references :user, null: false, foreign_key: true - t.references :bubble, null: false, foreign_key: true - - t.timestamps - end - end -end diff --git a/db/migrate/20240919141003_remove_body_from_bubbles.rb b/db/migrate/20240919141003_remove_body_from_bubbles.rb deleted file mode 100644 index 49d350991..000000000 --- a/db/migrate/20240919141003_remove_body_from_bubbles.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveBodyFromBubbles < ActiveRecord::Migration[8.0] - def change - remove_column :bubbles, :body, :string - end -end diff --git a/db/migrate/20240919141018_remove_body_from_boosts.rb b/db/migrate/20240919141018_remove_body_from_boosts.rb deleted file mode 100644 index 50de21235..000000000 --- a/db/migrate/20240919141018_remove_body_from_boosts.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveBodyFromBoosts < ActiveRecord::Migration[8.0] - def change - remove_column :boosts, :body, :string - end -end diff --git a/db/migrate/20240919191155_add_join_code_to_accounts.rb b/db/migrate/20240919191155_add_join_code_to_accounts.rb deleted file mode 100644 index 02249fac0..000000000 --- a/db/migrate/20240919191155_add_join_code_to_accounts.rb +++ /dev/null @@ -1,7 +0,0 @@ -class AddJoinCodeToAccounts < ActiveRecord::Migration[8.0] - def change - change_table :accounts do |t| - t.string :join_code, index: { unique: true } - end - end -end diff --git a/db/migrate/20240924191654_rename_project_to_bucket.rb b/db/migrate/20240924191654_rename_project_to_bucket.rb deleted file mode 100644 index 4ccb06c00..000000000 --- a/db/migrate/20240924191654_rename_project_to_bucket.rb +++ /dev/null @@ -1,8 +0,0 @@ -class RenameProjectToBucket < ActiveRecord::Migration[8.0] - def change - rename_table :projects, :buckets - - rename_column :accesses, :project_id, :bucket_id - rename_column :bubbles, :project_id, :bucket_id - end -end diff --git a/db/migrate/20240930164803_remove_fk_constraints_from_assignments.rb b/db/migrate/20240930164803_remove_fk_constraints_from_assignments.rb deleted file mode 100644 index ffc31c49e..000000000 --- a/db/migrate/20240930164803_remove_fk_constraints_from_assignments.rb +++ /dev/null @@ -1,6 +0,0 @@ -class RemoveFkConstraintsFromAssignments < ActiveRecord::Migration[8.0] - def change - remove_foreign_key :assignments, :bubbles - remove_foreign_key :assignments, :users - end -end diff --git a/db/migrate/20241001200953_add_account_to_tags.rb b/db/migrate/20241001200953_add_account_to_tags.rb deleted file mode 100644 index 56243f0d1..000000000 --- a/db/migrate/20241001200953_add_account_to_tags.rb +++ /dev/null @@ -1,11 +0,0 @@ -class AddAccountToTags < ActiveRecord::Migration[8.0] - def change - change_table :tags do |t| - t.references :account, null: true - end - - execute "update tags set account_id = (select id from accounts limit 1)" - - change_column_null :tags, :account_id, false - end -end diff --git a/db/migrate/20241002103608_create_search_indexes.rb b/db/migrate/20241002103608_create_search_indexes.rb deleted file mode 100644 index 339ef0213..000000000 --- a/db/migrate/20241002103608_create_search_indexes.rb +++ /dev/null @@ -1,7 +0,0 @@ -class CreateSearchIndexes < ActiveRecord::Migration[8.0] - def change - # # TODO:PLANB: need to replace SQLite FTS - # create_virtual_table :bubbles_search_index, "fts5", [ "title" ] - # create_virtual_table :comments_search_index, "fts5", [ "body" ] - end -end diff --git a/db/migrate/20241002125904_create_pops.rb b/db/migrate/20241002125904_create_pops.rb deleted file mode 100644 index 6424fcf1f..000000000 --- a/db/migrate/20241002125904_create_pops.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreatePops < ActiveRecord::Migration[8.0] - def change - create_table :pops do |t| - t.references :bubble, null: false, foreign_key: true, index: { unique: true } - t.references :user, null: true, foreign_key: true - - t.timestamps - end - end -end diff --git a/db/migrate/20241002161258_rename_assignment_user_to_assignee.rb b/db/migrate/20241002161258_rename_assignment_user_to_assignee.rb deleted file mode 100644 index d940e9bd3..000000000 --- a/db/migrate/20241002161258_rename_assignment_user_to_assignee.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameAssignmentUserToAssignee < ActiveRecord::Migration[8.0] - def change - rename_column :assignments, :user_id, :assignee_id - end -end diff --git a/db/migrate/20241002163242_add_assigner_to_assignments.rb b/db/migrate/20241002163242_add_assigner_to_assignments.rb deleted file mode 100644 index 3d77b8a8d..000000000 --- a/db/migrate/20241002163242_add_assigner_to_assignments.rb +++ /dev/null @@ -1,7 +0,0 @@ -class AddAssignerToAssignments < ActiveRecord::Migration[8.0] - def change - add_column :assignments, :assigner_id, :integer - execute "update assignments set assigner_id = assignee_id" - change_column_null :assignments, :assigner_id, false - end -end diff --git a/db/migrate/20241009181806_add_unique_index_to_assignments.rb b/db/migrate/20241009181806_add_unique_index_to_assignments.rb deleted file mode 100644 index 6600bef57..000000000 --- a/db/migrate/20241009181806_add_unique_index_to_assignments.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddUniqueIndexToAssignments < ActiveRecord::Migration[8.0] - def change - add_index :assignments, %i[ assignee_id bubble_id ], unique: true - end -end diff --git a/db/migrate/20241009182303_make_comment_bodies_not_null.rb b/db/migrate/20241009182303_make_comment_bodies_not_null.rb deleted file mode 100644 index eebedd368..000000000 --- a/db/migrate/20241009182303_make_comment_bodies_not_null.rb +++ /dev/null @@ -1,5 +0,0 @@ -class MakeCommentBodiesNotNull < ActiveRecord::Migration[8.0] - def change - change_column_null :comments, :body, false - end -end diff --git a/db/migrate/20241009183354_create_events.rb b/db/migrate/20241009183354_create_events.rb deleted file mode 100644 index 269691999..000000000 --- a/db/migrate/20241009183354_create_events.rb +++ /dev/null @@ -1,14 +0,0 @@ -class CreateEvents < ActiveRecord::Migration[8.0] - def change - create_table :events do |t| - t.references :bubble, null: false, index: false - t.references :creator, null: false - t.column :particulars, :json, default: -> { '(JSON_OBJECT())' } - t.string :action, null: false - - t.timestamps - end - - add_index :events, %i[ bubble_id action ], name: "index_events_on_bubble_id_and_action" - end -end diff --git a/db/migrate/20241009191253_drop_boosts.rb b/db/migrate/20241009191253_drop_boosts.rb deleted file mode 100644 index 9ecfeeea5..000000000 --- a/db/migrate/20241009191253_drop_boosts.rb +++ /dev/null @@ -1,5 +0,0 @@ -class DropBoosts < ActiveRecord::Migration[8.0] - def change - drop_table :boosts - end -end diff --git a/db/migrate/20241009191318_add_boost_count_to_bubbles.rb b/db/migrate/20241009191318_add_boost_count_to_bubbles.rb deleted file mode 100644 index 55a215ed5..000000000 --- a/db/migrate/20241009191318_add_boost_count_to_bubbles.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddBoostCountToBubbles < ActiveRecord::Migration[8.0] - def change - add_column :bubbles, :boost_count, :integer, null: false, default: 0 - end -end diff --git a/db/migrate/20241009211414_remove_assignments_index_on_assignee_id.rb b/db/migrate/20241009211414_remove_assignments_index_on_assignee_id.rb deleted file mode 100644 index 5f41bcc3a..000000000 --- a/db/migrate/20241009211414_remove_assignments_index_on_assignee_id.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveAssignmentsIndexOnAssigneeId < ActiveRecord::Migration[8.0] - def change - remove_index :assignments, :assignee_id - end -end diff --git a/db/migrate/20241015224007_create_views.rb b/db/migrate/20241015224007_create_views.rb deleted file mode 100644 index 19c4289e4..000000000 --- a/db/migrate/20241015224007_create_views.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateViews < ActiveRecord::Migration[8.0] - def change - create_table :bucket_views do |t| - t.references :creator, null: false - t.references :bucket, null: false - t.column :filters, :json, default: -> { '(JSON_OBJECT())' }, null: false - - t.timestamps - end - end -end diff --git a/db/migrate/20241017202003_make_bucket_view_filters_unique.rb b/db/migrate/20241017202003_make_bucket_view_filters_unique.rb deleted file mode 100644 index d617464a2..000000000 --- a/db/migrate/20241017202003_make_bucket_view_filters_unique.rb +++ /dev/null @@ -1,11 +0,0 @@ -class MakeBucketViewFiltersUnique < ActiveRecord::Migration[8.0] - def change - # MySQL doesn't support direct indexing of JSON columns. To ensure uniqueness - # of the filters JSON content, we create a generated column that stores a SHA2 - # hash of the JSON data. This allows us to enforce that each creator can only - # have one view per bucket with the same filter configuration. - add_column :bucket_views, :filters_hash, :string, limit: 64, as: "SHA2(filters, 256)", stored: true - add_index :bucket_views, %i[ bucket_id creator_id filters_hash ], unique: true - remove_index :bucket_views, :bucket_id - end -end diff --git a/db/migrate/20241018175019_create_workflows.rb b/db/migrate/20241018175019_create_workflows.rb deleted file mode 100644 index 9d57fc8fb..000000000 --- a/db/migrate/20241018175019_create_workflows.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateWorkflows < ActiveRecord::Migration[8.0] - def change - create_table :workflows do |t| - t.references :account, null: false, foreign_key: true - t.string :name, null: false - - t.timestamps - end - end -end diff --git a/db/migrate/20241018175057_create_workflow_stages.rb b/db/migrate/20241018175057_create_workflow_stages.rb deleted file mode 100644 index ff7d3e490..000000000 --- a/db/migrate/20241018175057_create_workflow_stages.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateWorkflowStages < ActiveRecord::Migration[8.0] - def change - create_table :workflow_stages do |t| - t.references :workflow, null: false, foreign_key: true - t.string :name, null: false - - t.timestamps - end - end -end diff --git a/db/migrate/20241018223027_add_workflow_stage_to_bubbles.rb b/db/migrate/20241018223027_add_workflow_stage_to_bubbles.rb deleted file mode 100644 index cb528612a..000000000 --- a/db/migrate/20241018223027_add_workflow_stage_to_bubbles.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddWorkflowStageToBubbles < ActiveRecord::Migration[8.0] - def change - add_reference :bubbles, :stage, null: true, foreign_key: { to_table: :workflow_stages } - end -end diff --git a/db/migrate/20241022174801_create_messages.rb b/db/migrate/20241022174801_create_messages.rb deleted file mode 100644 index af8bebd9d..000000000 --- a/db/migrate/20241022174801_create_messages.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateMessages < ActiveRecord::Migration[8.0] - def change - create_table :messages do |t| - t.references :bubble, null: false, foreign_key: true - t.references :messageable, polymorphic: true, null: false, index: { unique: true } - - t.timestamps - end - end -end diff --git a/db/migrate/20241022180042_create_event_summaries.rb b/db/migrate/20241022180042_create_event_summaries.rb deleted file mode 100644 index 1bf81867b..000000000 --- a/db/migrate/20241022180042_create_event_summaries.rb +++ /dev/null @@ -1,7 +0,0 @@ -class CreateEventSummaries < ActiveRecord::Migration[8.0] - def change - create_table :event_summaries do |t| - t.timestamps - end - end -end diff --git a/db/migrate/20241022180133_add_summary_reference_to_events.rb b/db/migrate/20241022180133_add_summary_reference_to_events.rb deleted file mode 100644 index 411e6c94e..000000000 --- a/db/migrate/20241022180133_add_summary_reference_to_events.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddSummaryReferenceToEvents < ActiveRecord::Migration[8.0] - def change - add_reference :events, :summary, foreign_key: { to_table: :event_summaries }, index: false - add_index :events, %i[ summary_id action ] - - remove_index :events, %i[ bubble_id action ] - remove_column :events, :bubble_id, :references, null: false, index: false - end -end diff --git a/db/migrate/20241025224942_remove_bubble_reference_from_comments.rb b/db/migrate/20241025224942_remove_bubble_reference_from_comments.rb deleted file mode 100644 index f99c189a5..000000000 --- a/db/migrate/20241025224942_remove_bubble_reference_from_comments.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveBubbleReferenceFromComments < ActiveRecord::Migration[8.0] - def change - remove_column :comments, :bubble_id, :references, null: false, index: false - end -end diff --git a/db/migrate/20241028183212_make_event_summary_not_null.rb b/db/migrate/20241028183212_make_event_summary_not_null.rb deleted file mode 100644 index 131b92566..000000000 --- a/db/migrate/20241028183212_make_event_summary_not_null.rb +++ /dev/null @@ -1,5 +0,0 @@ -class MakeEventSummaryNotNull < ActiveRecord::Migration[8.0] - def change - change_column_null :events, :summary_id, false - end -end diff --git a/db/migrate/20241105181312_rename_bucket_views_to_filters.rb b/db/migrate/20241105181312_rename_bucket_views_to_filters.rb deleted file mode 100644 index 6c5381aeb..000000000 --- a/db/migrate/20241105181312_rename_bucket_views_to_filters.rb +++ /dev/null @@ -1,20 +0,0 @@ -class RenameBucketViewsToFilters < ActiveRecord::Migration[8.0] - def change - rename_table :bucket_views, :filters - - remove_index :filters, %i[ bucket_id creator_id filters_hash ], unique: true - remove_index :filters, :creator_id - remove_column :filters, :filters_hash, :string - - remove_reference :filters, :bucket - - rename_column :filters, :filters, :params - - add_column :filters, :fields, :json, null: false, default: -> { '(JSON_OBJECT())' } - - # MySQL doesn't support direct indexing of JSON columns. Create a generated - # hash column for the params JSON data to enforce uniqueness. - add_column :filters, :params_hash, :string, limit: 64, as: "SHA2(params, 256)", stored: true - add_index :filters, %i[ creator_id params_hash ], unique: true - end -end diff --git a/db/migrate/20241105224305_create_filter_join_tables.rb b/db/migrate/20241105224305_create_filter_join_tables.rb deleted file mode 100644 index 31a0bc697..000000000 --- a/db/migrate/20241105224305_create_filter_join_tables.rb +++ /dev/null @@ -1,18 +0,0 @@ -class CreateFilterJoinTables < ActiveRecord::Migration[8.0] - def change - create_join_table :filters, :tags do |t| - t.index :filter_id - t.index :tag_id - end - - create_join_table :filters, :buckets do |t| - t.index :filter_id - t.index :bucket_id - end - - create_join_table :filters, :assignees do |t| - t.index :filter_id - t.index :assignee_id - end - end -end diff --git a/db/migrate/20241108205445_hash_filter_params.rb b/db/migrate/20241108205445_hash_filter_params.rb deleted file mode 100644 index 7379e13a9..000000000 --- a/db/migrate/20241108205445_hash_filter_params.rb +++ /dev/null @@ -1,10 +0,0 @@ -class HashFilterParams < ActiveRecord::Migration[8.0] - def change - remove_index :filters, %i[ creator_id params_hash ], unique: true - remove_column :filters, :params_hash - remove_column :filters, :params - - add_column :filters, :params_digest, :string, null: false - add_index :filters, %i[ creator_id params_digest ], unique: true - end -end diff --git a/db/migrate/20241113185136_create_filter_assigner_join_table.rb b/db/migrate/20241113185136_create_filter_assigner_join_table.rb deleted file mode 100644 index 0ba861f47..000000000 --- a/db/migrate/20241113185136_create_filter_assigner_join_table.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateFilterAssignerJoinTable < ActiveRecord::Migration[8.0] - def change - create_join_table :filters, :assigners do |t| - t.index :filter_id - t.index :assigner_id - end - end -end diff --git a/db/migrate/20241115234456_add_comments_count_to_bubbles.rb b/db/migrate/20241115234456_add_comments_count_to_bubbles.rb deleted file mode 100644 index 82140ef9b..000000000 --- a/db/migrate/20241115234456_add_comments_count_to_bubbles.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddCommentsCountToBubbles < ActiveRecord::Migration[8.0] - def change - add_column :bubbles, :comments_count, :integer, null: false, default: 0 - end -end diff --git a/db/migrate/20241115234505_add_activity_score_to_bubbles.rb b/db/migrate/20241115234505_add_activity_score_to_bubbles.rb deleted file mode 100644 index df934bd7f..000000000 --- a/db/migrate/20241115234505_add_activity_score_to_bubbles.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddActivityScoreToBubbles < ActiveRecord::Migration[8.0] - def change - add_column :bubbles, :activity_score, :integer, null: false, default: 0 - end -end diff --git a/db/migrate/20241119201943_rename_boost_count_to_boosts_count.rb b/db/migrate/20241119201943_rename_boost_count_to_boosts_count.rb deleted file mode 100644 index aff5d0b3a..000000000 --- a/db/migrate/20241119201943_rename_boost_count_to_boosts_count.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameBoostCountToBoostsCount < ActiveRecord::Migration[8.0] - def change - rename_column :bubbles, :boost_count, :boosts_count - end -end diff --git a/db/migrate/20241120222444_make_taggings_unique_per_bubble.rb b/db/migrate/20241120222444_make_taggings_unique_per_bubble.rb deleted file mode 100644 index 34797bd11..000000000 --- a/db/migrate/20241120222444_make_taggings_unique_per_bubble.rb +++ /dev/null @@ -1,9 +0,0 @@ -class MakeTaggingsUniquePerBubble < ActiveRecord::Migration[8.0] - def change - # Add the composite index first, then remove the old single-column index. - # MySQL requires an index for foreign key constraints, so we need the new - # composite index in place before removing the old one. - add_index :taggings, %i[ bubble_id tag_id ], unique: true - remove_index :taggings, :bubble_id - end -end diff --git a/db/migrate/20241126232658_remove_body_from_comments.rb b/db/migrate/20241126232658_remove_body_from_comments.rb deleted file mode 100644 index bf2282a42..000000000 --- a/db/migrate/20241126232658_remove_body_from_comments.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveBodyFromComments < ActiveRecord::Migration[8.0] - def change - remove_column :comments, :body, :text, null: false - end -end diff --git a/db/migrate/20241209223551_add_all_access_to_bucket.rb b/db/migrate/20241209223551_add_all_access_to_bucket.rb deleted file mode 100644 index d57855ad1..000000000 --- a/db/migrate/20241209223551_add_all_access_to_bucket.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddAllAccessToBucket < ActiveRecord::Migration[8.1] - def change - add_column :buckets, :all_access, :boolean, default: false, null: false - end -end diff --git a/db/migrate/20250107165422_add_status_to_bubbles.rb b/db/migrate/20250107165422_add_status_to_bubbles.rb deleted file mode 100644 index 06a1eb566..000000000 --- a/db/migrate/20250107165422_add_status_to_bubbles.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddStatusToBubbles < ActiveRecord::Migration[8.1] - def change - add_column :bubbles, :status, :string, default: "drafted", null: false - end -end diff --git a/db/migrate/20250109153649_create_notifications.rb b/db/migrate/20250109153649_create_notifications.rb deleted file mode 100644 index c4b1391d9..000000000 --- a/db/migrate/20250109153649_create_notifications.rb +++ /dev/null @@ -1,15 +0,0 @@ -class CreateNotifications < ActiveRecord::Migration[8.1] - def change - create_table :notifications do |t| - t.references :user, null: false, foreign_key: true - t.references :event, null: false, foreign_key: true - t.references :bubble, null: false, foreign_key: true - t.references :resource, null: false, polymorphic: true, index: true - t.boolean :read, default: false, null: false - - t.timestamps - - t.index %i[ user_id read created_at ], order: { read: :desc, created_at: :desc } - end - end -end diff --git a/db/migrate/20250115122810_ensure_existing_bubbles_are_published.rb b/db/migrate/20250115122810_ensure_existing_bubbles_are_published.rb deleted file mode 100644 index 7a097ccbb..000000000 --- a/db/migrate/20250115122810_ensure_existing_bubbles_are_published.rb +++ /dev/null @@ -1,5 +0,0 @@ -class EnsureExistingBubblesArePublished < ActiveRecord::Migration[8.1] - def change - execute "update bubbles set status = 'published' where status = 'drafted'" - end -end diff --git a/db/migrate/20250116163344_change_notification_read_to_read_at.rb b/db/migrate/20250116163344_change_notification_read_to_read_at.rb deleted file mode 100644 index c9bd6bf64..000000000 --- a/db/migrate/20250116163344_change_notification_read_to_read_at.rb +++ /dev/null @@ -1,12 +0,0 @@ -class ChangeNotificationReadToReadAt < ActiveRecord::Migration[8.1] - def change - remove_index :notifications, %i[ user_id read created_at ], order: { read: :desc, created_at: :desc } - - change_table :notifications do |t| - t.remove :read - t.datetime :read_at - - t.index %i[ user_id read_at created_at ], order: { read_at: :desc, created_at: :desc } - end - end -end diff --git a/db/migrate/20250117142146_associate_events_with_bubbles.rb b/db/migrate/20250117142146_associate_events_with_bubbles.rb deleted file mode 100644 index 30f824d96..000000000 --- a/db/migrate/20250117142146_associate_events_with_bubbles.rb +++ /dev/null @@ -1,17 +0,0 @@ -class AssociateEventsWithBubbles < ActiveRecord::Migration[8.1] - def change - change_table :events do |t| - t.references :bubble, foreign_key: true - end - - # MySQL uses JOIN syntax for multi-table updates, not FROM clause - execute " - update events - join event_summaries es on events.summary_id = es.id - join messages m on m.messageable_type = 'EventSummary' and m.messageable_id = es.id - set events.bubble_id = m.bubble_id - " - - change_column_null :events, :bubble_id, false - end -end diff --git a/db/migrate/20250121174109_create_filter_stages_join_table.rb b/db/migrate/20250121174109_create_filter_stages_join_table.rb deleted file mode 100644 index 268e648d3..000000000 --- a/db/migrate/20250121174109_create_filter_stages_join_table.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateFilterStagesJoinTable < ActiveRecord::Migration[8.1] - def change - create_join_table :filters, :stages do |t| - t.index :filter_id - t.index :stage_id - end - end -end diff --git a/db/migrate/20250204211520_add_due_date_to_events.rb b/db/migrate/20250204211520_add_due_date_to_events.rb deleted file mode 100644 index 635d74d8b..000000000 --- a/db/migrate/20250204211520_add_due_date_to_events.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddDueDateToEvents < ActiveRecord::Migration[8.1] - def change - add_column :events, :due_date, :date - end -end diff --git a/db/migrate/20250206141302_change_bubbles_status_default_to_creating.rb b/db/migrate/20250206141302_change_bubbles_status_default_to_creating.rb deleted file mode 100644 index 004fe75d0..000000000 --- a/db/migrate/20250206141302_change_bubbles_status_default_to_creating.rb +++ /dev/null @@ -1,5 +0,0 @@ -class ChangeBubblesStatusDefaultToCreating < ActiveRecord::Migration[8.1] - def change - change_column_default :bubbles, :status, :creating - end -end diff --git a/db/migrate/20250212094743_add_role_to_users.rb b/db/migrate/20250212094743_add_role_to_users.rb deleted file mode 100644 index 899715d16..000000000 --- a/db/migrate/20250212094743_add_role_to_users.rb +++ /dev/null @@ -1,10 +0,0 @@ -class AddRoleToUsers < ActiveRecord::Migration[8.1] - def change - change_table :users do |t| - t.string :role, null: false, default: :member, index: true - end - - change_column_null :users, :email_address, true - change_column_null :users, :password_digest, true - end -end diff --git a/db/migrate/20250212103251_add_auto_pop_at_to_bubbles.rb b/db/migrate/20250212103251_add_auto_pop_at_to_bubbles.rb deleted file mode 100644 index a5483094a..000000000 --- a/db/migrate/20250212103251_add_auto_pop_at_to_bubbles.rb +++ /dev/null @@ -1,21 +0,0 @@ -class AddAutoPopAtToBubbles < ActiveRecord::Migration[8.1] - def change - change_table :bubbles do |t| - t.datetime :auto_pop_at, index: true - end - - # MySQL uses JOIN syntax for multi-table updates and DATE_ADD for date arithmetic - execute " - update bubbles - join ( - select bubbles.id as bubble_id, coalesce(max(events.created_at), bubbles.created_at) as last_active_at - from bubbles - left join events on bubbles.id = events.bubble_id - group by bubbles.id - ) as activity on bubbles.id = activity.bubble_id - set bubbles.auto_pop_at = DATE_ADD(activity.last_active_at, INTERVAL 30 DAY) - " - - change_column_null :bubbles, :auto_pop_at, false - end -end diff --git a/db/migrate/20250214222911_create_reactions.rb b/db/migrate/20250214222911_create_reactions.rb deleted file mode 100644 index be74c4645..000000000 --- a/db/migrate/20250214222911_create_reactions.rb +++ /dev/null @@ -1,14 +0,0 @@ -class CreateReactions < ActiveRecord::Migration[8.1] - def change - create_table :reactions do |t| - t.integer :comment_id, null: false - t.integer :reacter_id, null: false - t.string :content, limit: 16, null: false - - t.timestamps - end - - add_index :reactions, :comment_id - add_index :reactions, :reacter_id - end -end diff --git a/db/migrate/20250220220416_create_creators_filters_join_table.rb b/db/migrate/20250220220416_create_creators_filters_join_table.rb deleted file mode 100644 index be26b71fe..000000000 --- a/db/migrate/20250220220416_create_creators_filters_join_table.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateCreatorsFiltersJoinTable < ActiveRecord::Migration[8.1] - def change - create_table :creators_filters, id: false do |t| - t.integer :filter_id, null: false - t.integer :creator_id, null: false - end - - add_index :creators_filters, :filter_id - add_index :creators_filters, :creator_id - end -end diff --git a/db/migrate/20250220220424_drop_assigners_filters_join_table.rb b/db/migrate/20250220220424_drop_assigners_filters_join_table.rb deleted file mode 100644 index 8db27a724..000000000 --- a/db/migrate/20250220220424_drop_assigners_filters_join_table.rb +++ /dev/null @@ -1,7 +0,0 @@ -class DropAssignersFiltersJoinTable < ActiveRecord::Migration[8.1] - class DropAssignersFiltersJoinTable < ActiveRecord::Migration[7.1] - def change - drop_table :assigners_filters if table_exists?(:assigners_filters) - end - end -end diff --git a/db/migrate/20250224111311_create_watches.rb b/db/migrate/20250224111311_create_watches.rb deleted file mode 100644 index 614bea5f3..000000000 --- a/db/migrate/20250224111311_create_watches.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateWatches < ActiveRecord::Migration[8.1] - def change - create_table :watches do |t| - t.references :user, null: false, foreign_key: true - t.references :bubble, null: false, foreign_key: true - t.boolean :watching, null: false, default: true - - t.timestamps - end - end -end diff --git a/db/migrate/20250224152047_create_subscriptions.rb b/db/migrate/20250224152047_create_subscriptions.rb deleted file mode 100644 index e234e0a8b..000000000 --- a/db/migrate/20250224152047_create_subscriptions.rb +++ /dev/null @@ -1,18 +0,0 @@ -class CreateSubscriptions < ActiveRecord::Migration[8.1] - def change - create_table :subscriptions do |t| - t.references :subscribable, polymorphic: true, null: false, index: true - t.references :user, null: false, foreign_key: true - - t.timestamps - - t.index [ :subscribable_type, :subscribable_id, :user_id ], unique: true - end - - # Subscribe everyone to their current buckets to start with - execute " - insert into subscriptions (subscribable_type, subscribable_id, user_id, created_at, updated_at) - select 'Bucket', bucket_id, user_id, current_timestamp, current_timestamp from accesses; - " - end -end diff --git a/db/migrate/20250304140641_add_activity_score_at_to_bubbles.rb b/db/migrate/20250304140641_add_activity_score_at_to_bubbles.rb deleted file mode 100644 index 406124742..000000000 --- a/db/migrate/20250304140641_add_activity_score_at_to_bubbles.rb +++ /dev/null @@ -1,11 +0,0 @@ -class AddActivityScoreAtToBubbles < ActiveRecord::Migration[8.1] - def change - change_table :bubbles do |t| - t.datetime :activity_score_at - t.float :activity_score_order, null: false, default: 0 - t.change :activity_score, :float, null: false, default: 0 - - t.index :activity_score_order, order: :desc - end - end -end diff --git a/db/migrate/20250318005138_create_pins.rb b/db/migrate/20250318005138_create_pins.rb deleted file mode 100644 index 48632de2a..000000000 --- a/db/migrate/20250318005138_create_pins.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreatePins < ActiveRecord::Migration[7.0] - def change - create_table :pins do |t| - t.references :bubble, null: false, foreign_key: true - t.references :user, null: false, foreign_key: true - t.timestamps - end - - add_index :pins, [ :bubble_id, :user_id ], unique: true - end -end diff --git a/db/migrate/20250319092704_add_involvement_to_accesses.rb b/db/migrate/20250319092704_add_involvement_to_accesses.rb deleted file mode 100644 index 73c70a3a9..000000000 --- a/db/migrate/20250319092704_add_involvement_to_accesses.rb +++ /dev/null @@ -1,7 +0,0 @@ -class AddInvolvementToAccesses < ActiveRecord::Migration[8.1] - def change - change_table :accesses do |t| - t.string :involvement, null: false, default: "watching" - end - end -end diff --git a/db/migrate/20250319161627_drop_subscriptions.rb b/db/migrate/20250319161627_drop_subscriptions.rb deleted file mode 100644 index 82347e0a7..000000000 --- a/db/migrate/20250319161627_drop_subscriptions.rb +++ /dev/null @@ -1,16 +0,0 @@ -class DropSubscriptions < ActiveRecord::Migration[8.1] - def change - execute " - update accesses set involvement = 'access_only' - " - # MySQL uses JOIN syntax for multi-table updates - execute " - update accesses - join (select user_id, subscribable_id as bucket_id from subscriptions) as subscriptions - on subscriptions.user_id = accesses.user_id and subscriptions.bucket_id = accesses.bucket_id - set accesses.involvement = 'watching' - " - - drop_table :subscriptions - end -end diff --git a/db/migrate/20250327191456_add_workflow_to_buckets.rb b/db/migrate/20250327191456_add_workflow_to_buckets.rb deleted file mode 100644 index 4efe294f2..000000000 --- a/db/migrate/20250327191456_add_workflow_to_buckets.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddWorkflowToBuckets < ActiveRecord::Migration[8.1] - def change - add_reference :buckets, :workflow, null: true, foreign_key: true - end -end diff --git a/db/migrate/20250403094604_create_bubble_engagements.rb b/db/migrate/20250403094604_create_bubble_engagements.rb deleted file mode 100644 index 06497be20..000000000 --- a/db/migrate/20250403094604_create_bubble_engagements.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CreateBubbleEngagements < ActiveRecord::Migration[8.1] - def change - create_table :bubble_engagements do |t| - t.references :bubble, index: true - - t.timestamps - end - end -end diff --git a/db/migrate/20250404072651_add_last_active_at_to_bubbles.rb b/db/migrate/20250404072651_add_last_active_at_to_bubbles.rb deleted file mode 100644 index 050b501bd..000000000 --- a/db/migrate/20250404072651_add_last_active_at_to_bubbles.rb +++ /dev/null @@ -1,20 +0,0 @@ -class AddLastActiveAtToBubbles < ActiveRecord::Migration[8.1] - def change - add_column :bubbles, :last_active_at, :datetime - add_index :bubbles, %i[ last_active_at status ] - - # MySQL uses JOIN syntax for multi-table updates - execute <<~SQL - update bubbles - join ( - select bubbles.id as bubble_id, coalesce(max(events.created_at), bubbles.created_at) as last_active_at - from bubbles - left join events on bubbles.id = events.bubble_id - group by bubbles.id - ) as activity on bubbles.id = activity.bubble_id - set bubbles.last_active_at = activity.last_active_at - SQL - - change_column_null :bubbles, :last_active_at, false - end -end diff --git a/db/migrate/20250404074315_remove_bubbles_auto_pop_at.rb b/db/migrate/20250404074315_remove_bubbles_auto_pop_at.rb deleted file mode 100644 index 1217d8216..000000000 --- a/db/migrate/20250404074315_remove_bubbles_auto_pop_at.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveBubblesAutoPopAt < ActiveRecord::Migration[8.1] - def change - remove_column :bubbles, :auto_pop_at - end -end diff --git a/db/migrate/20250404083727_add_reason_to_pops.rb b/db/migrate/20250404083727_add_reason_to_pops.rb deleted file mode 100644 index 598a36361..000000000 --- a/db/migrate/20250404083727_add_reason_to_pops.rb +++ /dev/null @@ -1,18 +0,0 @@ -class AddReasonToPops < ActiveRecord::Migration[8.1] - def change - add_column :pops, :reason, :string - - create_table :pop_reasons do |t| - t.references :account, index: true - t.string :label - - t.timestamps - end - - execute <<~SQL - update pops set reason = 'Closed' - SQL - - change_column_null :pops, :reason, false - end -end diff --git a/db/migrate/20250404133310_add_index_to_sort_pops_by_recency.rb b/db/migrate/20250404133310_add_index_to_sort_pops_by_recency.rb deleted file mode 100644 index c3c9f0dc0..000000000 --- a/db/migrate/20250404133310_add_index_to_sort_pops_by_recency.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddIndexToSortPopsByRecency < ActiveRecord::Migration[8.1] - def change - add_index :pops, %i[ bubble_id created_at ] - end -end diff --git a/db/migrate/20250409043626_rename_bubbles_to_cards.rb b/db/migrate/20250409043626_rename_bubbles_to_cards.rb deleted file mode 100644 index c842bbaf2..000000000 --- a/db/migrate/20250409043626_rename_bubbles_to_cards.rb +++ /dev/null @@ -1,55 +0,0 @@ -class RenameBubblesToCards < ActiveRecord::Migration[8.1] - def change - # Tables - rename_table "bubbles", "cards" - rename_table "bubble_engagements", "card_engagements" - rename_table "pops", "closures" - rename_table "pop_reasons", "closure_reasons" - rename_table "buckets", "collections" - rename_table "buckets_filters", "collections_filters" - - # Columns - rename_column "assignments", "bubble_id", "card_id" - rename_column "card_engagements", "bubble_id", "card_id" - rename_column "events", "bubble_id", "card_id" - rename_column "messages", "bubble_id", "card_id" - rename_column "notifications", "bubble_id", "card_id" - rename_column "pins", "bubble_id", "card_id" - rename_column "closures", "bubble_id", "card_id" - rename_column "taggings", "bubble_id", "card_id" - rename_column "watches", "bubble_id", "card_id" - - rename_column "cards", "bucket_id", "collection_id" - rename_column "accesses", "bucket_id", "collection_id" - rename_column "collections_filters", "bucket_id", "collection_id" - - # Indexes - # # No longer necessary in MySQL - # rename_index "assignments", "index_assignments_on_bubble_id", "index_assignments_on_card_id" - # rename_index "card_engagements", "index_bubble_engagements_on_bubble_id", "index_card_engagements_on_card_id" - # rename_index "events", "index_events_on_bubble_id", "index_events_on_card_id" - # rename_index "messages", "index_messages_on_bubble_id", "index_messages_on_card_id" - # rename_index "notifications", "index_notifications_on_bubble_id", "index_notifications_on_card_id" - # rename_index "pins", "index_pins_on_bubble_id", "index_pins_on_card_id" - # rename_index "pins", "index_pins_on_bubble_id_and_user_id", "index_pins_on_card_id_and_user_id" - # rename_index "closures", "index_pops_on_bubble_id", "index_closures_on_card_id" - # rename_index "closures", "index_pops_on_bubble_id_and_created_at", "index_closures_on_card_id_and_created_at" - # rename_index "watches", "index_watches_on_bubble_id", "index_watches_on_card_id" - # rename_index "taggings", "index_taggings_on_bubble_id_and_tag_id", "index_taggings_on_card_id_and_tag_id" - - # rename_index "accesses", "index_accesses_on_bucket_id", "index_accesses_on_collection_id" - # rename_index "accesses", "index_accesses_on_bucket_id_and_user_id", "index_accesses_on_collection_id_and_user_id" - # rename_index "collections_filters", "index_buckets_filters_on_bucket_id", "index_collections_filters_on_collection_id" - - # Search tables - # # TODO:PLANB: need to replace SQLite FTS - # execute <<~SQL - # CREATE VIRTUAL TABLE cards_search_index USING fts5(title); - # INSERT INTO cards_search_index(title) SELECT title FROM bubbles_search_index; - # SQL - - # execute <<~SQL - # DROP TABLE bubbles_search_index; - # SQL - end -end diff --git a/db/migrate/20250409200631_add_color_to_workflow_stages.rb b/db/migrate/20250409200631_add_color_to_workflow_stages.rb deleted file mode 100644 index 8221a6f20..000000000 --- a/db/migrate/20250409200631_add_color_to_workflow_stages.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddColorToWorkflowStages < ActiveRecord::Migration[8.1] - def change - add_column :workflow_stages, :color, :string - end -end diff --git a/db/migrate/20250409201424_remove_color_from_cards.rb b/db/migrate/20250409201424_remove_color_from_cards.rb deleted file mode 100644 index 7cf6d8d5f..000000000 --- a/db/migrate/20250409201424_remove_color_from_cards.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveColorFromCards < ActiveRecord::Migration[8.1] - def change - remove_column :cards, :color, :string - end -end diff --git a/db/migrate/20250410120631_add_accessed_at_to_accesses.rb b/db/migrate/20250410120631_add_accessed_at_to_accesses.rb deleted file mode 100644 index 8f8e68340..000000000 --- a/db/migrate/20250410120631_add_accessed_at_to_accesses.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddAccessedAtToAccesses < ActiveRecord::Migration[8.1] - def change - add_column :accesses, :accessed_at, :datetime - add_index :accesses, :accessed_at, order: { accessed_at: :desc } - end -end diff --git a/db/migrate/20250410141409_create_card_goldnesses.rb b/db/migrate/20250410141409_create_card_goldnesses.rb deleted file mode 100644 index f8268c243..000000000 --- a/db/migrate/20250410141409_create_card_goldnesses.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CreateCardGoldnesses < ActiveRecord::Migration[8.1] - def change - create_table :card_goldnesses do |t| - t.references :card, null: false, foreign_key: true, index: { unique: true } - - t.timestamps - end - end -end diff --git a/db/migrate/20250412084635_drop_card_comments_count.rb b/db/migrate/20250412084635_drop_card_comments_count.rb deleted file mode 100644 index 5a0d15e2f..000000000 --- a/db/migrate/20250412084635_drop_card_comments_count.rb +++ /dev/null @@ -1,5 +0,0 @@ -class DropCardCommentsCount < ActiveRecord::Migration[8.1] - def change - remove_column :cards, :comments_count - end -end diff --git a/db/migrate/20250412162339_remove_boosts_count_from_cards.rb b/db/migrate/20250412162339_remove_boosts_count_from_cards.rb deleted file mode 100644 index f6cb4aa66..000000000 --- a/db/migrate/20250412162339_remove_boosts_count_from_cards.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveBoostsCountFromCards < ActiveRecord::Migration[8.1] - def change - remove_column :cards, :boosts_count - end -end diff --git a/db/migrate/20250412170620_remove_account_ids.rb b/db/migrate/20250412170620_remove_account_ids.rb deleted file mode 100644 index b06bb83dd..000000000 --- a/db/migrate/20250412170620_remove_account_ids.rb +++ /dev/null @@ -1,9 +0,0 @@ -class RemoveAccountIds < ActiveRecord::Migration[8.1] - def change - remove_column :closure_reasons, :account_id - remove_column :collections, :account_id - remove_column :tags, :account_id - remove_column :users, :account_id - remove_column :workflows, :account_id - end -end diff --git a/db/migrate/20250415131630_remove_accounts_name_index.rb b/db/migrate/20250415131630_remove_accounts_name_index.rb deleted file mode 100644 index bb5921619..000000000 --- a/db/migrate/20250415131630_remove_accounts_name_index.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveAccountsNameIndex < ActiveRecord::Migration[8.1] - def change - remove_index :accounts, :name - end -end diff --git a/db/migrate/20250415131804_remove_accounts_join_code_index.rb b/db/migrate/20250415131804_remove_accounts_join_code_index.rb deleted file mode 100644 index 30a312211..000000000 --- a/db/migrate/20250415131804_remove_accounts_join_code_index.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveAccountsJoinCodeIndex < ActiveRecord::Migration[8.1] - def change - remove_index :accounts, :join_code - end -end diff --git a/db/migrate/20250418150259_remove_activity_from_cards.rb b/db/migrate/20250418150259_remove_activity_from_cards.rb deleted file mode 100644 index f8910ea9b..000000000 --- a/db/migrate/20250418150259_remove_activity_from_cards.rb +++ /dev/null @@ -1,8 +0,0 @@ -class RemoveActivityFromCards < ActiveRecord::Migration[8.1] - def change - remove_index :cards, :activity_score_order - remove_column :cards, :activity_score_order - remove_column :cards, :activity_score_at - remove_column :cards, :activity_score - end -end diff --git a/db/migrate/20250421120008_create_mentions.rb b/db/migrate/20250421120008_create_mentions.rb deleted file mode 100644 index db27f7b2c..000000000 --- a/db/migrate/20250421120008_create_mentions.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateMentions < ActiveRecord::Migration[8.1] - def change - create_table :mentions do |t| - t.references :source, polymorphic: true, null: false, index: true - t.references :mentionee, foreign_key: { to_table: :users }, null: false - t.references :mentioner, foreign_key: { to_table: :users }, null: false - - t.timestamps - end - end -end diff --git a/db/migrate/20250422054950_add_source_to_notifications.rb b/db/migrate/20250422054950_add_source_to_notifications.rb deleted file mode 100644 index c64dd68e1..000000000 --- a/db/migrate/20250422054950_add_source_to_notifications.rb +++ /dev/null @@ -1,11 +0,0 @@ -class AddSourceToNotifications < ActiveRecord::Migration[8.1] - def change - add_reference :notifications, :source, polymorphic: true, index: true - - execute <<~SQL - update notifications set source_type = 'Event', source_id = event_id; - SQL - - change_column_null :notifications, :source_type, false - end -end diff --git a/db/migrate/20250422062930_remove_unused_columns_from_notifications.rb b/db/migrate/20250422062930_remove_unused_columns_from_notifications.rb deleted file mode 100644 index 30f689c88..000000000 --- a/db/migrate/20250422062930_remove_unused_columns_from_notifications.rb +++ /dev/null @@ -1,6 +0,0 @@ -class RemoveUnusedColumnsFromNotifications < ActiveRecord::Migration[8.1] - def change - remove_column :notifications, :event_id - remove_column :notifications, :card_id - end -end diff --git a/db/migrate/20250422091602_remove_due_date_from_events.rb b/db/migrate/20250422091602_remove_due_date_from_events.rb deleted file mode 100644 index 5a636e3dd..000000000 --- a/db/migrate/20250422091602_remove_due_date_from_events.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveDueDateFromEvents < ActiveRecord::Migration[8.1] - def change - remove_column :events, :due_date - end -end diff --git a/db/migrate/20250422112857_add_creator_to_notifications.rb b/db/migrate/20250422112857_add_creator_to_notifications.rb deleted file mode 100644 index 63635565c..000000000 --- a/db/migrate/20250422112857_add_creator_to_notifications.rb +++ /dev/null @@ -1,18 +0,0 @@ -class AddCreatorToNotifications < ActiveRecord::Migration[8.1] - def change - add_reference :notifications, :creator, null: true, foreign_key: { to_table: :users } - - execute <<~SQL - UPDATE notifications - SET creator_id = ( - SELECT events.creator_id - FROM events - WHERE events.id = notifications.source_id - AND notifications.source_type = 'Event' - ) - WHERE source_type = 'Event'; - SQL - - change_column_null :notifications, :creator_id, true - end -end diff --git a/db/migrate/20250423114737_remove_notification_resources.rb b/db/migrate/20250423114737_remove_notification_resources.rb deleted file mode 100644 index 6c19062f7..000000000 --- a/db/migrate/20250423114737_remove_notification_resources.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveNotificationResources < ActiveRecord::Migration[8.1] - def change - remove_reference :notifications, :resource, polymorphic: true, index: true - end -end diff --git a/db/migrate/20250424045407_make_events_eventable.rb b/db/migrate/20250424045407_make_events_eventable.rb deleted file mode 100644 index 3094a77ae..000000000 --- a/db/migrate/20250424045407_make_events_eventable.rb +++ /dev/null @@ -1,14 +0,0 @@ -class MakeEventsEventable < ActiveRecord::Migration[8.1] - def change - add_reference :events, :eventable, polymorphic: true, index: true - - execute <<~SQL - update events set eventable_type = 'Card', eventable_id = card_id; - SQL - - change_column_null :events, :eventable_id, false - change_column_null :events, :eventable_type, false - - remove_reference :events, :card - end -end diff --git a/db/migrate/20250424045639_make_notifications_source_id_not_nullable.rb b/db/migrate/20250424045639_make_notifications_source_id_not_nullable.rb deleted file mode 100644 index 512a9e34f..000000000 --- a/db/migrate/20250424045639_make_notifications_source_id_not_nullable.rb +++ /dev/null @@ -1,5 +0,0 @@ -class MakeNotificationsSourceIdNotNullable < ActiveRecord::Migration[8.1] - def change - change_column_null :notifications, :source_id, false - end -end diff --git a/db/migrate/20250424051059_add_collection_id_to_events.rb b/db/migrate/20250424051059_add_collection_id_to_events.rb deleted file mode 100644 index 6270d27c5..000000000 --- a/db/migrate/20250424051059_add_collection_id_to_events.rb +++ /dev/null @@ -1,17 +0,0 @@ -class AddCollectionIdToEvents < ActiveRecord::Migration[8.1] - def change - add_reference :events, :collection, foreign_key: true, index: true - - execute <<~SQL - UPDATE events - SET collection_id = ( - SELECT cards.collection_id - FROM cards - WHERE cards.id = events.eventable_id - ) - WHERE eventable_type = 'Card'#{' '} - SQL - - change_column_null :events, :collection_id, false - end -end diff --git a/db/migrate/20250424105223_make_event_summary_optional.rb b/db/migrate/20250424105223_make_event_summary_optional.rb deleted file mode 100644 index f8701dc38..000000000 --- a/db/migrate/20250424105223_make_event_summary_optional.rb +++ /dev/null @@ -1,5 +0,0 @@ -class MakeEventSummaryOptional < ActiveRecord::Migration[8.1] - def change - change_column_null :events, :summary_id, true - end -end diff --git a/db/migrate/20250425070025_migrate_existing_events_prefixes.rb b/db/migrate/20250425070025_migrate_existing_events_prefixes.rb deleted file mode 100644 index 0b3840be9..000000000 --- a/db/migrate/20250425070025_migrate_existing_events_prefixes.rb +++ /dev/null @@ -1,20 +0,0 @@ -class MigrateExistingEventsPrefixes < ActiveRecord::Migration[8.1] - def change - execute <<-SQL - UPDATE events - SET - action = CASE - WHEN action = 'commented' THEN 'comment_created' - ELSE 'card_' || action - END, - eventable_id = CASE - WHEN action = 'commented' THEN json_extract(particulars, '$.comment_id') - ELSE eventable_id - END, - eventable_type = CASE - WHEN action = 'commented' THEN 'Comment' - ELSE eventable_type - END; - SQL - end -end diff --git a/db/migrate/20250425092727_add_auto_close_period_to_collections.rb b/db/migrate/20250425092727_add_auto_close_period_to_collections.rb deleted file mode 100644 index 5a96c9a60..000000000 --- a/db/migrate/20250425092727_add_auto_close_period_to_collections.rb +++ /dev/null @@ -1,11 +0,0 @@ -class AddAutoClosePeriodToCollections < ActiveRecord::Migration[8.1] - def change - add_column :collections, :auto_close_period, :bigint - - add_index :collections, :auto_close_period - - execute <<~SQL - UPDATE collections SET auto_close_period = #{30.days.to_i} WHERE auto_close_period IS NULL; - SQL - end -end diff --git a/db/migrate/20250429162506_flatten_messages_and_comments.rb b/db/migrate/20250429162506_flatten_messages_and_comments.rb deleted file mode 100644 index 090a0201e..000000000 --- a/db/migrate/20250429162506_flatten_messages_and_comments.rb +++ /dev/null @@ -1,21 +0,0 @@ -class FlattenMessagesAndComments < ActiveRecord::Migration[8.1] - def change - add_reference :comments, :card, null: true, foreign_key: true - - execute <<~SQL - UPDATE comments - SET card_id = ( - SELECT messages.card_id - FROM messages - WHERE messages.messageable_type = 'Comment' - AND messages.messageable_id = comments.id - LIMIT 1 - ) - SQL - - remove_column :events, :summary_id - change_column_null :comments, :card_id, false - drop_table :messages - drop_table :event_summaries - end -end diff --git a/db/migrate/20250505123008_create_commands.rb b/db/migrate/20250505123008_create_commands.rb deleted file mode 100644 index ee47da225..000000000 --- a/db/migrate/20250505123008_create_commands.rb +++ /dev/null @@ -1,13 +0,0 @@ -class CreateCommands < ActiveRecord::Migration[8.1] - def change - create_table :commands do |t| - t.references :user, null: false, foreign_key: true, index: true - t.string :type - t.column :data, :json, default: -> { '(JSON_OBJECT())' } - - t.timestamps - - t.index %i[ user_id created_at ] - end - end -end diff --git a/db/migrate/20250507095113_add_line_to_commands.rb b/db/migrate/20250507095113_add_line_to_commands.rb deleted file mode 100644 index 2978f9869..000000000 --- a/db/migrate/20250507095113_add_line_to_commands.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddLineToCommands < ActiveRecord::Migration[8.1] - def change - add_column :commands, :line, :text - end -end diff --git a/db/migrate/20250515125505_add_parent_column_to_commands.rb b/db/migrate/20250515125505_add_parent_column_to_commands.rb deleted file mode 100644 index decd29a52..000000000 --- a/db/migrate/20250515125505_add_parent_column_to_commands.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddParentColumnToCommands < ActiveRecord::Migration[8.1] - def change - add_reference :commands, :parent, null: true, foreign_key: { to_table: :commands } - add_index :commands, %i[ user_id parent_id created_at ] - end -end diff --git a/db/migrate/20250523084734_create_action_text_tables.action_text.rb b/db/migrate/20250523084734_create_action_text_tables.action_text.rb deleted file mode 100644 index c1c0a9d8c..000000000 --- a/db/migrate/20250523084734_create_action_text_tables.action_text.rb +++ /dev/null @@ -1,26 +0,0 @@ -# This migration comes from action_text (originally 20180528164100) -class CreateActionTextTables < ActiveRecord::Migration[6.0] - def change - # Use Active Record's configured type for primary and foreign keys - primary_key_type, foreign_key_type = primary_and_foreign_key_types - - create_table :action_text_rich_texts, id: primary_key_type do |t| - t.string :name, null: false - t.text :body, size: :long - t.references :record, null: false, polymorphic: true, index: false, type: foreign_key_type - - t.timestamps - - t.index [ :record_type, :record_id, :name ], name: "index_action_text_rich_texts_uniqueness", unique: true - end - end - - private - def primary_and_foreign_key_types - config = Rails.configuration.generators - setting = config.options[config.orm][:primary_key_type] - primary_key_type = setting || :primary_key - foreign_key_type = setting || :bigint - [ primary_key_type, foreign_key_type ] - end -end diff --git a/db/migrate/20250604071718_create_entropy_configurations.rb b/db/migrate/20250604071718_create_entropy_configurations.rb deleted file mode 100644 index 702d4d9cd..000000000 --- a/db/migrate/20250604071718_create_entropy_configurations.rb +++ /dev/null @@ -1,15 +0,0 @@ -class CreateEntropyConfigurations < ActiveRecord::Migration[8.1] - def change - create_table :entropy_configurations do |t| - t.references :container, polymorphic: true, null: false, index: { unique: true } - - t.bigint :auto_close_period, null: false, default: 30.days.to_i - t.bigint :auto_reconsider_period, null: false, default: 30.days.to_i - - t.timestamps - - t.index %i[ container_type container_id auto_close_period ] - t.index %i[ container_type container_id auto_reconsider_period ] - end - end -end diff --git a/db/migrate/20250604080022_remove_auto_close_period_from_collections.rb b/db/migrate/20250604080022_remove_auto_close_period_from_collections.rb deleted file mode 100644 index 226655f84..000000000 --- a/db/migrate/20250604080022_remove_auto_close_period_from_collections.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveAutoClosePeriodFromCollections < ActiveRecord::Migration[8.1] - def change - remove_column :collections, :auto_close_period - end -end diff --git a/db/migrate/20250604120033_create_activity_spikes.rb b/db/migrate/20250604120033_create_activity_spikes.rb deleted file mode 100644 index d78e19b10..000000000 --- a/db/migrate/20250604120033_create_activity_spikes.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateActivitySpikes < ActiveRecord::Migration[8.1] - def change - create_table :card_activity_spikes do |t| - t.references :card, null: false, foreign_key: true, index: true - t.timestamps - end - end -end diff --git a/db/migrate/20250609102553_create_collection_publications.rb b/db/migrate/20250609102553_create_collection_publications.rb deleted file mode 100644 index fba3255a6..000000000 --- a/db/migrate/20250609102553_create_collection_publications.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateCollectionPublications < ActiveRecord::Migration[8.1] - def change - create_table :collection_publications do |t| - t.references :collection, null: false, foreign_key: true, index: true - t.string :key, index: { unique: true } - - t.timestamps - end - end -end diff --git a/db/migrate/20250611203906_add_queenbee_id_to_accounts.rb b/db/migrate/20250611203906_add_queenbee_id_to_accounts.rb deleted file mode 100644 index 8d1d55ad4..000000000 --- a/db/migrate/20250611203906_add_queenbee_id_to_accounts.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddQueenbeeIdToAccounts < ActiveRecord::Migration[8.1] - def change - add_column :accounts, :queenbee_id, :integer # I solemnly swear I will add a "NOT NULL" constraint once it's populated - add_index :accounts, :queenbee_id, unique: true - end -end diff --git a/db/migrate/20250612163028_add_signal_user_id_to_users.rb b/db/migrate/20250612163028_add_signal_user_id_to_users.rb deleted file mode 100644 index 5caddaea9..000000000 --- a/db/migrate/20250612163028_add_signal_user_id_to_users.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddSignalUserIdToUsers < ActiveRecord::Migration[8.1] - def change - add_column :users, :signal_user_id, :integer - add_index :users, :signal_user_id, unique: true - end -end diff --git a/db/migrate/20250624055720_add_description_to_cards_search_index.rb b/db/migrate/20250624055720_add_description_to_cards_search_index.rb deleted file mode 100644 index 75c5b4157..000000000 --- a/db/migrate/20250624055720_add_description_to_cards_search_index.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddDescriptionToCardsSearchIndex < ActiveRecord::Migration[8.1] - def change - # # TODO:PLANB: need to replace SQLite FTS - # execute <<~SQL - # DROP TABLE cards_search_index; - # SQL - # create_virtual_table :cards_search_index, "fts5", [ "title", "description" ] - end -end diff --git a/db/migrate/20250624063244_create_search_results.rb b/db/migrate/20250624063244_create_search_results.rb deleted file mode 100644 index fd88b13c6..000000000 --- a/db/migrate/20250624063244_create_search_results.rb +++ /dev/null @@ -1,7 +0,0 @@ -class CreateSearchResults < ActiveRecord::Migration[8.1] - def change - create_table :search_results do |t| - t.timestamps - end - end -end diff --git a/db/migrate/20250624080408_create_search_queries.rb b/db/migrate/20250624080408_create_search_queries.rb deleted file mode 100644 index 574edd941..000000000 --- a/db/migrate/20250624080408_create_search_queries.rb +++ /dev/null @@ -1,15 +0,0 @@ -class CreateSearchQueries < ActiveRecord::Migration[8.1] - def change - create_table :search_queries do |t| - t.references :user, null: false, foreign_key: true - t.string :terms, limit: 2000, null: false - - t.timestamps - - # MySQL has a max key length of 3072 bytes. With utf8mb4 (4 bytes/char), - # we can only index 768 characters. Using a 255 character prefix is - # sufficient for search query lookups while staying well under the limit. - t.index "user_id, terms(255)", name: "index_search_queries_on_user_id_and_terms" - end - end -end diff --git a/db/migrate/20250625073215_drop_search_embeddings.rb b/db/migrate/20250625073215_drop_search_embeddings.rb deleted file mode 100644 index f44ca2de3..000000000 --- a/db/migrate/20250625073215_drop_search_embeddings.rb +++ /dev/null @@ -1,5 +0,0 @@ -class DropSearchEmbeddings < ActiveRecord::Migration[8.1] - def change - drop_table :search_embeddings if table_exists?(:search_embeddings) - end -end diff --git a/db/migrate/20250625111932_add_stemming.rb b/db/migrate/20250625111932_add_stemming.rb deleted file mode 100644 index e1168775d..000000000 --- a/db/migrate/20250625111932_add_stemming.rb +++ /dev/null @@ -1,10 +0,0 @@ -class AddStemming < ActiveRecord::Migration[8.1] - def change - # # TODO:PLANB: need to replace SQLite FTS - # drop_table :cards_search_index - # drop_table :comments_search_index - - # create_virtual_table "cards_search_index", "fts5", [ "title", "description", "tokenize='porter'" ] - # create_virtual_table "comments_search_index", "fts5", [ "body", "tokenize='porter'" ] - end -end diff --git a/db/migrate/20250625120000_add_steps_to_cards.rb b/db/migrate/20250625120000_add_steps_to_cards.rb deleted file mode 100644 index 938df396e..000000000 --- a/db/migrate/20250625120000_add_steps_to_cards.rb +++ /dev/null @@ -1,13 +0,0 @@ -class AddStepsToCards < ActiveRecord::Migration[8.1] - def change - create_table :steps do |t| - t.references :card, null: false, foreign_key: true - t.text :content, null: false - t.boolean :completed, default: false, null: false - - t.timestamps - end - - add_index :steps, :completed - end -end diff --git a/db/migrate/20250626000000_create_closers_filters_join_table.rb b/db/migrate/20250626000000_create_closers_filters_join_table.rb deleted file mode 100644 index 4c6a53392..000000000 --- a/db/migrate/20250626000000_create_closers_filters_join_table.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateClosersFiltersJoinTable < ActiveRecord::Migration[8.1] - def change - create_table :closers_filters, id: false do |t| - t.integer :filter_id, null: false - t.integer :closer_id, null: false - end - - add_index :closers_filters, :filter_id - add_index :closers_filters, :closer_id - end -end diff --git a/db/migrate/20250702160230_add_not_null_to_accounts_queenbee_id.rb b/db/migrate/20250702160230_add_not_null_to_accounts_queenbee_id.rb deleted file mode 100644 index 9698302bf..000000000 --- a/db/migrate/20250702160230_add_not_null_to_accounts_queenbee_id.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddNotNullToAccountsQueenbeeId < ActiveRecord::Migration[8.1] - def change - change_column_null :accounts, :queenbee_id, false - end -end diff --git a/db/migrate/20250702211937_change_steps_index.rb b/db/migrate/20250702211937_change_steps_index.rb deleted file mode 100644 index 2af0f50d4..000000000 --- a/db/migrate/20250702211937_change_steps_index.rb +++ /dev/null @@ -1,6 +0,0 @@ -class ChangeStepsIndex < ActiveRecord::Migration[8.1] - def change - remove_index :steps, :completed - add_index :steps, %i[ card_id completed ] - end -end diff --git a/db/migrate/20250703193928_add_index_to_search_queries.rb b/db/migrate/20250703193928_add_index_to_search_queries.rb deleted file mode 100644 index d8cd7bc59..000000000 --- a/db/migrate/20250703193928_add_index_to_search_queries.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddIndexToSearchQueries < ActiveRecord::Migration[8.1] - def change - add_index :search_queries, %w[ user_id updated_at ], unique: true - end -end diff --git a/db/migrate/20250714222221_add_push_subscriptions.rb b/db/migrate/20250714222221_add_push_subscriptions.rb deleted file mode 100644 index 486d975ea..000000000 --- a/db/migrate/20250714222221_add_push_subscriptions.rb +++ /dev/null @@ -1,17 +0,0 @@ -class AddPushSubscriptions < ActiveRecord::Migration[8.1] - def change - create_table :push_subscriptions do |t| - t.references :user, null: false, foreign_key: true - t.string :endpoint - t.string :p256dh_key - t.string :auth_key - t.string :user_agent - t.timestamps - - t.index [ :user_id, :endpoint ], unique: true - t.index :endpoint - t.index :user_agent - t.index [ "endpoint", "p256dh_key", "auth_key" ] - end - end -end diff --git a/db/migrate/20250721110000_create_event_activity_summaries.rb b/db/migrate/20250721110000_create_event_activity_summaries.rb deleted file mode 100644 index 0209d0d57..000000000 --- a/db/migrate/20250721110000_create_event_activity_summaries.rb +++ /dev/null @@ -1,13 +0,0 @@ -class CreateEventActivitySummaries < ActiveRecord::Migration[8.1] - def change - create_table :event_activity_summaries do |t| - t.string :key, null: false - t.text :contents, null: false - t.column :data, :json, default: -> { '(JSON_OBJECT())' } - - t.timestamps - - t.index [ :key ], unique: true - end - end -end diff --git a/db/migrate/20250722132226_remove_data_and_rename_column_in_event_activity_summaries.rb b/db/migrate/20250722132226_remove_data_and_rename_column_in_event_activity_summaries.rb deleted file mode 100644 index b49e5ce9e..000000000 --- a/db/migrate/20250722132226_remove_data_and_rename_column_in_event_activity_summaries.rb +++ /dev/null @@ -1,6 +0,0 @@ -class RemoveDataAndRenameColumnInEventActivitySummaries < ActiveRecord::Migration[8.1] - def change - remove_column :event_activity_summaries, :data, :jsonb - rename_column :event_activity_summaries, :contents, :content - end -end diff --git a/db/migrate/20250723165724_create_search_embeddings.rb b/db/migrate/20250723165724_create_search_embeddings.rb deleted file mode 100644 index ad91e507e..000000000 --- a/db/migrate/20250723165724_create_search_embeddings.rb +++ /dev/null @@ -1,16 +0,0 @@ -class CreateSearchEmbeddings < ActiveRecord::Migration[7.1] - def change - # create_virtual_table :search_embeddings, :vec0, [ - # "id INTEGER PRIMARY KEY", - # "record_type TEXT NOT NULL", - # "record_id INTEGER NOT NULL", - # "embedding FLOAT[1536] distance_metric=cosine" - # ] - - # Above is the original migration. Once the sqlite 'vec0' module was removed from the codebase - # in 38a7a144 (following the table removal in 875a298f), this migration became unrunnable. So to - # make sure we can reconstruct the schema if necessary by running all the migrations, I'm - # replacing it with this empty table. - create_table :search_embeddings - end -end diff --git a/db/migrate/20250728131423_create_conversations.rb b/db/migrate/20250728131423_create_conversations.rb deleted file mode 100644 index f5c7db613..000000000 --- a/db/migrate/20250728131423_create_conversations.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateConversations < ActiveRecord::Migration[8.1] - def change - create_table :conversations do |t| - t.belongs_to :user, null: false, foreign_key: true, index: { unique: true } - t.string :state, :string - - t.timestamps - end - end -end diff --git a/db/migrate/20250728131624_create_conversation_messages.rb b/db/migrate/20250728131624_create_conversation_messages.rb deleted file mode 100644 index 912b76e0c..000000000 --- a/db/migrate/20250728131624_create_conversation_messages.rb +++ /dev/null @@ -1,17 +0,0 @@ -class CreateConversationMessages < ActiveRecord::Migration[8.1] - def change - create_table :conversation_messages do |t| - t.belongs_to :conversation, null: false, foreign_key: true - t.string :role, null: false - t.string :client_message_id, null: false - t.string :model_id - t.bigint :input_tokens - t.bigint :output_tokens - t.bigint :input_cost_microcents - t.bigint :output_cost_microcents - t.bigint :cost_microcents - - t.timestamps - end - end -end diff --git a/db/migrate/20250806174718_allow_null_for_accounts_queenbee_id.rb b/db/migrate/20250806174718_allow_null_for_accounts_queenbee_id.rb deleted file mode 100644 index d9cc0c58e..000000000 --- a/db/migrate/20250806174718_allow_null_for_accounts_queenbee_id.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AllowNullForAccountsQueenbeeId < ActiveRecord::Migration[8.1] - def change - change_column_null :accounts, :queenbee_id, true - end -end diff --git a/db/migrate/20250812195130_add_status_to_card_engagements.rb b/db/migrate/20250812195130_add_status_to_card_engagements.rb deleted file mode 100644 index bf0944577..000000000 --- a/db/migrate/20250812195130_add_status_to_card_engagements.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddStatusToCardEngagements < ActiveRecord::Migration[8.1] - def change - add_column :card_engagements, :status, :string, default: "doing", null: false - add_index :card_engagements, :status - end -end diff --git a/db/migrate/20250819101032_create_ai_quotas.rb b/db/migrate/20250819101032_create_ai_quotas.rb deleted file mode 100644 index 6b4d9a4af..000000000 --- a/db/migrate/20250819101032_create_ai_quotas.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateAiQuotas < ActiveRecord::Migration[8.1] - def change - create_table :ai_quotas do |t| - t.belongs_to :user, null: false, foreign_key: true - t.integer :limit, null: false - t.integer :used, null: false, default: 0 - t.datetime :reset_at, null: false, index: true - - t.timestamps - end - end -end diff --git a/db/migrate/20250819105245_drop_commands_table.rb b/db/migrate/20250819105245_drop_commands_table.rb deleted file mode 100644 index 60d5ea857..000000000 --- a/db/migrate/20250819105245_drop_commands_table.rb +++ /dev/null @@ -1,5 +0,0 @@ -class DropCommandsTable < ActiveRecord::Migration[8.1] - def change - drop_table :commands, if_exists: true - end -end diff --git a/db/migrate/20250826084559_create_notification_bundles.rb b/db/migrate/20250826084559_create_notification_bundles.rb deleted file mode 100644 index 5c3f3ebfb..000000000 --- a/db/migrate/20250826084559_create_notification_bundles.rb +++ /dev/null @@ -1,15 +0,0 @@ -class CreateNotificationBundles < ActiveRecord::Migration[8.1] - def change - create_table :notification_bundles do |t| - t.references :user, null: false, foreign_key: true, index: { unique: true } - t.datetime :starts_at, null: false - t.datetime :ends_at, null: false - t.integer :status, default: 0, null: false - - t.timestamps - end - - add_index :notification_bundles, %i[ user_id starts_at ends_at ] - add_index :notification_bundles, %i[ user_id status ] - end -end diff --git a/db/migrate/20250826131458_remove_unique_constraint_from_notification_bundles_user_id.rb b/db/migrate/20250826131458_remove_unique_constraint_from_notification_bundles_user_id.rb deleted file mode 100644 index d5c83236c..000000000 --- a/db/migrate/20250826131458_remove_unique_constraint_from_notification_bundles_user_id.rb +++ /dev/null @@ -1,6 +0,0 @@ -class RemoveUniqueConstraintFromNotificationBundlesUserId < ActiveRecord::Migration[8.1] - def change - remove_index :notification_bundles, :user_id, unique: true - add_index :notification_bundles, %i[ ends_at status ] - end -end diff --git a/db/migrate/20250827065003_add_cost_microcents_to_event_summaries.rb b/db/migrate/20250827065003_add_cost_microcents_to_event_summaries.rb deleted file mode 100644 index fe9e9057b..000000000 --- a/db/migrate/20250827065003_add_cost_microcents_to_event_summaries.rb +++ /dev/null @@ -1,12 +0,0 @@ -class AddCostMicrocentsToEventSummaries < ActiveRecord::Migration[8.1] - def change - add_column :event_activity_summaries, :cost_microcents, :bigint, default: 0 - - reversible do |dir| - dir.up do - execute "UPDATE event_activity_summaries SET cost_microcents = 0 WHERE cost_microcents IS NULL" - change_column_null :event_activity_summaries, :cost_microcents, false - end - end - end -end diff --git a/db/migrate/20250827072523_rename_conversation_messages_cost_microcents_to_cost_in_microcents.rb b/db/migrate/20250827072523_rename_conversation_messages_cost_microcents_to_cost_in_microcents.rb deleted file mode 100644 index 280f0f33a..000000000 --- a/db/migrate/20250827072523_rename_conversation_messages_cost_microcents_to_cost_in_microcents.rb +++ /dev/null @@ -1,7 +0,0 @@ -class RenameConversationMessagesCostMicrocentsToCostInMicrocents < ActiveRecord::Migration[8.0] - def change - rename_column :conversation_messages, :cost_microcents, :cost_in_microcents - rename_column :conversation_messages, :input_cost_microcents, :input_cost_in_microcents - rename_column :conversation_messages, :output_cost_microcents, :output_cost_in_microcents - end -end diff --git a/db/migrate/20250827072601_rename_event_activity_summaries_cost_microcents_to_cost_in_microcents.rb b/db/migrate/20250827072601_rename_event_activity_summaries_cost_microcents_to_cost_in_microcents.rb deleted file mode 100644 index 0f92272d0..000000000 --- a/db/migrate/20250827072601_rename_event_activity_summaries_cost_microcents_to_cost_in_microcents.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameEventActivitySummariesCostMicrocentsToCostInMicrocents < ActiveRecord::Migration[8.1] - def change - rename_column :event_activity_summaries, :cost_microcents, :cost_in_microcents - end -end diff --git a/db/migrate/20250828084732_create_notification_settings.rb b/db/migrate/20250828084732_create_notification_settings.rb deleted file mode 100644 index cf414eb6e..000000000 --- a/db/migrate/20250828084732_create_notification_settings.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateNotificationSettings < ActiveRecord::Migration[8.1] - def change - create_table :notification_settings do |t| - t.references :user, null: false, foreign_key: true, index: true - t.integer :bundle_email_frequency, default: 0, null: false - - t.timestamps - - t.index %i[ user_id bundle_email_frequency ] - end - end -end diff --git a/db/migrate/20250828092106_rename_notification_settings_to_user_settings.rb b/db/migrate/20250828092106_rename_notification_settings_to_user_settings.rb deleted file mode 100644 index 42bd243ab..000000000 --- a/db/migrate/20250828092106_rename_notification_settings_to_user_settings.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameNotificationSettingsToUserSettings < ActiveRecord::Migration[8.1] - def change - rename_table :notification_settings, :user_settings - end -end diff --git a/db/migrate/20250901114009_create_period_highlights.rb b/db/migrate/20250901114009_create_period_highlights.rb deleted file mode 100644 index 1d7a9c491..000000000 --- a/db/migrate/20250901114009_create_period_highlights.rb +++ /dev/null @@ -1,15 +0,0 @@ -class CreatePeriodHighlights < ActiveRecord::Migration[8.1] - def change - create_table :period_highlights do |t| - t.datetime :starts_at, null: false - t.bigint :duration, null: false, default: 1.week.to_i - t.string :key, null: false - t.text :content, null: false - t.bigint :cost_in_microcents - - t.index %i[ key starts_at duration ], unique: true - - t.timestamps - end - end -end diff --git a/db/migrate/20250902093943_drop_event_activity_summaries.rb b/db/migrate/20250902093943_drop_event_activity_summaries.rb deleted file mode 100644 index d761d326a..000000000 --- a/db/migrate/20250902093943_drop_event_activity_summaries.rb +++ /dev/null @@ -1,5 +0,0 @@ -class DropEventActivitySummaries < ActiveRecord::Migration[8.1] - def change - drop_table :event_activity_summaries - end -end diff --git a/db/migrate/20250905093718_add_timezone_name_to_user_settings.rb b/db/migrate/20250905093718_add_timezone_name_to_user_settings.rb deleted file mode 100644 index c53da0916..000000000 --- a/db/migrate/20250905093718_add_timezone_name_to_user_settings.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddTimezoneNameToUserSettings < ActiveRecord::Migration[8.1] - def change - add_column :user_settings, :timezone_name, :string - end -end diff --git a/db/migrate/20250905101432_remove_dates_from_period_highlights.rb b/db/migrate/20250905101432_remove_dates_from_period_highlights.rb deleted file mode 100644 index 42d3f3f6e..000000000 --- a/db/migrate/20250905101432_remove_dates_from_period_highlights.rb +++ /dev/null @@ -1,6 +0,0 @@ -class RemoveDatesFromPeriodHighlights < ActiveRecord::Migration[8.1] - def change - remove_column :period_highlights, :starts_at - remove_column :period_highlights, :duration - end -end diff --git a/db/migrate/20250909113219_create_webhooks.rb b/db/migrate/20250909113219_create_webhooks.rb deleted file mode 100644 index f9fc08301..000000000 --- a/db/migrate/20250909113219_create_webhooks.rb +++ /dev/null @@ -1,16 +0,0 @@ -class CreateWebhooks < ActiveRecord::Migration[8.1] - def change - create_table :webhooks do |t| - t.boolean :active, default: true, null: false - t.string :name - t.text :url, null: false - t.text :subscribed_actions - t.string :signing_secret, null: false - - t.timestamps - - # MySQL requires a prefix length for TEXT column indexes - t.index "subscribed_actions(255)", name: "index_webhooks_on_subscribed_actions" - end - end -end diff --git a/db/migrate/20250909115638_create_webhook_deliveries.rb b/db/migrate/20250909115638_create_webhook_deliveries.rb deleted file mode 100644 index 876c51202..000000000 --- a/db/migrate/20250909115638_create_webhook_deliveries.rb +++ /dev/null @@ -1,13 +0,0 @@ -class CreateWebhookDeliveries < ActiveRecord::Migration[8.1] - def change - create_table :webhook_deliveries do |t| - t.belongs_to :webhook, null: false, foreign_key: true - t.belongs_to :event, null: false, foreign_key: true - t.string :state, null: false - t.text :request - t.text :response - - t.timestamps - end - end -end diff --git a/db/migrate/20250911124541_create_webhook_delinquency_trackers.rb b/db/migrate/20250911124541_create_webhook_delinquency_trackers.rb deleted file mode 100644 index 9332f8f7c..000000000 --- a/db/migrate/20250911124541_create_webhook_delinquency_trackers.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateWebhookDelinquencyTrackers < ActiveRecord::Migration[8.1] - def change - create_table :webhook_delinquency_trackers do |t| - t.belongs_to :webhook, null: false, foreign_key: true - t.datetime :last_reset_at - t.integer :total_count, default: 0, null: false - t.integer :failed_count, default: 0, null: false - - t.timestamps - end - end -end diff --git a/db/migrate/20250912123359_migrate_everything_acccesses_to_watching.rb b/db/migrate/20250912123359_migrate_everything_acccesses_to_watching.rb deleted file mode 100644 index 96ca2fc5d..000000000 --- a/db/migrate/20250912123359_migrate_everything_acccesses_to_watching.rb +++ /dev/null @@ -1,13 +0,0 @@ -class MigrateEverythingAcccessesToWatching < ActiveRecord::Migration[8.1] - def up - execute <<-SQL - UPDATE accesses#{' '} - SET involvement = 'watching'#{' '} - WHERE involvement = 'everything' - SQL - end - - def down - raise ActiveRecord::IrreversibleMigration - end -end diff --git a/db/migrate/20250912205016_change_default_involvement_to_access_only.rb b/db/migrate/20250912205016_change_default_involvement_to_access_only.rb deleted file mode 100644 index 4cb575d23..000000000 --- a/db/migrate/20250912205016_change_default_involvement_to_access_only.rb +++ /dev/null @@ -1,5 +0,0 @@ -class ChangeDefaultInvolvementToAccessOnly < ActiveRecord::Migration[8.1] - def change - change_column_default :accesses, :involvement, "access_only" - end -end diff --git a/db/migrate/20250913150256_add_collection_id_to_webhooks.rb b/db/migrate/20250913150256_add_collection_id_to_webhooks.rb deleted file mode 100644 index 871c44c83..000000000 --- a/db/migrate/20250913150256_add_collection_id_to_webhooks.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddCollectionIdToWebhooks < ActiveRecord::Migration[8.1] - def change - add_reference :webhooks, :collection, null: false, foreign_key: true - end -end diff --git a/db/migrate/20250915143513_add_consecutive_failures_count_to_webhook_delinquency_trackers.rb b/db/migrate/20250915143513_add_consecutive_failures_count_to_webhook_delinquency_trackers.rb deleted file mode 100644 index 13d1acf2d..000000000 --- a/db/migrate/20250915143513_add_consecutive_failures_count_to_webhook_delinquency_trackers.rb +++ /dev/null @@ -1,10 +0,0 @@ -class AddConsecutiveFailuresCountToWebhookDelinquencyTrackers < ActiveRecord::Migration[8.1] - def change - add_column :webhook_delinquency_trackers, :consecutive_failures_count, :integer - add_column :webhook_delinquency_trackers, :first_failure_at, :datetime - - remove_column :webhook_delinquency_trackers, :total_count, :integer - remove_column :webhook_delinquency_trackers, :failed_count, :integer - remove_column :webhook_delinquency_trackers, :last_reset_at, :datetime - end -end diff --git a/db/migrate/20250915170056_rename_37id_columns.rb b/db/migrate/20250915170056_rename_37id_columns.rb deleted file mode 100644 index 054c88642..000000000 --- a/db/migrate/20250915170056_rename_37id_columns.rb +++ /dev/null @@ -1,6 +0,0 @@ -class Rename37idColumns < ActiveRecord::Migration[8.1] - def change - rename_column :users, :signal_user_id, :external_user_id - rename_column :accounts, :queenbee_id, :tenant_id - end -end diff --git a/db/migrate/20250917064006_add_default_value_for_consecutive_failures_count_to_webhook_delinquency_trackers.rb b/db/migrate/20250917064006_add_default_value_for_consecutive_failures_count_to_webhook_delinquency_trackers.rb deleted file mode 100644 index 9f88d7631..000000000 --- a/db/migrate/20250917064006_add_default_value_for_consecutive_failures_count_to_webhook_delinquency_trackers.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddDefaultValueForConsecutiveFailuresCountToWebhookDelinquencyTrackers < ActiveRecord::Migration[8.1] - def change - change_column_default :webhook_delinquency_trackers, :consecutive_failures_count, from: nil, to: 0 - end -end diff --git a/db/migrate/20250924100149_create_columns_and_add_column_id_to_cards.rb b/db/migrate/20250924100149_create_columns_and_add_column_id_to_cards.rb deleted file mode 100644 index edced4a9f..000000000 --- a/db/migrate/20250924100149_create_columns_and_add_column_id_to_cards.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateColumnsAndAddColumnIdToCards < ActiveRecord::Migration[8.1] - def change - create_table :columns do |t| - t.string :name, null: false - t.string :color, null: false - t.references :collection, null: false, foreign_key: true - t.timestamps - end - - add_reference :cards, :column, foreign_key: true, index: true - end -end diff --git a/db/migrate/20250924123001_create_card_not_nows.rb b/db/migrate/20250924123001_create_card_not_nows.rb deleted file mode 100644 index 0de844dff..000000000 --- a/db/migrate/20250924123001_create_card_not_nows.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateCardNotNows < ActiveRecord::Migration[8.1] - def change - create_table :card_not_nows do |t| - t.references :card, null: false, foreign_key: true, index: { unique: true } - t.timestamps - end - end -end diff --git a/db/migrate/20250924124737_add_auto_postpone_period.rb b/db/migrate/20250924124737_add_auto_postpone_period.rb deleted file mode 100644 index 2b8b93334..000000000 --- a/db/migrate/20250924124737_add_auto_postpone_period.rb +++ /dev/null @@ -1,17 +0,0 @@ -class AddAutoPostponePeriod < ActiveRecord::Migration[8.1] - def change - add_column :entropy_configurations, :auto_postpone_period, :bigint, default: 30.days.to_i, null: false - add_index :entropy_configurations, [ :container_type, :container_id, :auto_postpone_period ] - - execute <<-SQL - UPDATE entropy_configurations - SET auto_postpone_period = auto_close_period - SQL - - remove_index :entropy_configurations, name: "idx_on_container_type_container_id_auto_close_perio_74dc880875" - remove_index :entropy_configurations, name: "idx_on_container_type_container_id_auto_reconsider__583aaddbea" - - remove_column :entropy_configurations, :auto_close_period, :bigint - remove_column :entropy_configurations, :auto_reconsider_period, :bigint - end -end diff --git a/db/migrate/20250924190529_create_identities.rb b/db/migrate/20250924190529_create_identities.rb deleted file mode 100644 index d879926a8..000000000 --- a/db/migrate/20250924190529_create_identities.rb +++ /dev/null @@ -1,7 +0,0 @@ -class CreateIdentities < ActiveRecord::Migration[8.1] - def change - create_table :identities do |t| - t.timestamps - end - end -end diff --git a/db/migrate/20250924190729_create_memberships.rb b/db/migrate/20250924190729_create_memberships.rb deleted file mode 100644 index 261fbe524..000000000 --- a/db/migrate/20250924190729_create_memberships.rb +++ /dev/null @@ -1,15 +0,0 @@ -class CreateMemberships < ActiveRecord::Migration[8.1] - def change - create_table :memberships do |t| - t.string :email_address, null: false - t.references :identity, null: false, foreign_key: true - t.references :user, null: false, foreign_key: false, index: false - t.string :user_tenant, null: false - t.string :account_name, null: false - - t.timestamps - end - add_index :memberships, :email_address - add_index :memberships, [ :user_tenant, :user_id ] - end -end diff --git a/db/migrate/20251001181713_remove_external_user_id_from_users.rb b/db/migrate/20251001181713_remove_external_user_id_from_users.rb deleted file mode 100644 index ffd0a240a..000000000 --- a/db/migrate/20251001181713_remove_external_user_id_from_users.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveExternalUserIdFromUsers < ActiveRecord::Migration[8.1] - def change - remove_column :users, :external_user_id, :integer - end -end diff --git a/db/migrate/20251003205559_rename_accounts_tenant_id_to_external_account_id.rb b/db/migrate/20251003205559_rename_accounts_tenant_id_to_external_account_id.rb deleted file mode 100644 index 3a9cb5656..000000000 --- a/db/migrate/20251003205559_rename_accounts_tenant_id_to_external_account_id.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameAccountsTenantIdToExternalAccountId < ActiveRecord::Migration[8.1] - def change - rename_column :accounts, :tenant_id, :external_account_id - end -end diff --git a/db/migrate/20251006091442_create_user_highlights.rb b/db/migrate/20251006091442_create_user_highlights.rb deleted file mode 100644 index 417b4c0df..000000000 --- a/db/migrate/20251006091442_create_user_highlights.rb +++ /dev/null @@ -1,13 +0,0 @@ -class CreateUserHighlights < ActiveRecord::Migration[8.1] - def change - create_table :user_weekly_highlights do |t| - t.references :user, null: false, foreign_key: true - t.references :period_highlights, null: false, foreign_key: true - t.date :starts_at, null: false - - t.timestamps - - t.index %i[ user_id starts_at ], unique: true - end - end -end diff --git a/db/migrate/20251007084223_cleanup_workflows.rb b/db/migrate/20251007084223_cleanup_workflows.rb deleted file mode 100644 index 4e6df0be2..000000000 --- a/db/migrate/20251007084223_cleanup_workflows.rb +++ /dev/null @@ -1,15 +0,0 @@ -class CleanupWorkflows < ActiveRecord::Migration[8.1] - def change - remove_foreign_key :cards, :workflow_stages - remove_foreign_key :collections, :workflows - remove_foreign_key :workflow_stages, :workflows - - drop_table :filters_stages - - remove_column :cards, :stage_id - remove_column :collections, :workflow_id - - drop_table :workflow_stages - drop_table :workflows - end -end diff --git a/db/migrate/20251007112917_create_identity_magic_links.rb b/db/migrate/20251007112917_create_identity_magic_links.rb deleted file mode 100644 index cdd99228d..000000000 --- a/db/migrate/20251007112917_create_identity_magic_links.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateIdentityMagicLinks < ActiveRecord::Migration[8.1] - def change - create_table :magic_links do |t| - t.string :code, index: { unique: true }, null: false - t.belongs_to :membership, null: false, foreign_key: true - t.datetime :expires_at, index: true, null: false - - t.timestamps - end - end -end diff --git a/db/migrate/20251014204033_ensure_consistent_schema.rb b/db/migrate/20251014204033_ensure_consistent_schema.rb deleted file mode 100644 index ec1bdac7f..000000000 --- a/db/migrate/20251014204033_ensure_consistent_schema.rb +++ /dev/null @@ -1,15 +0,0 @@ -class EnsureConsistentSchema < ActiveRecord::Migration[8.1] - # ref: https://app.fizzy.do/5986089/cards/2322 - def change - change_column_default :accesses, :involvement, "access_only" - - unless index_exists?(:webhooks, :subscribed_actions) - add_index :webhooks, :subscribed_actions - end - - if index_exists?(:tags, [ :title ]) - remove_index :tags, [ :title ] - end - add_index :tags, [ :title ], unique: true - end -end diff --git a/db/migrate/20251015081645_create_account_join_codes.rb b/db/migrate/20251015081645_create_account_join_codes.rb deleted file mode 100644 index b7e59100b..000000000 --- a/db/migrate/20251015081645_create_account_join_codes.rb +++ /dev/null @@ -1,32 +0,0 @@ -class CreateAccountJoinCodes < ActiveRecord::Migration[8.1] - def change - create_table :account_join_codes do |t| - t.string :code, null: false, index: { unique: true } - t.integer :usage_count, default: 0, null: false - t.integer :usage_limit, default: 10, null: false - - t.timestamps - end - - reversible do |dir| - dir.up do - # MySQL uses NOW() instead of SQLite's datetime('now') - execute <<-SQL - INSERT INTO account_join_codes (code, usage_count, usage_limit, created_at, updated_at) - SELECT join_code, 0, 10, NOW(), NOW() - FROM accounts - WHERE join_code IS NOT NULL; - SQL - end - - dir.down do - execute <<-SQL - UPDATE accounts - SET join_code = (SELECT code FROM account_join_codes LIMIT 1); - SQL - end - end - - remove_column :accounts, :join_code, :string - end -end diff --git a/db/migrate/20251015112653_add_creator_to_card_not_nows.rb b/db/migrate/20251015112653_add_creator_to_card_not_nows.rb deleted file mode 100644 index af4be4080..000000000 --- a/db/migrate/20251015112653_add_creator_to_card_not_nows.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddCreatorToCardNotNows < ActiveRecord::Migration[8.1] - def change - add_reference :card_not_nows, :creator, null: true, foreign_key: { to_table: :users } - end -end diff --git a/db/migrate/20251015114014_rename_creator_to_user_in_card_not_nows.rb b/db/migrate/20251015114014_rename_creator_to_user_in_card_not_nows.rb deleted file mode 100644 index 5092aae67..000000000 --- a/db/migrate/20251015114014_rename_creator_to_user_in_card_not_nows.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameCreatorToUserInCardNotNows < ActiveRecord::Migration[8.1] - def change - rename_column :card_not_nows, :creator_id, :user_id - end -end diff --git a/db/migrate/20251015122204_remove_null_constraint_from_card_not_nows_user.rb b/db/migrate/20251015122204_remove_null_constraint_from_card_not_nows_user.rb deleted file mode 100644 index 854f316ca..000000000 --- a/db/migrate/20251015122204_remove_null_constraint_from_card_not_nows_user.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveNullConstraintFromCardNotNowsUser < ActiveRecord::Migration[8.1] - def change - change_column_null :card_not_nows, :user_id, true - end -end diff --git a/db/migrate/20251015123003_remove_creator_from_card_not_nows.rb b/db/migrate/20251015123003_remove_creator_from_card_not_nows.rb deleted file mode 100644 index e656e7174..000000000 --- a/db/migrate/20251015123003_remove_creator_from_card_not_nows.rb +++ /dev/null @@ -1,4 +0,0 @@ -class RemoveCreatorFromCardNotNows < ActiveRecord::Migration[8.1] - def change - end -end diff --git a/db/migrate/20251015170934_move_email_to_identity.rb b/db/migrate/20251015170934_move_email_to_identity.rb deleted file mode 100644 index 3b482b54c..000000000 --- a/db/migrate/20251015170934_move_email_to_identity.rb +++ /dev/null @@ -1,49 +0,0 @@ -class MoveEmailToIdentity < ActiveRecord::Migration[8.1] - def change - add_column :identities, :email_address, :string - - # Create identities for each unique email - # MySQL uses NOW() instead of SQLite's datetime('now') - execute <<-SQL - INSERT INTO identities (email_address, created_at, updated_at) - SELECT DISTINCT email_address, NOW(), NOW() - FROM memberships - WHERE email_address IS NOT NULL - AND email_address NOT IN (SELECT email_address FROM identities WHERE email_address IS NOT NULL); - SQL - - # And link memberships to them - execute <<-SQL - UPDATE memberships - SET identity_id = ( - SELECT id - FROM identities - WHERE identities.email_address = memberships.email_address - ) - WHERE email_address IS NOT NULL; - SQL - - # Delete memberships associated with identities without an email address - execute <<-SQL - DELETE FROM memberships - WHERE identity_id IN ( - SELECT id - FROM identities - WHERE email_address IS NULL - ); - SQL - - # Delete identities without an email address - execute <<-SQL - DELETE FROM identities - WHERE email_address IS NULL; - SQL - - change_column_null :memberships, :identity_id, false - add_index :identities, :email_address, unique: true - remove_column :memberships, :email_address - remove_column :memberships, :user_id, :bigint - remove_column :memberships, :account_name, :string - rename_column :memberships, :user_tenant, :tenant - end -end diff --git a/db/migrate/20251015173452_associate_magic_links_to_identities.rb b/db/migrate/20251015173452_associate_magic_links_to_identities.rb deleted file mode 100644 index 67574ea12..000000000 --- a/db/migrate/20251015173452_associate_magic_links_to_identities.rb +++ /dev/null @@ -1,18 +0,0 @@ -class AssociateMagicLinksToIdentities < ActiveRecord::Migration[8.1] - def change - add_reference :magic_links, :identity, foreign_key: true - - # Re-associate magic links from memberships to their identity - execute <<-SQL - UPDATE magic_links - SET identity_id = ( - SELECT identity_id - FROM memberships - WHERE memberships.id = magic_links.membership_id - ) - WHERE membership_id IS NOT NULL; - SQL - - remove_column :magic_links, :membership_id - end -end diff --git a/db/migrate/20251015204327_remove_closure_reasons.rb b/db/migrate/20251015204327_remove_closure_reasons.rb deleted file mode 100644 index 6e376a222..000000000 --- a/db/migrate/20251015204327_remove_closure_reasons.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveClosureReasons < ActiveRecord::Migration[8.1] - def change - drop_table :closure_reasons - end -end diff --git a/db/migrate/20251015205212_remove_reason_from_closures.rb b/db/migrate/20251015205212_remove_reason_from_closures.rb deleted file mode 100644 index 1ca3f465d..000000000 --- a/db/migrate/20251015205212_remove_reason_from_closures.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveReasonFromClosures < ActiveRecord::Migration[8.1] - def change - remove_column :closures, :reason - end -end diff --git a/db/migrate/20251016153034_add_index_to_events_on_collection_id_and_action_and_created_at.rb b/db/migrate/20251016153034_add_index_to_events_on_collection_id_and_action_and_created_at.rb deleted file mode 100644 index 1ffe58d7d..000000000 --- a/db/migrate/20251016153034_add_index_to_events_on_collection_id_and_action_and_created_at.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddIndexToEventsOnCollectionIdAndActionAndCreatedAt < ActiveRecord::Migration[8.1] - def change - add_index :events, [ :collection_id, :action, :created_at ], name: "index_events_on_collection_id_and_action_and_created_at" - end -end diff --git a/db/migrate/20251024081104_create_identity_sessions.rb b/db/migrate/20251024081104_create_identity_sessions.rb deleted file mode 100644 index d8eb81342..000000000 --- a/db/migrate/20251024081104_create_identity_sessions.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateIdentitySessions < ActiveRecord::Migration[8.2] - def change - create_table "sessions", force: :cascade do |t| - t.references "identity", null: false, foreign_key: true - t.string "ip_address" - t.string "user_agent" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - end -end diff --git a/db/migrate/20251025174549_rename_period_highlights_to_period_summaries.rb b/db/migrate/20251025174549_rename_period_highlights_to_period_summaries.rb deleted file mode 100644 index 3f7d0f7e8..000000000 --- a/db/migrate/20251025174549_rename_period_highlights_to_period_summaries.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenamePeriodHighlightsToPeriodSummaries < ActiveRecord::Migration[8.2] - def change - rename_table :period_highlights, :period_summaries - end -end diff --git a/db/migrate/20251025174618_rename_user_weekly_highlights_to_user_weekly_summaries.rb b/db/migrate/20251025174618_rename_user_weekly_highlights_to_user_weekly_summaries.rb deleted file mode 100644 index 431ad049d..000000000 --- a/db/migrate/20251025174618_rename_user_weekly_highlights_to_user_weekly_summaries.rb +++ /dev/null @@ -1,6 +0,0 @@ -class RenameUserWeeklyHighlightsToUserWeeklySummaries < ActiveRecord::Migration[8.2] - def change - rename_table :user_weekly_highlights, :user_weekly_summaries - rename_column :user_weekly_summaries, :period_highlights_id, :period_summary_id - end -end diff --git a/db/migrate/20251027113216_delete_ai_models.rb b/db/migrate/20251027113216_delete_ai_models.rb deleted file mode 100644 index e0d9a9fad..000000000 --- a/db/migrate/20251027113216_delete_ai_models.rb +++ /dev/null @@ -1,7 +0,0 @@ -class DeleteAiModels < ActiveRecord::Migration[8.2] - def change - drop_table :conversation_messages - drop_table :conversations - drop_table :ai_quotas - end -end diff --git a/db/migrate/20251027131911_add_join_code_to_memberships.rb b/db/migrate/20251027131911_add_join_code_to_memberships.rb deleted file mode 100644 index 17b3d5a5c..000000000 --- a/db/migrate/20251027131911_add_join_code_to_memberships.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddJoinCodeToMemberships < ActiveRecord::Migration[8.2] - def change - add_column :memberships, :join_code, :string - end -end diff --git a/db/migrate/20251028135758_add_membership_id_to_users.rb b/db/migrate/20251028135758_add_membership_id_to_users.rb deleted file mode 100644 index c44bc2638..000000000 --- a/db/migrate/20251028135758_add_membership_id_to_users.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddMembershipIdToUsers < ActiveRecord::Migration[8.2] - def change - add_column :users, :membership_id, :integer - add_index :users, :membership_id - end -end diff --git a/db/migrate/20251029104115_drop_ai_tables.rb b/db/migrate/20251029104115_drop_ai_tables.rb deleted file mode 100644 index 4f609180a..000000000 --- a/db/migrate/20251029104115_drop_ai_tables.rb +++ /dev/null @@ -1,7 +0,0 @@ -class DropAiTables < ActiveRecord::Migration[8.2] - def change - drop_table :user_weekly_summaries - drop_table :period_summaries - drop_table :search_embeddings - end -end diff --git a/db/migrate/20251029142418_add_position_to_columns.rb b/db/migrate/20251029142418_add_position_to_columns.rb deleted file mode 100644 index ba16d7831..000000000 --- a/db/migrate/20251029142418_add_position_to_columns.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddPositionToColumns < ActiveRecord::Migration[8.2] - def change - add_column :columns, :position, :integer, default: 0 - - execute "UPDATE columns SET position = 0" - - change_column_null :columns, :position, false - end -end diff --git a/db/migrate/20251029161222_add_index_on_collection_and_position_to_columns.rb b/db/migrate/20251029161222_add_index_on_collection_and_position_to_columns.rb deleted file mode 100644 index 1fa34f737..000000000 --- a/db/migrate/20251029161222_add_index_on_collection_and_position_to_columns.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddIndexOnCollectionAndPositionToColumns < ActiveRecord::Migration[8.2] - def change - add_index :columns, [ :collection_id, :position ] - end -end diff --git a/db/migrate/20251102095019_change_cards_status_default_to_drafted.rb b/db/migrate/20251102095019_change_cards_status_default_to_drafted.rb deleted file mode 100644 index b6b960298..000000000 --- a/db/migrate/20251102095019_change_cards_status_default_to_drafted.rb +++ /dev/null @@ -1,5 +0,0 @@ -class ChangeCardsStatusDefaultToDrafted < ActiveRecord::Migration[8.2] - def change - change_column_default :cards, :status, from: "creating", to: "drafted" - end -end diff --git a/db/migrate/20251102115338_rename_entropy_configurations_to_entropies.rb b/db/migrate/20251102115338_rename_entropy_configurations_to_entropies.rb deleted file mode 100644 index 2e1e5d1e8..000000000 --- a/db/migrate/20251102115338_rename_entropy_configurations_to_entropies.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameEntropyConfigurationsToEntropies < ActiveRecord::Migration[8.2] - def change - rename_table :entropy_configurations, :entropies - end -end diff --git a/db/migrate/20251103125353_remove_email_address_and_password_digest_from_users.rb b/db/migrate/20251103125353_remove_email_address_and_password_digest_from_users.rb deleted file mode 100644 index c336b5b9c..000000000 --- a/db/migrate/20251103125353_remove_email_address_and_password_digest_from_users.rb +++ /dev/null @@ -1,6 +0,0 @@ -class RemoveEmailAddressAndPasswordDigestFromUsers < ActiveRecord::Migration[8.2] - def change - remove_column :users, :email_address, :string - remove_column :users, :password_digest, :string - end -end diff --git a/db/migrate/20251103125952_make_email_addresses_mandatory_on_identities.rb b/db/migrate/20251103125952_make_email_addresses_mandatory_on_identities.rb deleted file mode 100644 index 615f0320f..000000000 --- a/db/migrate/20251103125952_make_email_addresses_mandatory_on_identities.rb +++ /dev/null @@ -1,5 +0,0 @@ -class MakeEmailAddressesMandatoryOnIdentities < ActiveRecord::Migration[8.2] - def change - change_column_null :identities, :email_address, false - end -end diff --git a/db/migrate/20251105082803_add_unique_constraint_on_identity_id_and_tenant_to_memberships.rb b/db/migrate/20251105082803_add_unique_constraint_on_identity_id_and_tenant_to_memberships.rb deleted file mode 100644 index b1941065c..000000000 --- a/db/migrate/20251105082803_add_unique_constraint_on_identity_id_and_tenant_to_memberships.rb +++ /dev/null @@ -1,17 +0,0 @@ -class AddUniqueConstraintOnIdentityIdAndTenantToMemberships < ActiveRecord::Migration[8.2] - def change - # Remove duplicates, keeping the youngest membership for each identity_id + tenant combination - # MySQL doesn't allow referencing the target table in a subquery, so we use a JOIN approach - execute <<-SQL - DELETE m1 FROM memberships m1 - LEFT JOIN ( - SELECT MAX(id) as max_id - FROM memberships - GROUP BY identity_id, tenant - ) m2 ON m1.id = m2.max_id - WHERE m2.max_id IS NULL - SQL - - add_index :memberships, %i[ tenant identity_id ], unique: true - end -end diff --git a/db/migrate/20251105122933_rename_collection_to_board.rb b/db/migrate/20251105122933_rename_collection_to_board.rb deleted file mode 100644 index bc9824903..000000000 --- a/db/migrate/20251105122933_rename_collection_to_board.rb +++ /dev/null @@ -1,21 +0,0 @@ -class RenameCollectionToBoard < ActiveRecord::Migration[8.2] - def change - # Rename the main collections table to boards - rename_table :collections, :boards - - # Rename collection_publications to board_publications - rename_table :collection_publications, :board_publications - - # Rename the join table - rename_table :collections_filters, :boards_filters - - # Rename collection_id columns to board_id in all tables - rename_column :accesses, :collection_id, :board_id - rename_column :cards, :collection_id, :board_id - rename_column :board_publications, :collection_id, :board_id - rename_column :columns, :collection_id, :board_id - rename_column :events, :collection_id, :board_id - rename_column :webhooks, :collection_id, :board_id - rename_column :boards_filters, :collection_id, :board_id - end -end diff --git a/db/migrate/20251106154151_add_user_and_card_index_to_watches.rb b/db/migrate/20251106154151_add_user_and_card_index_to_watches.rb deleted file mode 100644 index 1ad20894a..000000000 --- a/db/migrate/20251106154151_add_user_and_card_index_to_watches.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddUserAndCardIndexToWatches < ActiveRecord::Migration[8.2] - def change - add_index :watches, %i[ user_id card_id ] - end -end diff --git a/db/migrate/20251110175021_add_account_id_everywhere.rb b/db/migrate/20251110175021_add_account_id_everywhere.rb deleted file mode 100644 index a285d4081..000000000 --- a/db/migrate/20251110175021_add_account_id_everywhere.rb +++ /dev/null @@ -1,18 +0,0 @@ -class AddAccountIdEverywhere < ActiveRecord::Migration[8.2] - def change - add_column :account_join_codes, :account_id, :integer - add_column :users, :account_id, :integer - add_column :boards, :account_id, :integer - add_column :columns, :account_id, :integer - add_column :cards, :account_id, :integer - add_column :steps, :account_id, :integer - add_column :comments, :account_id, :integer - add_column :notifications, :account_id, :integer - add_column :notification_bundles, :account_id, :integer - add_column :filters, :account_id, :integer - add_column :events, :account_id, :integer - add_column :tags, :account_id, :integer - add_column :webhooks, :account_id, :integer - add_column :push_subscriptions, :account_id, :integer - end -end diff --git a/db/migrate/20251111122540_initial_schema.rb b/db/migrate/20251111122540_initial_schema.rb new file mode 100644 index 000000000..b2066a670 --- /dev/null +++ b/db/migrate/20251111122540_initial_schema.rb @@ -0,0 +1,520 @@ +class InitialSchema < ActiveRecord::Migration[8.2] + def change + create_table "accesses", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.datetime "accessed_at" + t.bigint "board_id", null: false + t.datetime "created_at", null: false + t.string "involvement", default: "access_only", null: false + t.datetime "updated_at", null: false + t.bigint "user_id", null: false + t.index ["accessed_at"], name: "index_accesses_on_accessed_at", order: :desc + t.index ["board_id", "user_id"], name: "index_accesses_on_board_id_and_user_id", unique: true + t.index ["board_id"], name: "index_accesses_on_board_id" + t.index ["user_id"], name: "index_accesses_on_user_id" + end + + create_table "account_join_codes", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.integer "account_id" + t.string "code", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "usage_count", default: 0, null: false + t.integer "usage_limit", default: 10, null: false + t.index ["code"], name: "index_account_join_codes_on_code", unique: true + end + + create_table "accounts", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.datetime "created_at", null: false + t.integer "external_account_id" + t.string "name", null: false + t.datetime "updated_at", null: false + t.index ["external_account_id"], name: "index_accounts_on_external_account_id", unique: true + end + + create_table "action_text_rich_texts", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.text "body", size: :long + t.datetime "created_at", null: false + t.string "name", null: false + t.bigint "record_id", null: false + t.string "record_type", null: false + t.datetime "updated_at", null: false + t.index ["record_type", "record_id", "name"], name: "index_action_text_rich_texts_uniqueness", unique: true + end + + create_table "active_storage_attachments", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.bigint "blob_id", null: false + t.datetime "created_at", null: false + t.string "name", null: false + t.bigint "record_id", null: false + t.string "record_type", null: false + t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id" + t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true + end + + create_table "active_storage_blobs", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.bigint "byte_size", null: false + t.string "checksum" + t.string "content_type" + t.datetime "created_at", null: false + t.string "filename", null: false + t.string "key", null: false + t.text "metadata" + t.string "service_name", null: false + t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true + end + + create_table "active_storage_variant_records", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.bigint "blob_id", null: false + t.string "variation_digest", null: false + t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true + end + + create_table "assignees_filters", id: false, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.bigint "assignee_id", null: false + t.bigint "filter_id", null: false + t.index ["assignee_id"], name: "index_assignees_filters_on_assignee_id" + t.index ["filter_id"], name: "index_assignees_filters_on_filter_id" + end + + create_table "assigners_filters", id: false, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.bigint "assigner_id", null: false + t.bigint "filter_id", null: false + t.index ["assigner_id"], name: "index_assigners_filters_on_assigner_id" + t.index ["filter_id"], name: "index_assigners_filters_on_filter_id" + end + + create_table "assignments", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.bigint "assignee_id", null: false + t.integer "assigner_id", null: false + t.bigint "card_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["assignee_id", "card_id"], name: "index_assignments_on_assignee_id_and_card_id", unique: true + t.index ["card_id"], name: "index_assignments_on_card_id" + end + + create_table "board_publications", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.bigint "board_id", null: false + t.datetime "created_at", null: false + t.string "key" + t.datetime "updated_at", null: false + t.index ["board_id"], name: "index_board_publications_on_board_id" + t.index ["key"], name: "index_board_publications_on_key", unique: true + end + + create_table "boards", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.integer "account_id" + t.boolean "all_access", default: false, null: false + t.datetime "created_at", null: false + t.bigint "creator_id", null: false + t.string "name", null: false + t.datetime "updated_at", null: false + t.index ["creator_id"], name: "index_boards_on_creator_id" + end + + create_table "boards_filters", id: false, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.bigint "board_id", null: false + t.bigint "filter_id", null: false + t.index ["board_id"], name: "index_boards_filters_on_board_id" + t.index ["filter_id"], name: "index_boards_filters_on_filter_id" + end + + create_table "card_activity_spikes", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.bigint "card_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["card_id"], name: "index_card_activity_spikes_on_card_id" + end + + create_table "card_engagements", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.bigint "card_id" + t.datetime "created_at", null: false + t.string "status", default: "doing", null: false + t.datetime "updated_at", null: false + t.index ["card_id"], name: "index_card_engagements_on_card_id" + t.index ["status"], name: "index_card_engagements_on_status" + end + + create_table "card_goldnesses", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.bigint "card_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["card_id"], name: "index_card_goldnesses_on_card_id", unique: true + end + + create_table "card_not_nows", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.bigint "card_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.bigint "user_id" + t.index ["card_id"], name: "index_card_not_nows_on_card_id", unique: true + t.index ["user_id"], name: "index_card_not_nows_on_user_id" + end + + create_table "cards", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.integer "account_id" + t.bigint "board_id", null: false + t.bigint "column_id" + t.datetime "created_at", null: false + t.integer "creator_id", null: false + t.date "due_on" + t.datetime "last_active_at", null: false + t.string "status", default: "drafted", null: false + t.string "title" + t.datetime "updated_at", null: false + t.index ["board_id"], name: "index_cards_on_board_id" + t.index ["column_id"], name: "index_cards_on_column_id" + t.index ["last_active_at", "status"], name: "index_cards_on_last_active_at_and_status" + end + + create_table "closers_filters", id: false, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.integer "closer_id", null: false + t.integer "filter_id", null: false + t.index ["closer_id"], name: "index_closers_filters_on_closer_id" + t.index ["filter_id"], name: "index_closers_filters_on_filter_id" + end + + create_table "closures", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.bigint "card_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.bigint "user_id" + t.index ["card_id", "created_at"], name: "index_closures_on_card_id_and_created_at" + t.index ["card_id"], name: "index_closures_on_card_id", unique: true + t.index ["user_id"], name: "index_closures_on_user_id" + end + + create_table "columns", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.integer "account_id" + t.bigint "board_id", null: false + t.string "color", null: false + t.datetime "created_at", null: false + t.string "name", null: false + t.integer "position", default: 0, null: false + t.datetime "updated_at", null: false + t.index ["board_id", "position"], name: "index_columns_on_board_id_and_position" + t.index ["board_id"], name: "index_columns_on_board_id" + end + + create_table "comments", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.integer "account_id" + t.bigint "card_id", null: false + t.datetime "created_at", null: false + t.integer "creator_id", null: false + t.datetime "updated_at", null: false + t.index ["card_id"], name: "index_comments_on_card_id" + end + + create_table "creators_filters", id: false, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.integer "creator_id", null: false + t.integer "filter_id", null: false + t.index ["creator_id"], name: "index_creators_filters_on_creator_id" + t.index ["filter_id"], name: "index_creators_filters_on_filter_id" + end + + create_table "entropies", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.bigint "auto_postpone_period", default: 2592000, null: false + t.bigint "container_id", null: false + t.string "container_type", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["container_type", "container_id", "auto_postpone_period"], name: "idx_on_container_type_container_id_auto_postpone_pe_3d79b50517" + t.index ["container_type", "container_id"], name: "index_entropy_configurations_on_container", unique: true + end + + create_table "events", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.integer "account_id" + t.string "action", null: false + t.bigint "board_id", null: false + t.datetime "created_at", null: false + t.bigint "creator_id", null: false + t.bigint "eventable_id", null: false + t.string "eventable_type", null: false + t.json "particulars", default: -> { "(json_object())" } + t.datetime "updated_at", null: false + t.index ["action"], name: "index_events_on_summary_id_and_action" + t.index ["board_id", "action", "created_at"], name: "index_events_on_board_id_and_action_and_created_at" + t.index ["board_id"], name: "index_events_on_board_id" + t.index ["creator_id"], name: "index_events_on_creator_id" + t.index ["eventable_type", "eventable_id"], name: "index_events_on_eventable" + end + + create_table "filters", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.integer "account_id" + t.datetime "created_at", null: false + t.bigint "creator_id", null: false + t.json "fields", default: -> { "(json_object())" }, null: false + t.string "params_digest", null: false + t.datetime "updated_at", null: false + t.index ["creator_id", "params_digest"], name: "index_filters_on_creator_id_and_params_digest", unique: true + end + + create_table "filters_tags", id: false, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.bigint "filter_id", null: false + t.bigint "tag_id", null: false + t.index ["filter_id"], name: "index_filters_tags_on_filter_id" + t.index ["tag_id"], name: "index_filters_tags_on_tag_id" + end + + create_table "identities", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.datetime "created_at", null: false + t.string "email_address", null: false + t.datetime "updated_at", null: false + t.index ["email_address"], name: "index_identities_on_email_address", unique: true + end + + create_table "magic_links", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.string "code", null: false + t.datetime "created_at", null: false + t.datetime "expires_at", null: false + t.bigint "identity_id" + t.datetime "updated_at", null: false + t.index ["code"], name: "index_magic_links_on_code", unique: true + t.index ["expires_at"], name: "index_magic_links_on_expires_at" + t.index ["identity_id"], name: "index_magic_links_on_identity_id" + end + + create_table "memberships", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.datetime "created_at", null: false + t.bigint "identity_id", null: false + t.string "join_code" + t.string "tenant", null: false + t.datetime "updated_at", null: false + t.index ["identity_id"], name: "index_memberships_on_identity_id" + t.index ["tenant", "identity_id"], name: "index_memberships_on_tenant_and_identity_id", unique: true + t.index ["tenant"], name: "index_memberships_on_user_tenant_and_user_id" + end + + create_table "mentions", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.datetime "created_at", null: false + t.bigint "mentionee_id", null: false + t.bigint "mentioner_id", null: false + t.bigint "source_id", null: false + t.string "source_type", null: false + t.datetime "updated_at", null: false + t.index ["mentionee_id"], name: "index_mentions_on_mentionee_id" + t.index ["mentioner_id"], name: "index_mentions_on_mentioner_id" + t.index ["source_type", "source_id"], name: "index_mentions_on_source" + end + + create_table "notification_bundles", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.integer "account_id" + t.datetime "created_at", null: false + t.datetime "ends_at", null: false + t.datetime "starts_at", null: false + t.integer "status", default: 0, null: false + t.datetime "updated_at", null: false + t.bigint "user_id", null: false + t.index ["ends_at", "status"], name: "index_notification_bundles_on_ends_at_and_status" + t.index ["user_id", "starts_at", "ends_at"], name: "idx_on_user_id_starts_at_ends_at_7eae5d3ac5" + t.index ["user_id", "status"], name: "index_notification_bundles_on_user_id_and_status" + end + + create_table "notifications", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.integer "account_id" + t.datetime "created_at", null: false + t.bigint "creator_id" + t.datetime "read_at" + t.bigint "source_id", null: false + t.string "source_type", null: false + t.datetime "updated_at", null: false + t.bigint "user_id", null: false + t.index ["creator_id"], name: "index_notifications_on_creator_id" + t.index ["source_type", "source_id"], name: "index_notifications_on_source" + t.index ["user_id", "read_at", "created_at"], name: "index_notifications_on_user_id_and_read_at_and_created_at", order: { read_at: :desc, created_at: :desc } + t.index ["user_id"], name: "index_notifications_on_user_id" + end + + create_table "pins", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.bigint "card_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.bigint "user_id", null: false + t.index ["card_id", "user_id"], name: "index_pins_on_card_id_and_user_id", unique: true + t.index ["card_id"], name: "index_pins_on_card_id" + t.index ["user_id"], name: "index_pins_on_user_id" + end + + create_table "push_subscriptions", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.integer "account_id" + t.string "auth_key" + t.datetime "created_at", null: false + t.string "endpoint" + t.string "p256dh_key" + t.datetime "updated_at", null: false + t.string "user_agent" + t.bigint "user_id", null: false + t.index ["endpoint", "p256dh_key", "auth_key"], name: "idx_on_endpoint_p256dh_key_auth_key_7553014576" + t.index ["endpoint"], name: "index_push_subscriptions_on_endpoint" + t.index ["user_agent"], name: "index_push_subscriptions_on_user_agent" + t.index ["user_id", "endpoint"], name: "index_push_subscriptions_on_user_id_and_endpoint", unique: true + t.index ["user_id"], name: "index_push_subscriptions_on_user_id" + end + + create_table "reactions", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.integer "comment_id", null: false + t.string "content", limit: 16, null: false + t.datetime "created_at", null: false + t.integer "reacter_id", null: false + t.datetime "updated_at", null: false + t.index ["comment_id"], name: "index_reactions_on_comment_id" + t.index ["reacter_id"], name: "index_reactions_on_reacter_id" + end + + create_table "search_queries", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.datetime "created_at", null: false + t.string "terms", limit: 2000, null: false + t.datetime "updated_at", null: false + t.bigint "user_id", null: false + t.index ["user_id", "terms"], name: "index_search_queries_on_user_id_and_terms", length: { terms: 255 } + t.index ["user_id", "updated_at"], name: "index_search_queries_on_user_id_and_updated_at", unique: true + t.index ["user_id"], name: "index_search_queries_on_user_id" + end + + create_table "search_results", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "sessions", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.datetime "created_at", null: false + t.bigint "identity_id", null: false + t.string "ip_address" + t.datetime "updated_at", null: false + t.string "user_agent" + t.index ["identity_id"], name: "index_sessions_on_identity_id" + end + + create_table "steps", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.integer "account_id" + t.bigint "card_id", null: false + t.boolean "completed", default: false, null: false + t.text "content", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["card_id", "completed"], name: "index_steps_on_card_id_and_completed" + t.index ["card_id"], name: "index_steps_on_card_id" + end + + create_table "taggings", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.bigint "card_id", null: false + t.datetime "created_at", null: false + t.bigint "tag_id", null: false + t.datetime "updated_at", null: false + t.index ["card_id", "tag_id"], name: "index_taggings_on_card_id_and_tag_id", unique: true + t.index ["tag_id"], name: "index_taggings_on_tag_id" + end + + create_table "tags", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.integer "account_id" + t.datetime "created_at", null: false + t.string "title" + t.datetime "updated_at", null: false + t.index ["title"], name: "index_tags_on_title", unique: true + end + + create_table "user_settings", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.integer "bundle_email_frequency", default: 0, null: false + t.datetime "created_at", null: false + t.string "timezone_name" + t.datetime "updated_at", null: false + t.bigint "user_id", null: false + t.index ["user_id", "bundle_email_frequency"], name: "index_user_settings_on_user_id_and_bundle_email_frequency" + t.index ["user_id"], name: "index_user_settings_on_user_id" + end + + create_table "users", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.integer "account_id" + t.boolean "active", default: true, null: false + t.datetime "created_at", null: false + t.integer "membership_id" + t.string "name", null: false + t.string "role", default: "member", null: false + t.datetime "updated_at", null: false + t.index ["membership_id"], name: "index_users_on_membership_id" + t.index ["role"], name: "index_users_on_role" + end + + create_table "watches", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.bigint "card_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.bigint "user_id", null: false + t.boolean "watching", default: true, null: false + t.index ["card_id"], name: "index_watches_on_card_id" + t.index ["user_id", "card_id"], name: "index_watches_on_user_id_and_card_id" + t.index ["user_id"], name: "index_watches_on_user_id" + end + + create_table "webhook_delinquency_trackers", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.integer "consecutive_failures_count", default: 0 + t.datetime "created_at", null: false + t.datetime "first_failure_at" + t.datetime "updated_at", null: false + t.bigint "webhook_id", null: false + t.index ["webhook_id"], name: "index_webhook_delinquency_trackers_on_webhook_id" + end + + create_table "webhook_deliveries", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.datetime "created_at", null: false + t.bigint "event_id", null: false + t.text "request" + t.text "response" + t.string "state", null: false + t.datetime "updated_at", null: false + t.bigint "webhook_id", null: false + t.index ["event_id"], name: "index_webhook_deliveries_on_event_id" + t.index ["webhook_id"], name: "index_webhook_deliveries_on_webhook_id" + end + + create_table "webhooks", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci" do |t| + t.integer "account_id" + t.boolean "active", default: true, null: false + t.bigint "board_id", null: false + t.datetime "created_at", null: false + t.string "name" + t.string "signing_secret", null: false + t.text "subscribed_actions" + t.datetime "updated_at", null: false + t.text "url", null: false + t.index ["board_id"], name: "index_webhooks_on_board_id" + t.index ["subscribed_actions"], name: "index_webhooks_on_subscribed_actions", length: 255 + end + + add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id" + add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id" + add_foreign_key "board_publications", "boards" + add_foreign_key "card_activity_spikes", "cards" + add_foreign_key "card_goldnesses", "cards" + add_foreign_key "card_not_nows", "cards" + add_foreign_key "card_not_nows", "users" + add_foreign_key "cards", "columns" + add_foreign_key "closures", "cards" + add_foreign_key "closures", "users" + add_foreign_key "columns", "boards" + add_foreign_key "comments", "cards" + add_foreign_key "events", "boards" + add_foreign_key "magic_links", "identities" + add_foreign_key "memberships", "identities" + add_foreign_key "mentions", "users", column: "mentionee_id" + add_foreign_key "mentions", "users", column: "mentioner_id" + add_foreign_key "notification_bundles", "users" + add_foreign_key "notifications", "users" + add_foreign_key "notifications", "users", column: "creator_id" + add_foreign_key "pins", "cards" + add_foreign_key "pins", "users" + add_foreign_key "push_subscriptions", "users" + add_foreign_key "search_queries", "users" + add_foreign_key "sessions", "identities" + add_foreign_key "steps", "cards" + add_foreign_key "taggings", "cards" + add_foreign_key "taggings", "tags" + add_foreign_key "user_settings", "users" + add_foreign_key "watches", "cards" + add_foreign_key "watches", "users" + add_foreign_key "webhook_delinquency_trackers", "webhooks" + add_foreign_key "webhook_deliveries", "events" + add_foreign_key "webhook_deliveries", "webhooks" + add_foreign_key "webhooks", "boards" + end +end diff --git a/db/schema.rb b/db/schema.rb index b42bc8fb2..ada94a5a7 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.2].define(version: 2025_11_10_175021) do +ActiveRecord::Schema[8.2].define(version: 2025_11_11_122540) do create_table "accesses", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| t.datetime "accessed_at" t.bigint "board_id", null: false