Skip to content

Commit

Permalink
Change latin1 tables to utf8mb4
Browse files Browse the repository at this point in the history
- Fixes the bug described in #1808
  • Loading branch information
JoeCohen committed Jan 17, 2024
1 parent df6b9fe commit 02a6ccd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
15 changes: 15 additions & 0 deletions db/migrate/20240117180824_latin1_to_utf8.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class Latin1ToUtf8 < ActiveRecord::Migration[7.1]
def up
Article.connection.
execute("ALTER TABLE articles CONVERT TO CHARACTER SET utf8mb4;")
Sequence.connection.
execute("ALTER TABLE sequences CONVERT TO CHARACTER SET utf8mb4;")
end

def down
Article.connection.
execute("ALTER TABLE articles CONVERT TO CHARACTER SET latin1;")
Sequence.connection.
execute("ALTER TABLE sequences CONVERT TO CHARACTER SET latin1;")
end
end
17 changes: 8 additions & 9 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2023_12_27_170054) do
ActiveRecord::Schema[7.1].define(version: 2024_01_17_180824) do
create_table "api_keys", id: :integer, charset: "utf8mb3", force: :cascade do |t|
t.datetime "created_at", precision: nil
t.datetime "last_used", precision: nil
Expand All @@ -21,9 +21,9 @@
t.datetime "verified", precision: nil
end

create_table "articles", id: :integer, charset: "latin1", force: :cascade do |t|
create_table "articles", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.string "title"
t.text "body"
t.text "body", size: :long
t.integer "user_id"
t.integer "rss_log_id"
t.datetime "created_at", precision: nil, null: false
Expand Down Expand Up @@ -490,7 +490,7 @@
t.integer "project_id", null: false
end

create_table "project_members", charset: "utf8mb3", force: :cascade do |t|
create_table "project_members", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.integer "project_id"
t.integer "user_id"
t.datetime "created_at", null: false
Expand Down Expand Up @@ -580,14 +580,14 @@
t.datetime "created_at", precision: nil, null: false
end

create_table "sequences", id: :integer, charset: "latin1", force: :cascade do |t|
create_table "sequences", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.integer "observation_id"
t.integer "user_id"
t.text "locus"
t.text "bases"
t.text "locus", size: :long
t.text "bases", size: :long
t.string "archive"
t.string "accession"
t.text "notes"
t.text "notes", size: :long
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
end
Expand Down Expand Up @@ -734,5 +734,4 @@
t.boolean "favorite"
t.float "value"
end

end

0 comments on commit 02a6ccd

Please sign in to comment.