clear-code / redmine_full_text_search

Full text search for Redmine
MIT License
63 stars 24 forks source link

Redmine 5.1 isn't supported #116

Closed otegami closed 8 months ago

otegami commented 11 months ago

I encountered an issue while setting up Redmine for development with PostgreSQL as the database. The error occurred when running the run-test.sh script as part of the full text search plugin setup.

% plugins/full_text_search/dev/run-test.sh                                                     (git)-[5.1-stable]-
++ grep '^gem '\''rails'\''' Gemfile
++ grep -o '[0-9]*'
++ head -n1
+ rails_version_major=6
+ '[' 6 -ge 6 ']'
+ env PSQLRC=/tmp/nonexistent RAILS_ENV=test ruby bin/rails test 'plugins/*/test/**/*_test.rb'
PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from /Users/otegami/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/postgresql_adapter.rb:883:in `new'
rails aborted!
ActiveRecord::StatementInvalid: PG::UndefinedObject: ERROR:  operator class "pgroonga_text_term_search_ops" does not exist for access method "pgroonga" (ActiveRecord::StatementInvalid)
/Users/otegami/dev/project/redmine/db/schema.rb:219:in `block in <top (required)>'
/Users/otegami/dev/project/redmine/db/schema.rb:13:in `<top (required)>'

Caused by:
PG::UndefinedObject: ERROR:  operator class "pgroonga_text_term_search_ops" does not exist for access method "pgroonga" (PG::UndefinedObject)
/Users/otegami/dev/project/redmine/db/schema.rb:219:in `block in <top (required)>'
/Users/otegami/dev/project/redmine/db/schema.rb:13:in `<top (required)>'
Tasks: TOP => db:test:load_schema
(See full trace by running task with --trace)
PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from /Users/otegami/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/postgresql_adapter.rb:883:in `new'
Migrations are pending. To resolve this issue, run:

        bin/rails db:migrate RAILS_ENV=test
Full error logs ```console % plugins/full_text_search/dev/run-test.sh (git)-[5.1-stable]- ++ grep '^gem '\''rails'\''' Gemfile ++ grep -o '[0-9]*' ++ head -n1 + rails_version_major=6 + '[' 6 -ge 6 ']' + env PSQLRC=/tmp/nonexistent RAILS_ENV=test ruby bin/rails test 'plugins/*/test/**/*_test.rb' PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from /Users/otegami/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/postgresql_adapter.rb:883:in `new' rails aborted! ActiveRecord::StatementInvalid: PG::UndefinedObject: ERROR: operator class "pgroonga_text_term_search_ops" does not exist for access method "pgroonga" (ActiveRecord::StatementInvalid) /Users/otegami/dev/project/redmine/db/schema.rb:219:in `block in ' /Users/otegami/dev/project/redmine/db/schema.rb:13:in `' Caused by: PG::UndefinedObject: ERROR: operator class "pgroonga_text_term_search_ops" does not exist for access method "pgroonga" (PG::UndefinedObject) /Users/otegami/dev/project/redmine/db/schema.rb:219:in `block in ' /Users/otegami/dev/project/redmine/db/schema.rb:13:in `' Tasks: TOP => db:test:load_schema (See full trace by running task with --trace) PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from /Users/otegami/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/postgresql_adapter.rb:883:in `new' Migrations are pending. To resolve this issue, run: bin/rails db:migrate RAILS_ENV=test You have 310 pending migrations: 001_setup.rb 002_issue_move.rb 003_issue_add_note.rb 004_export_pdf.rb 005_issue_start_date.rb 006_calendar_and_activity.rb 007_create_journals.rb 008_create_user_preferences.rb 009_add_hide_mail_pref.rb 010_create_comments.rb 011_add_news_comments_count.rb 012_add_comments_permissions.rb 013_create_queries.rb 014_add_queries_permissions.rb 015_create_repositories.rb 016_add_repositories_permissions.rb 017_create_settings.rb 018_set_doc_and_files_notifications.rb 019_add_issue_status_position.rb 020_add_role_position.rb 021_add_tracker_position.rb 022_serialize_possibles_values.rb 023_add_tracker_is_in_roadmap.rb 024_add_roadmap_permission.rb 025_add_search_permission.rb 026_add_repository_login_and_password.rb 027_create_wikis.rb 028_create_wiki_pages.rb 029_create_wiki_contents.rb 030_add_projects_feeds_permissions.rb 031_add_repository_root_url.rb 032_create_time_entries.rb 033_add_timelog_permissions.rb 034_create_changesets.rb 035_create_changes.rb 036_add_changeset_commit_date.rb 037_add_project_identifier.rb 038_add_custom_field_is_filter.rb 039_create_watchers.rb 040_create_changesets_issues.rb 041_rename_comment_to_comments.rb 042_create_issue_relations.rb 043_add_relations_permissions.rb 044_set_language_length_to_five.rb 045_create_boards.rb 046_create_messages.rb 047_add_boards_permissions.rb 048_allow_null_version_effective_date.rb 049_add_wiki_destroy_page_permission.rb 050_add_wiki_attachments_permissions.rb 051_add_project_status.rb 052_add_changes_revision.rb 053_add_changes_branch.rb 054_add_changesets_scmid.rb 055_add_repositories_type.rb 056_add_repositories_changes_permission.rb 057_add_versions_wiki_page_title.rb 058_add_issue_categories_assigned_to_id.rb 059_add_roles_assignable.rb 060_change_changesets_committer_limit.rb 061_add_roles_builtin.rb 062_insert_builtin_roles.rb 063_add_roles_permissions.rb 064_drop_permissions.rb 065_add_settings_updated_on.rb 066_add_custom_value_customized_index.rb 067_create_wiki_redirects.rb 068_create_enabled_modules.rb 069_add_issues_estimated_hours.rb 070_change_attachments_content_type_limit.rb 071_add_queries_column_names.rb 072_add_enumerations_position.rb 073_add_enumerations_is_default.rb 074_add_auth_sources_tls.rb 075_add_members_mail_notification.rb 076_allow_null_position.rb 077_remove_issue_statuses_html_color.rb 078_add_custom_fields_position.rb 079_add_user_preferences_time_zone.rb 080_add_users_type.rb 081_create_projects_trackers.rb 082_add_messages_locked.rb 083_add_messages_sticky.rb 084_change_auth_sources_account_limit.rb 085_add_role_tracker_old_status_index_to_workflows.rb 086_add_custom_fields_searchable.rb 087_change_projects_description_to_text.rb 088_add_custom_fields_default_value.rb 089_add_attachments_description.rb 090_change_versions_name_limit.rb 091_change_changesets_revision_to_string.rb 092_change_changes_from_revision_to_string.rb 093_add_wiki_pages_protected.rb 094_change_projects_homepage_limit.rb 095_add_wiki_pages_parent_id.rb 096_add_commit_access_permission.rb 097_add_view_wiki_edits_permission.rb 098_set_topic_authors_as_watchers.rb 099_add_delete_wiki_pages_attachments_permission.rb 100_add_changesets_user_id.rb 101_populate_changesets_user_id.rb 102_add_custom_fields_editable.rb 103_set_custom_fields_editable.rb 104_add_projects_lft_and_rgt.rb 105_build_projects_tree.rb 106_remove_projects_projects_count.rb 107_add_open_id_authentication_tables.rb 108_add_identity_url_to_users.rb 20090214190337_add_watchers_user_id_type_index.rb 20090312172426_add_queries_sort_criteria.rb 20090312194159_add_projects_trackers_unique_index.rb 20090318181151_extend_settings_name.rb 20090323224724_add_type_to_enumerations.rb 20090401221305_update_enumerations_to_sti.rb 20090401231134_add_active_field_to_enumerations.rb 20090403001910_add_project_to_enumerations.rb 20090406161854_add_parent_id_to_enumerations.rb 20090425161243_add_queries_group_by.rb 20090503121501_create_member_roles.rb 20090503121505_populate_member_roles.rb 20090503121510_drop_members_role_id.rb 20090614091200_fix_messages_sticky_null.rb 20090704172350_populate_users_type.rb 20090704172355_create_groups_users.rb 20090704172358_add_member_roles_inherited_from.rb 20091010093521_fix_users_custom_values.rb 20091017212227_add_missing_indexes_to_workflows.rb 20091017212457_add_missing_indexes_to_custom_fields_projects.rb 20091017212644_add_missing_indexes_to_messages.rb 20091017212938_add_missing_indexes_to_repositories.rb 20091017213027_add_missing_indexes_to_comments.rb 20091017213113_add_missing_indexes_to_enumerations.rb 20091017213151_add_missing_indexes_to_wiki_pages.rb 20091017213228_add_missing_indexes_to_watchers.rb 20091017213257_add_missing_indexes_to_auth_sources.rb 20091017213332_add_missing_indexes_to_documents.rb 20091017213444_add_missing_indexes_to_tokens.rb 20091017213536_add_missing_indexes_to_changesets.rb 20091017213642_add_missing_indexes_to_issue_categories.rb 20091017213716_add_missing_indexes_to_member_roles.rb 20091017213757_add_missing_indexes_to_boards.rb 20091017213835_add_missing_indexes_to_user_preferences.rb 20091017213910_add_missing_indexes_to_issues.rb 20091017214015_add_missing_indexes_to_members.rb 20091017214107_add_missing_indexes_to_custom_fields.rb 20091017214136_add_missing_indexes_to_queries.rb 20091017214236_add_missing_indexes_to_time_entries.rb 20091017214308_add_missing_indexes_to_news.rb 20091017214336_add_missing_indexes_to_users.rb 20091017214406_add_missing_indexes_to_attachments.rb 20091017214440_add_missing_indexes_to_wiki_contents.rb 20091017214519_add_missing_indexes_to_custom_values.rb 20091017214611_add_missing_indexes_to_journals.rb 20091017214644_add_missing_indexes_to_issue_relations.rb 20091017214720_add_missing_indexes_to_wiki_redirects.rb 20091017214750_add_missing_indexes_to_custom_fields_trackers.rb 20091025163651_add_activity_indexes.rb 20091108092559_add_versions_status.rb 20091114105931_add_view_issues_permission.rb 20091123212029_add_default_done_ratio_to_issue_status.rb 20091205124427_add_versions_sharing.rb 20091220183509_add_lft_and_rgt_indexes_to_projects.rb 20091220183727_add_index_to_settings_name.rb 20091220184736_add_indexes_to_issue_status.rb 20091225164732_remove_enumerations_opt.rb 20091227112908_change_wiki_contents_text_limit.rb 20100129193402_change_users_mail_notification_to_string.rb 20100129193813_update_mail_notification_values.rb 20100221100219_add_index_on_changesets_scmid.rb 20100313132032_add_issues_nested_sets_columns.rb 20100313171051_add_index_on_issues_nested_set.rb 20100705164950_change_changes_path_length_limit.rb 20100819172912_enable_calendar_and_gantt_modules_where_appropriate.rb 20101104182107_add_unique_index_on_members.rb 20101107130441_add_custom_fields_visible.rb 20101114115114_change_projects_name_limit.rb 20101114115359_change_projects_identifier_limit.rb 20110220160626_add_workflows_assignee_and_author.rb 20110223180944_add_users_salt.rb 20110223180953_salt_user_passwords.rb 20110224000000_add_repositories_path_encoding.rb 20110226120112_change_repositories_password_limit.rb 20110226120132_change_auth_sources_account_password_limit.rb 20110227125750_change_journal_details_values_to_text.rb 20110228000000_add_repositories_log_encoding.rb 20110228000100_copy_repositories_log_encoding.rb 20110401192910_add_index_to_users_type.rb 20110408103312_add_roles_issues_visibility.rb 20110412065600_add_issues_is_private.rb 20110511000000_add_repositories_extra_info.rb 20110902000000_create_changeset_parents.rb 20111201201315_add_unique_index_to_issue_relations.rb 20120115143024_add_repositories_identifier.rb 20120115143100_add_repositories_is_default.rb 20120115143126_set_default_repositories.rb 20120127174243_add_custom_fields_multiple.rb 20120205111326_change_users_login_limit.rb 20120223110929_change_attachments_container_defaults.rb 20120301153455_add_auth_sources_filter.rb 20120422150750_change_repositories_to_full_sti.rb 20120705074331_add_trackers_fields_bits.rb 20120707064544_add_auth_sources_timeout.rb 20120714122000_add_workflows_type.rb 20120714122100_update_workflows_to_sti.rb 20120714122200_add_workflows_rule_fields.rb 20120731164049_add_boards_parent_id.rb 20120930112914_add_journals_private_notes.rb 20121026002032_add_enumerations_position_name.rb 20121026003537_populate_enumerations_position_name.rb 20121209123234_add_queries_type.rb 20121209123358_update_queries_to_sti.rb 20121213084931_add_attachments_disk_directory.rb 20130110122628_split_documents_permissions.rb 20130201184705_add_unique_index_on_tokens_value.rb 20130202090625_add_projects_inherit_members.rb 20130207175206_add_unique_index_on_custom_fields_trackers.rb 20130207181455_add_unique_index_on_custom_fields_projects.rb 20130215073721_change_users_lastname_length_to_255.rb 20130215111127_add_issues_closed_on.rb 20130215111141_populate_issues_closed_on.rb 20130217094251_remove_issues_default_fk_values.rb 20130602092539_create_queries_roles.rb 20130710182539_add_queries_visibility.rb 20130713104233_create_custom_fields_roles.rb 20130713111657_add_queries_options.rb 20130729070143_add_users_must_change_passwd.rb 20130911193200_remove_eols_from_attachments_filename.rb 20131004113137_support_for_multiple_commit_keywords.rb 20131005100610_add_repositories_created_on.rb 20131124175346_add_custom_fields_format_store.rb 20131210180802_add_custom_fields_description.rb 20131214094309_remove_custom_fields_min_max_length_default_values.rb 20131215104612_store_relation_type_in_journal_details.rb 20131218183023_delete_orphan_time_entries_custom_values.rb 20140228130325_change_changesets_comments_limit.rb 20140903143914_add_password_changed_at_to_user.rb 20140920094058_insert_builtin_groups.rb 20141029181752_add_trackers_default_status_id.rb 20141029181824_remove_issue_statuses_is_default.rb 20141109112308_add_roles_users_visibility.rb 20141122124142_add_wiki_redirects_redirects_to_wiki_id.rb 20150113194759_create_email_addresses.rb 20150113211532_populate_email_addresses.rb 20150113213922_remove_users_mail.rb 20150113213955_add_email_addresses_user_id_index.rb 20150208105930_replace_move_issues_permission.rb 20150510083747_change_documents_title_limit.rb 20150525103953_clear_estimated_hours_on_parent_issues.rb 20150526183158_add_roles_time_entries_visibility.rb 20150528084820_add_roles_all_roles_managed.rb 20150528092912_create_roles_managed_roles.rb 20150528093249_add_unique_index_on_roles_managed_roles.rb 20150725112753_insert_allowed_statuses_for_new_issues.rb 20150730122707_create_imports.rb 20150730122735_create_import_items.rb 20150921204850_change_time_entries_comments_limit_to_1024.rb 20150921210243_change_wiki_contents_comments_limit_to_1024.rb 20151020182334_change_attachments_filesize_limit_to_8.rb 20151020182731_fix_comma_in_user_format_setting_value.rb 20151021184614_change_issue_categories_name_limit_to_60.rb 20151021185456_change_auth_sources_filter_to_text.rb 20151021190616_change_user_preferences_hide_mail_default_to_true.rb 20151024082034_add_tokens_updated_on.rb 20151025072118_create_custom_field_enumerations.rb 20151031095005_add_projects_default_version_id.rb 20160404080304_force_password_reset_during_setup.rb 20160416072926_remove_position_defaults.rb 20160529063352_add_roles_settings.rb 20161001122012_add_tracker_id_index_to_workflows.rb 20161002133421_add_index_on_member_roles_inherited_from.rb 20161010081301_change_issues_description_limit.rb 20161010081528_change_journal_details_value_limit.rb 20161010081600_change_journals_notes_limit.rb 20161126094932_add_index_on_changesets_issues_issue_id.rb 20161220091118_add_index_on_issues_parent_id.rb 20170207050700_add_index_on_disk_filename_to_attachments.rb 20170302015225_change_attachments_digest_limit_to_64.rb 20170309214320_add_project_default_assigned_to_id.rb 20170320051650_change_repositories_extra_info_limit.rb 20170418090031_add_view_news_to_all_existing_roles.rb 20170419144536_add_view_messages_to_all_existing_roles.rb 20170723112801_rename_comments_to_content.rb 20180501132547_add_author_id_to_time_entries.rb 20180913072918_add_verify_peer_to_auth_sources.rb 20180923082945_change_sqlite_booleans_to_0_and_1.rb 20180923091603_change_sqlite_booleans_default.rb 20190315094151_change_custom_values_value_limit.rb 20190315102101_add_trackers_description.rb 20190510070108_add_unique_id_to_import_items.rb 20190620135549_change_roles_name_limit.rb 20200826153401_add_twofa_scheme_to_user.rb 20200826153402_add_totp_to_user.rb 20210704125704_add_twofa_required_to_groups.rb 20210705111300_add_projects_default_issue_query_id.rb 20210728131544_drop_is_in_chlog_column.rb 20210801145548_remove_bcc_recipients_setting.rb 20210801211024_remove_orphaned_user_custom_values.rb 20211213122100_remove_identity_url_from_users.rb 20211213122101_drop_open_id_authentication_tables.rb 20211213122102_remove_open_id_setting.rb 20220224194639_delete_orphaned_time_entry_activities.rb 20220714093000_add_journal_updated_on.rb 20220714093010_add_journal_updated_by.rb 20220806215628_add_default_time_entry_activity_to_roles.rb 20221002193055_delete_orphaned_query_and_role_from_queries_roles.rb 20221004172825_ensure_text_formatting_setting_is_stored_in_db.rb 20221012135202_add_index_to_custom_values.rb 20221214173537_add_select_project_publicity_permission.rb 20230818020734_add_status_description.rb 20231012112407_remove_mention_users_permission.rb ```

How to Reproduce

My environment

Steps

Expected Behavior

The run-test.sh script should execute without errors, allowing for the testing of the full text search plugin in a development environment.

Steps I tried to Resolve the Issue

bin/rails db:migrate:status RAILS_ENV=test ```console % bin/rails db:migrate:status RAILS_ENV=test (git)-[5.1-stable]- database: redmine_master_test Status Migration ID Migration Name -------------------------------------------------- down 001 Setup ... down 20231012112407 Remove mention users permission ```
bin/rails db:migrate RAILS_ENV=test ```console % bin/rails db:migrate RAILS_ENV=test (git)-[5.1-stable]- == 1 Setup: migrating ========================================================= -- create_table("attachments", {:force=>true, :id=>:integer}) -> 0.0151s -- create_table("auth_sources", {:force=>true, :id=>:integer}) -> 0.0064s -- create_table("custom_fields", {:force=>true, :id=>:integer}) -> 0.0065s -- create_table("custom_fields_projects", {:id=>false, :force=>true}) -> 0.0016s -- create_table("custom_fields_trackers", {:id=>false, :force=>true}) -> 0.0016s -- create_table("custom_values", {:force=>true, :id=>:integer}) -> 0.0050s -- create_table("documents", {:force=>true, :id=>:integer}) -> 0.0053s -- add_index("documents", ["project_id"], {:name=>"documents_project_id"}) -> 0.0021s -- create_table("enumerations", {:force=>true, :id=>:integer}) -> 0.0036s -- create_table("issue_categories", {:force=>true, :id=>:integer}) -> 0.0032s -- add_index("issue_categories", ["project_id"], {:name=>"issue_categories_project_id"}) -> 0.0012s -- create_table("issue_histories", {:force=>true, :id=>:integer}) -> 0.0050s -- add_index("issue_histories", ["issue_id"], {:name=>"issue_histories_issue_id"}) -> 0.0018s -- create_table("issue_statuses", {:force=>true, :id=>:integer}) -> 0.0036s -- create_table("issues", {:force=>true, :id=>:integer}) -> 0.0050s -- add_index("issues", ["project_id"], {:name=>"issues_project_id"}) -> 0.0014s -- create_table("members", {:force=>true, :id=>:integer}) -> 0.0035s -- create_table("news", {:force=>true, :id=>:integer}) -> 0.0040s -- add_index("news", ["project_id"], {:name=>"news_project_id"}) -> 0.0012s -- create_table("permissions", {:force=>true, :id=>:integer}) -> 0.0035s -- create_table("permissions_roles", {:id=>false, :force=>true}) -> 0.0011s -- add_index("permissions_roles", ["role_id"], {:name=>"permissions_roles_role_id"}) -> 0.0011s -- create_table("projects", {:force=>true, :id=>:integer}) -> 0.0035s -- create_table("roles", {:force=>true, :id=>:integer}) -> 0.0016s -- create_table("tokens", {:force=>true, :id=>:integer}) -> 0.0036s -- create_table("trackers", {:force=>true, :id=>:integer}) -> 0.0022s -- create_table("users", {:force=>true, :id=>:integer}) -> 0.0035s -- create_table("versions", {:force=>true, :id=>:integer}) -> 0.0029s -- add_index("versions", ["project_id"], {:name=>"versions_project_id"}) -> 0.0009s -- create_table("workflows", {:force=>true, :id=>:integer}) -> 0.0024s == 1 Setup: migrated (0.1322s) ================================================ == 2 IssueMove: migrating ===================================================== == 2 IssueMove: migrated (0.0030s) ============================================ == 3 IssueAddNote: migrating ================================================== == 3 IssueAddNote: migrated (0.0027s) ========================================= == 4 ExportPdf: migrating ===================================================== == 4 ExportPdf: migrated (0.0030s) ============================================ == 5 IssueStartDate: migrating ================================================ -- add_column(:issues, :start_date, :date) -> 0.0007s -- add_column(:issues, :done_ratio, :integer, {:default=>0, :null=>false}) -> 0.0007s == 5 IssueStartDate: migrated (0.0015s) ======================================= == 6 CalendarAndActivity: migrating =========================================== == 6 CalendarAndActivity: migrated (0.0044s) ================================== == 7 CreateJournals: migrating ================================================ -- create_table(:journals, {:force=>true, :id=>:integer}) -> 0.0038s -- create_table(:journal_details, {:force=>true, :id=>:integer}) -> 0.0035s -- add_index("journals", ["journalized_id", "journalized_type"], {:name=>"journals_journalized_id"}) -> 0.0011s -- add_index("journal_details", ["journal_id"], {:name=>"journal_details_journal_id"}) -> 0.0012s -- drop_table(:issue_histories) -> 0.0009s == 7 CreateJournals: migrated (0.0141s) ======================================= == 8 CreateUserPreferences: migrating ========================================= -- create_table(:user_preferences, {:id=>:integer}) -> 0.0035s == 8 CreateUserPreferences: migrated (0.0035s) ================================ == 9 AddHideMailPref: migrating =============================================== -- add_column(:user_preferences, :hide_mail, :boolean, {:default=>false}) -> 0.0013s == 9 AddHideMailPref: migrated (0.0013s) ====================================== == 10 CreateComments: migrating =============================================== -- create_table(:comments, {:id=>:integer}) rails aborted! StandardError: An error has occurred, this and all later migrations canceled: (StandardError) PG::DuplicateTable: ERROR: relation "comments" already exists /Users/otegami/dev/project/redmine/db/migrate/010_create_comments.rb:3:in `up' Caused by: ActiveRecord::StatementInvalid: PG::DuplicateTable: ERROR: relation "comments" already exists (ActiveRecord::StatementInvalid) /Users/otegami/dev/project/redmine/db/migrate/010_create_comments.rb:3:in `up' Caused by: PG::DuplicateTable: ERROR: relation "comments" already exists (PG::DuplicateTable) /Users/otegami/dev/project/redmine/db/migrate/010_create_comments.rb:3:in `up' Tasks: TOP => db:migrate (See full trace by running task with --trace) ```
bin/rails db:migrate:status RAILS_ENV=test ```console % bin/rails db:migrate:status RAILS_ENV=test (git)-[5.1-stable]- database: redmine_master_test Status Migration ID Migration Name -------------------------------------------------- up 001 Setup up 002 Issue move up 003 Issue add note up 004 Export pdf up 005 Issue start date up 006 Calendar and activity up 007 Create journals up 008 Create user preferences up 009 Add hide mail pref down 010 Create comments down 011 Add news comments count ... down 20231012112407 Remove mention users permission ```
bin/rails db:environment:set RAILS_ENV=test && bin/rails db:drop db:create db:migrate RAILS_ENV=test ```console % bin/rails db:environment:set RAILS_ENV=test % bin/rails db:drop db:create db:migrate RAILS_ENV=test % % bin/rails db:migrate:status RAILS_ENV=test (git)-[5.1-stable]- database: redmine_master_test Status Migration ID Migration Name -------------------------------------------------- up 001 Setup ... up 20231012112407 Remove mention users permission ```
plugins/full_text_search/dev/run-test.sh ```console % plugins/full_text_search/dev/run-test.sh .... E Error: FullTextSearch::CustomValueTest#test_save_project: ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "fts_types" does not exist LINE 8: WHERE a.attrelid = '"fts_types"'::regclass ^ plugins/full_text_search/app/models/full_text_search/type.rb:36:in `custom_value' plugins/full_text_search/app/models/full_text_search/type.rb:11:in `[]' plugins/full_text_search/lib/full_text_search/mapper.rb:110:in `fts_target_keys' plugins/full_text_search/lib/full_text_search/mapper.rb:94:in `find_fts_target' plugins/full_text_search/lib/full_text_search/custom_value_mapper.rb:38:in `upsert_fts_target' plugins/full_text_search/app/jobs/full_text_search/upsert_target_job.rb:12:in `perform' plugins/full_text_search/lib/full_text_search/mapper.rb:16:in `after_commit' plugins/full_text_search/test/unit/full_text_search/custom_value_test.rb:44:in `test_save_project' rails test plugins/full_text_search/test/unit/full_text_search/custom_value_test.rb:41 Finished in 8.539520s, 11.2418 runs/s, 1.6394 assertions/s. 96 runs, 14 assertions, 0 failures, 82 errors, 0 skips ```
otegami commented 11 months ago

I found a related issue in Rails that seems to be the cause of the problem I faced. This issue has already been fixed in Rails version 7.

To test if this is really related to this problem, I ran the following command:

% plugins/full_text_search/dev/initialize-redmine.sh 

Additionally, I modified the pgroonga_text_term_search_ops name to pgroonga_text_term_search_ops_v2 by adding a v2 suffix in db/schema.rb.

# db/schema.rb
create_table "fts_query_expansions", force: :cascade do |t|
  t.text "source", null: false
  t.text "destination", null: false
  t.datetime "created_at", null: false
  t.datetime "updated_at", null: false
  t.index ["source", "destination"], name: "fts_query_expansions_index_pgroonga", opclass: :pgroonga_text_term_search_ops, using: :pgroonga
  t.index ["updated_at"], name: "index_fts_query_expansions_on_updated_at"
end

Although there are still some errors, the main problem seems to be fixed.

% plugins/full_text_search/dev/run-test.sh                                                     (git)-[5.1-stable]-
++ grep '^gem '\''rails'\''' Gemfile
++ grep -o '[0-9]*'
++ head -n1
+ rails_version_major=6
+ '[' 6 -ge 6 ']'
+ env PSQLRC=/tmp/nonexistent RAILS_ENV=test ruby bin/rails test 'plugins/*/test/**/*_test.rb'
PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from /Users/otegami/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/postgresql_adapter.rb:883:in `new'
PG::Coder.new(hash) is deprecated. Please use keyword arguments instead! Called from /Users/otegami/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activerecord-6.1.7.6/lib/active_record/connection_adapters/postgresql_adapter.rb:883:in `new'
Run options: --seed 28583

# Running:

.......................................E

Error:
FullTextSearch::SearchControllerTest::ChangeRootURLTest#test_api:
NoMethodError: undefined method `filechanges' for nil:NilClass
    plugins/full_text_search/test/functional/full_text_search/search_controller_test.rb:556:in `test_api'

rails test plugins/full_text_search/test/functional/full_text_search/search_controller_test.rb:554

E

Error:
FullTextSearch::SearchControllerTest::ChangeRootURLTest#test_search:
NoMethodError: undefined method `filechanges' for nil:NilClass
    plugins/full_text_search/test/functional/full_text_search/search_controller_test.rb:539:in `test_search'

rails test plugins/full_text_search/test/functional/full_text_search/search_controller_test.rb:537

......E

Error:
FullTextSearch::SearchControllerTest::ChangeSubURLTest#test_api:
NoMethodError: undefined method `filechanges' for nil:NilClass
    plugins/full_text_search/test/functional/full_text_search/search_controller_test.rb:650:in `test_api'

rails test plugins/full_text_search/test/functional/full_text_search/search_controller_test.rb:648

E

Error:
FullTextSearch::SearchControllerTest::ChangeSubURLTest#test_search:
NoMethodError: undefined method `filechanges' for nil:NilClass
    plugins/full_text_search/test/functional/full_text_search/search_controller_test.rb:633:in `test_search'

rails test plugins/full_text_search/test/functional/full_text_search/search_controller_test.rb:631

..................................E

Error:
FullTextSearch::ChangeSubversionTest#test_fetch_changesets:
ActiveRecord::RecordNotFound: Couldn't find Change
    plugins/full_text_search/test/unit/full_text_search/change_subversion_test.rb:32:in `test_fetch_changesets'

rails test plugins/full_text_search/test/unit/full_text_search/change_subversion_test.rb:19

E

Error:
FullTextSearch::ChangeSubversionTest#test_fetch_changesets_sub_path:
NoMethodError: undefined method `each' for nil:NilClass
    plugins/full_text_search/test/test_helper.rb:191:in `collect_files'
    plugins/full_text_search/test/test_helper.rb:181:in `files'
    plugins/full_text_search/test/unit/full_text_search/change_subversion_test.rb:73:in `test_fetch_changesets_sub_path'

rails test plugins/full_text_search/test/unit/full_text_search/change_subversion_test.rb:67

Capybara starting Puma...
* Version 6.4.0 , codename: The Eagle of Durango
* Min threads: 0, max threads: 4
* Listening on http://127.0.0.1:56807
...........

Finished in 126.665618s, 0.7579 runs/s, 0.9474 assertions/s.
96 runs, 120 assertions, 0 failures, 6 errors, 0 skips
otegami commented 11 months ago

Considering these results, I'm thinking about what I should do as a next action.

otegami commented 11 months ago

I just realized that the master branch uses Rails version 7.1.2 in Redmine. Although I tried to use the master branch and found there were other issues, I think we might deal with this one as a next action.

% git switch master 
% bundle install
% plugins/full_text_search/dev/initialize-redmine.sh
+ test_svn_repository=tmp/test/subversion_repository
+ '[' '!' -d tmp/test/subversion_repository ']'
+ test_git_repository=tmp/test/git_repository
+ '[' '!' -d tmp/test/git_repository ']'
+ ruby bin/rails db:drop
bin/rails aborted!
NameError: uninitialized constant FullTextSearch (NameError)

  FullTextSearch::Settings
                ^^^^^^^^^^
/Users/otegami/dev/project/redmine/plugins/full_text_search/init.rb:37:in `block in <top (required)>'
/Users/otegami/dev/project/redmine/plugins/full_text_search/init.rb:88:in `<top (required)>'
/Users/otegami/dev/project/redmine/lib/redmine/plugin_loader.rb:31:in `load'
/Users/otegami/dev/project/redmine/lib/redmine/plugin_loader.rb:31:in `run_initializer'
/Users/otegami/dev/project/redmine/lib/redmine/plugin_loader.rb:108:in `each'
/Users/otegami/dev/project/redmine/lib/redmine/plugin_loader.rb:108:in `block in load'
/Users/otegami/dev/project/redmine/config/environment.rb:16:in `<top (required)>'
Tasks: TOP => db:drop => db:load_config => environment
(See full trace by running task with --trace)
+ true
+ ruby bin/rails generate_secret_token
+ ruby bin/rails db:create
bin/rails aborted!
NameError: uninitialized constant FullTextSearch (NameError)

  FullTextSearch::Settings
                ^^^^^^^^^^
/Users/otegami/dev/project/redmine/plugins/full_text_search/init.rb:37:in `block in <top (required)>'
/Users/otegami/dev/project/redmine/plugins/full_text_search/init.rb:88:in `<top (required)>'
/Users/otegami/dev/project/redmine/lib/redmine/plugin_loader.rb:31:in `load'
/Users/otegami/dev/project/redmine/lib/redmine/plugin_loader.rb:31:in `run_initializer'
/Users/otegami/dev/project/redmine/lib/redmine/plugin_loader.rb:108:in `each'
/Users/otegami/dev/project/redmine/lib/redmine/plugin_loader.rb:108:in `block in load'
/Users/otegami/dev/project/redmine/config/environment.rb:16:in `<top (required)>'
Tasks: TOP => db:create => db:load_config => environment
(See full trace by running task with --trace)
otegami commented 11 months ago

The latest version of Redmine is 5.1.1 and uses Rails version 6.1.7 judging from official web site. So I'm stuck about how I should deal with this point.

@kou Could you give me some advice about this issue?

kou commented 11 months ago

Could you use redmine-5.0 for #115 for now?

We can use this issue to add support for Redmine 5.1.

kou commented 11 months ago

FYI: We want to use structure.sql instead of schema.rb. We did it for Redmine < 5.1.

otegami commented 11 months ago

Could you use redmine-5.0 for https://github.com/clear-code/redmine_full_text_search/issues/115 for now?

I appreciate your help. Sure!

FYI: We want to use structure.sql instead of schema.rb. We did it for Redmine < 5.1.

I got it. Here is the commit.

otegami commented 8 months ago

@kou I want to take this issue. Could you help me to do it? we will have to do the following list for supporting Redmine5.1. Could you tell me if there are other tasks?

TODO List for supporting Redmine 5.1

kou commented 8 months ago

"Adding needed changes for Redmine 5.1" is missing. It's the most important task.

kou commented 8 months ago

We have CI jobs with Redmine master. We can use them for "adding needed changes for Redmine 5.1 (master)" in the first step. Then we can add CI jobs for Redmine 5.1.

otegami commented 8 months ago

Thanks. I misunderstood the purpose of this issue. I will search for what we need to support Redmine master. I thought this issue wouldn't support Redmine master but Redmine 5.1 because Rails version is different between 5.1 and master.

Redmine version Related Rails Link
master v7.1.2 https://github.com/redmine/redmine/blob/18cb44684b79d23dc1c45e4a9eeeb73dda5e9194/Gemfile#L5
v5.1.1 v6.1.7 https://github.com/redmine/redmine/blob/26f3a4192a72c8656581f161ead123fd5d050921/Gemfile#L5
otegami commented 8 months ago

TODO List for supporting Redmine 5.1(master)

kou commented 8 months ago

I thought this issue wouldn't support Redmine master but Redmine 5.1 because Rails version is different between 5.1 and master.

Ah, Rails versions were same when I saw Redmine master and 5.1. OK. We can add support for Redmine 5.1 and then Redmine master.

kou commented 8 months ago

Adding CI for Redmine master

We already have it. We don't have one for Redmine 5.1.

otegami commented 8 months ago

OK. We can add support for Redmine 5.1 and then Redmine master.

Sure!


TODO List for supporting Redmine 5.1

TODO List for supporting Redmine master

kou commented 8 months ago

Solved by #123.