Skip to content

Switch to Rails 5

Jan Provaznik requested to merge switch-rails into master

What does this MR do?

  • it switches default Rails version from 4 to 5
  • it sets CI to run jobs both with Rails 4 and 5 (this is temporary)

Database changes

  • Enables monkey patch config/initializers/mysql_set_length_for_binary_indexes.rb also for rails 4, the reason is that we want to run temporarily CI tests with rails4 even after switching to rails 5. Thins monkey patch fixes t.index for Mysql - it sets default column length, ignores partial indexes if these are already defined, ignores idnexes which use opclasses
  • two specs are now triggered for rails 5 only (not for rails 4), because rails 4 allow to set only single index on the same column set (see for details). Because rails 4 in CI will be used only for a short time, there is no need to try to fix these tests for rails 4.
  • it updates DB schema according to Rails 5 schema dump:
    • t.index is now used instead of add_index
    • t.bigint is now used instead of t.integer ... limit: 8
    • user_statuses now sets explicitly integers for ID:
-  create_table "user_statuses", primary_key: "user_id", force: :cascade do |t|
+  create_table "user_statuses", primary_key: "user_id", id: :integer, force: :cascade do |t|

What are the relevant issue numbers?

Closes #48991 (closed)

Closes #14286 (closed)

Does this MR meet the acceptance criteria?

Edited by Jan Provaznik

Merge request reports