diff --git a/config/database.yml b/config/database.yml index 8329cfdaa..7461316cf 100644 --- a/config/database.yml +++ b/config/database.yml @@ -1,19 +1,20 @@ -base: &base - encoding: utf8 - url: <%= ENV.fetch("DATABASE_URL", "trilogy://root@localhost") %> +default: &default + adapter: trilogy + encoding: utf8mb4 # <-- forces UTF-8 everywhere + collation: utf8mb4_unicode_ci # <-- portable across MySQL 5.7/8.0 and MariaDB + pool: <%= ENV.fetch("RAILS_MAX_THREADS", 5) %> + user: root + password: + host: 127.0.0.1 + variables: + # Make sure the session uses utf8mb4 too: + collation_connection: utf8mb4_unicode_ci + sql_mode: STRICT_ALL_TABLES development: - <<: *base - pool: 5 + <<: *default database: awbw_development -# Warning: The database defined as "test" will be erased and -# re-generated from your development database when you run "rake". -# Do not set this db to the same as development or production. test: - <<: *base - pool: 5 + <<: *default database: awbw_test - -production: - <<: *base diff --git a/db/migrate/20250914143038_fix_charset_and_collation.rb b/db/migrate/20250914143038_fix_charset_and_collation.rb new file mode 100644 index 000000000..6856b54d3 --- /dev/null +++ b/db/migrate/20250914143038_fix_charset_and_collation.rb @@ -0,0 +1,22 @@ +class FixCharsetAndCollation < ActiveRecord::Migration[8.1] + DB = ActiveRecord::Base.connection_db_config.database + TARGET = "utf8mb4" + COLL = "utf8mb4_unicode_ci" + + def up + execute "ALTER DATABASE `#{DB}` CHARACTER SET #{TARGET} COLLATE #{COLL}" + tables.each do |t| + execute "ALTER TABLE `#{t}` CONVERT TO CHARACTER SET #{TARGET} COLLATE #{COLL}" + end + end + + def down + # no-op (irreversible) + end + + private + + def tables + ActiveRecord::Base.connection.tables - ["schema_migrations", "ar_internal_metadata"] + end +end diff --git a/db/schema.rb b/db/schema.rb index 223820a45..71c5b4852 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,26 +10,25 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2025_09_13_171135) do - - create_table "addresses", charset: "utf8mb3", force: :cascade do |t| - t.bigint "organization_id", null: false - t.string "street", null: false +ActiveRecord::Schema[8.1].define(version: 2025_09_14_143038) do + create_table "addresses", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.string "city", null: false - t.string "state", null: false - t.string "zip", null: false t.string "country" - t.string "locality" t.string "county" + t.datetime "created_at", null: false t.integer "la_city_council_district" - t.integer "la_supervisorial_district" t.integer "la_service_planning_area" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.integer "la_supervisorial_district" + t.string "locality" + t.bigint "organization_id", null: false + t.string "state", null: false + t.string "street", null: false + t.datetime "updated_at", null: false + t.string "zip", null: false t.index ["organization_id"], name: "index_addresses_on_organization_id" end - create_table "admins", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "admins", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.datetime "created_at", precision: nil t.datetime "current_sign_in_at", precision: nil t.string "current_sign_in_ip" @@ -48,7 +47,7 @@ t.index ["reset_password_token"], name: "index_admins_on_reset_password_token", unique: true end - create_table "age_ranges", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "age_ranges", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.datetime "created_at", precision: nil, null: false t.string "name" t.datetime "updated_at", precision: nil, null: false @@ -56,14 +55,14 @@ t.index ["windows_type_id"], name: "index_age_ranges_on_windows_type_id" end - create_table "answer_options", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "answer_options", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.datetime "created_at", precision: nil, null: false t.string "name" t.integer "order" t.datetime "updated_at", precision: nil, null: false end - create_table "attachments", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "attachments", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.datetime "created_at", precision: nil, null: false t.string "file_content_type" t.string "file_file_name" @@ -74,14 +73,14 @@ t.datetime "updated_at", precision: nil, null: false end - create_table "banners", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "banners", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.text "content" t.datetime "created_at", precision: nil, null: false t.boolean "show" t.datetime "updated_at", precision: nil, null: false end - create_table "bookmark_annotations", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "bookmark_annotations", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.text "annotation", size: :medium t.integer "bookmark_id" t.datetime "created_at", precision: nil, null: false @@ -89,7 +88,7 @@ t.index ["bookmark_id"], name: "index_bookmark_annotations_on_bookmark_id" end - create_table "bookmarks", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "bookmarks", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.integer "bookmarkable_id" t.string "bookmarkable_type" t.datetime "created_at", precision: nil, null: false @@ -98,7 +97,7 @@ t.index ["user_id"], name: "index_bookmarks_on_user_id" end - create_table "categories", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "categories", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.datetime "created_at", precision: nil, null: false t.integer "legacy_id" t.integer "metadatum_id" @@ -108,7 +107,7 @@ t.index ["metadatum_id"], name: "index_categories_on_metadatum_id" end - create_table "categorizable_items", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "categorizable_items", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.integer "categorizable_id" t.string "categorizable_type" t.integer "category_id" @@ -119,7 +118,7 @@ t.index ["category_id"], name: "index_categorizable_items_on_category_id" end - create_table "ckeditor_assets", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "ckeditor_assets", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.string "actual_url" t.integer "assetable_id" t.string "assetable_type", limit: 30 @@ -135,7 +134,7 @@ t.index ["assetable_type", "type", "assetable_id"], name: "idx_ckeditor_assetable_type" end - create_table "event_registrations", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "event_registrations", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.datetime "created_at", null: false t.string "email" t.bigint "event_id" @@ -145,9 +144,9 @@ t.index ["event_id"], name: "index_event_registrations_on_event_id" end - create_table "events", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "events", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.datetime "created_at", null: false - t.text "description" + t.text "description", size: :medium t.datetime "end_date", precision: nil t.boolean "publicly_visible", default: false, null: false t.datetime "registration_close_date", precision: nil @@ -156,17 +155,17 @@ t.datetime "updated_at", null: false end - create_table "facilitator_organizations", charset: "utf8mb3", force: :cascade do |t| + create_table "facilitator_organizations", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| + t.datetime "created_at", null: false t.bigint "facilitator_id", null: false t.bigint "organization_id", null: false - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "updated_at", null: false t.index ["facilitator_id", "organization_id"], name: "index_facilitator_organizations_on_ids", unique: true t.index ["facilitator_id"], name: "index_facilitator_organizations_on_facilitator_id" t.index ["organization_id"], name: "index_facilitator_organizations_on_organization_id" end - create_table "facilitators", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "facilitators", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.string "city", null: false t.string "country", null: false t.datetime "created_at", null: false @@ -183,7 +182,7 @@ t.string "zip", null: false end - create_table "faqs", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "faqs", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.text "answer", size: :medium t.datetime "created_at", precision: nil, null: false t.boolean "inactive" @@ -192,7 +191,7 @@ t.datetime "updated_at", precision: nil, null: false end - create_table "footers", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "footers", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.string "adult_program" t.string "children_program" t.datetime "created_at", precision: nil, null: false @@ -201,7 +200,7 @@ t.datetime "updated_at", precision: nil, null: false end - create_table "form_builders", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "form_builders", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.datetime "created_at", precision: nil, null: false t.text "description", size: :medium t.string "name" @@ -211,7 +210,7 @@ t.index ["windows_type_id"], name: "index_form_builders_on_windows_type_id" end - create_table "form_field_answer_options", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "form_field_answer_options", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.integer "answer_option_id" t.datetime "created_at", precision: nil, null: false t.integer "form_field_id" @@ -220,7 +219,7 @@ t.index ["form_field_id"], name: "index_form_field_answer_options_on_form_field_id" end - create_table "form_fields", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "form_fields", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.integer "answer_datatype" t.integer "answer_type" t.datetime "created_at", precision: nil, null: false @@ -235,7 +234,7 @@ t.index ["form_id"], name: "index_form_fields_on_form_id" end - create_table "forms", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "forms", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.datetime "created_at", precision: nil, null: false t.integer "form_builder_id" t.integer "owner_id" @@ -244,7 +243,7 @@ t.index ["form_builder_id"], name: "index_forms_on_form_builder_id" end - create_table "images", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "images", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.datetime "created_at", precision: nil, null: false t.string "file_content_type" t.string "file_file_name" @@ -257,7 +256,7 @@ t.index ["owner_id"], name: "index_images_on_owner_id" end - create_table "locations", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "locations", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.string "city" t.string "country" t.datetime "created_at", precision: nil, null: false @@ -265,7 +264,7 @@ t.datetime "updated_at", precision: nil, null: false end - create_table "media_files", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "media_files", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.string "file_content_type" t.string "file_file_name" t.integer "file_file_size" @@ -274,7 +273,7 @@ t.integer "workshop_log_id" end - create_table "metadata", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "metadata", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.datetime "created_at", precision: nil, null: false t.string "legacy_id" t.string "name" @@ -282,7 +281,7 @@ t.datetime "updated_at", precision: nil, null: false end - create_table "monthly_reports", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "monthly_reports", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.string "best_call_time" t.boolean "call_requested" t.text "comments", size: :medium @@ -305,7 +304,7 @@ t.index ["project_user_id"], name: "index_monthly_reports_on_project_user_id" end - create_table "notifications", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "notifications", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.datetime "created_at", precision: nil, null: false t.integer "noticeable_id" t.string "noticeable_type" @@ -313,41 +312,41 @@ t.datetime "updated_at", precision: nil, null: false end - create_table "organizations", charset: "utf8mb3", force: :cascade do |t| - t.string "name", null: false - t.boolean "is_active", default: true - t.date "start_date" - t.date "close_date" - t.string "website_url" + create_table "organizations", charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.string "agency_type", null: false t.string "agency_type_other" + t.date "close_date" + t.datetime "created_at", null: false + t.boolean "is_active", default: true + t.text "mission", size: :medium + t.string "name", null: false t.string "phone", null: false - t.text "mission" t.string "project_id" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.date "start_date" + t.datetime "updated_at", null: false + t.string "website_url" end - create_table "permissions", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "permissions", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.datetime "created_at", precision: nil, null: false t.integer "legacy_id" t.string "security_cat" t.datetime "updated_at", precision: nil, null: false end - create_table "project_obligations", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "project_obligations", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.datetime "created_at", precision: nil, null: false t.string "name" t.datetime "updated_at", precision: nil, null: false end - create_table "project_statuses", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "project_statuses", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.datetime "created_at", precision: nil, null: false t.string "name" t.datetime "updated_at", precision: nil, null: false end - create_table "project_users", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "project_users", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.integer "agency_id" t.datetime "created_at", precision: nil, null: false t.string "filemaker_code" @@ -360,7 +359,7 @@ t.index ["user_id"], name: "index_project_users_on_user_id" end - create_table "projects", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "projects", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.datetime "created_at", precision: nil, null: false t.text "description", size: :medium t.string "district" @@ -382,7 +381,7 @@ t.index ["windows_type_id"], name: "index_projects_on_windows_type_id" end - create_table "quotable_item_quotes", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "quotable_item_quotes", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.datetime "created_at", precision: nil, null: false t.integer "legacy_id" t.integer "quotable_id" @@ -392,7 +391,7 @@ t.index ["quote_id"], name: "index_quotable_item_quotes_on_quote_id" end - create_table "quotes", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "quotes", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.string "age" t.datetime "created_at", precision: nil, null: false t.string "gender", limit: 1 @@ -406,7 +405,7 @@ t.index ["workshop_id"], name: "index_quotes_on_workshop_id" end - create_table "report_form_field_answers", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "report_form_field_answers", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.text "answer", size: :medium t.integer "answer_option_id" t.datetime "created_at", precision: nil @@ -418,7 +417,7 @@ t.index ["report_id"], name: "index_report_form_field_answers_on_report_id" end - create_table "reports", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "reports", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.integer "adults_first_time", default: 0 t.integer "adults_ongoing", default: 0 t.integer "children_first_time", default: 0 @@ -448,7 +447,7 @@ t.index ["windows_type_id"], name: "index_reports_on_windows_type_id" end - create_table "resources", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "resources", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.string "agency" t.string "author" t.datetime "created_at", precision: nil, null: false @@ -473,7 +472,7 @@ t.index ["workshop_id"], name: "index_resources_on_workshop_id" end - create_table "sectorable_items", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "sectorable_items", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.datetime "created_at", precision: nil, null: false t.boolean "inactive", default: true t.integer "sector_id" @@ -483,14 +482,14 @@ t.index ["sector_id"], name: "index_sectorable_items_on_sector_id" end - create_table "sectors", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "sectors", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.datetime "created_at", precision: nil, null: false t.string "name" t.boolean "published", default: false t.datetime "updated_at", precision: nil, null: false end - create_table "user_form_form_fields", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "user_form_form_fields", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.datetime "created_at", precision: nil, null: false t.integer "form_field_id" t.text "text", size: :medium @@ -500,7 +499,7 @@ t.index ["user_form_id"], name: "index_user_form_form_fields_on_user_form_id" end - create_table "user_forms", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "user_forms", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.datetime "created_at", precision: nil, null: false t.integer "form_id" t.datetime "updated_at", precision: nil, null: false @@ -509,7 +508,7 @@ t.index ["user_id"], name: "index_user_forms_on_user_id" end - create_table "user_permissions", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "user_permissions", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.datetime "created_at", precision: nil, null: false t.integer "permission_id" t.datetime "updated_at", precision: nil, null: false @@ -518,7 +517,7 @@ t.index ["user_id"], name: "index_user_permissions_on_user_id" end - create_table "users", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "users", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.string "address" t.string "address2" t.integer "agency_id" @@ -567,7 +566,7 @@ t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true end - create_table "windows_types", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "windows_types", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.datetime "created_at", precision: nil, null: false t.integer "legacy_id" t.string "name" @@ -575,7 +574,7 @@ t.datetime "updated_at", precision: nil, null: false end - create_table "workshop_age_ranges", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "workshop_age_ranges", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.integer "age_range_id" t.datetime "created_at", precision: nil, null: false t.datetime "updated_at", precision: nil, null: false @@ -584,7 +583,7 @@ t.index ["workshop_id"], name: "index_workshop_age_ranges_on_workshop_id" end - create_table "workshop_logs", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "workshop_logs", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.text "challenges", size: :medium t.text "comments", size: :medium t.datetime "created_at", precision: nil, null: false @@ -609,7 +608,7 @@ t.index ["workshop_id"], name: "index_workshop_logs_on_workshop_id" end - create_table "workshop_resources", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "workshop_resources", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.datetime "created_at", precision: nil, null: false t.integer "resource_id" t.datetime "updated_at", precision: nil, null: false @@ -618,7 +617,7 @@ t.index ["workshop_id"], name: "index_workshop_resources_on_workshop_id" end - create_table "workshop_variations", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "workshop_variations", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.text "code", size: :medium t.datetime "created_at", precision: nil, null: false t.boolean "inactive", default: true @@ -631,7 +630,7 @@ t.index ["workshop_id"], name: "index_workshop_variations_on_workshop_id" end - create_table "workshops", id: :integer, charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| + create_table "workshops", id: :integer, charset: "utf8mb4", collation: "utf8mb4_unicode_ci", force: :cascade do |t| t.text "age_range", size: :medium t.text "age_range_spanish", size: :medium t.string "author_location" diff --git a/docker-compose.yml b/docker-compose.yml index 1cd917a11..507654aa1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,6 +7,7 @@ services: - 3306 volumes: - mysql-data:/var/lib/mysql + - ./docker/mysql/charset.cnf:/etc/mysql/conf.d/charset.cnf:ro - ./db/init:/docker-entrypoint-initdb.d environment: MYSQL_ALLOW_EMPTY_PASSWORD: 1 @@ -31,7 +32,7 @@ services: # If you prefer traditional keys, set DB_* in .env and configure database.yml accordingly. RAILS_ENV: development RAILS_LOG_TO_STDOUT: "true" - DATABASE_URL: trilogy://root@database:3306/ + DATABASE_URL: trilogy://root@database:3306/?encoding=utf8mb4&collation=utf8mb4_unicode_ci&variables[collation_connection]=utf8mb4_unicode_ci ports: - 3000:3000 diff --git a/docker/mysql/charset.cnf b/docker/mysql/charset.cnf new file mode 100644 index 000000000..727b70091 --- /dev/null +++ b/docker/mysql/charset.cnf @@ -0,0 +1,3 @@ +[mysqld] +character-set-server = utf8mb4 +collation-server = utf8mb4_unicode_ci \ No newline at end of file