From 55827a37cbe715bb2e2e29f344b34e322414058e Mon Sep 17 00:00:00 2001 From: louispt1 Date: Wed, 11 Dec 2024 10:55:48 +0100 Subject: [PATCH] Trying wih Trilogy --- Gemfile | 2 +- Gemfile.lock | 4 ++-- config/database.yml | 36 +++++++----------------------------- 3 files changed, 10 insertions(+), 32 deletions(-) diff --git a/Gemfile b/Gemfile index 932d33e..319e091 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ gem "rails", "~> 7.2.1" # The original asset pipeline for Rails [https://github.com/rails/sprockets-rails] gem "sprockets-rails" # Use mysql as the database for Active Record -gem "mysql2", "~> 0.5.6" +gem "trilogy" # Use the Puma web server [https://github.com/puma/puma] gem "puma", ">= 5.0" # Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails] diff --git a/Gemfile.lock b/Gemfile.lock index aa36ba5..e20b37f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -258,7 +258,6 @@ GEM minitest (5.25.1) msgpack (1.7.3) multi_json (1.15.0) - mysql2 (0.5.6) net-http (0.4.1) uri net-imap (0.5.0) @@ -450,6 +449,7 @@ GEM thor (1.3.2) tilt (2.3.0) timeout (0.4.1) + trilogy (2.9.0) turbo-rails (2.0.11) actionpack (>= 6.0.0) railties (>= 6.0.0) @@ -516,7 +516,6 @@ DEPENDENCIES jwt listen local_time - mysql2 (~> 0.5.6) pagy puma (>= 5.0) rack-cors @@ -533,6 +532,7 @@ DEPENDENCIES sprockets-rails stimulus-rails tailwindcss-rails (~> 3.0) + trilogy turbo-rails tzinfo-data view_component diff --git a/config/database.yml b/config/database.yml index 4cd73cf..c23ee0f 100644 --- a/config/database.yml +++ b/config/database.yml @@ -1,16 +1,13 @@ -# MySQL. Versions 5.5.8 and up are supported. +# Trilogy. Versions supported via the trilogy gem. # -# Install the MySQL driver -# gem install mysql2 +# Install the Trilogy driver +# gem install trilogy # -# Ensure the MySQL gem is defined in your Gemfile -# gem "mysql2" -# -# And be sure to use new-style password hashing: -# https://dev.mysql.com/doc/refman/5.7/en/password-hashing.html +# Ensure the Trilogy gem is defined in your Gemfile +# gem "trilogy" # default: &default - adapter: mysql2 + adapter: trilogy encoding: utf8mb4 pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> username: root @@ -31,26 +28,7 @@ test: <<: *default database: my_etm_test -# As with config/credentials.yml, you never want to store sensitive information, -# like your database password, in your source code. If your source code is -# ever seen by anyone, they now have access to your database. -# -# Instead, provide the password or a full connection URL as an environment -# variable when you boot the app. For example: -# -# DATABASE_URL="mysql2://myuser:mypass@localhost/somedatabase" -# -# If the connection URL is provided in the special DATABASE_URL environment -# variable, Rails will automatically merge its configuration values on top of -# the values provided in this file. Alternatively, you can specify a connection -# URL environment variable explicitly: -# -# production: -# url: <%= ENV["MY_APP_DATABASE_URL"] %> -# -# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database -# for a full overview on how database connection configuration can be specified. -# +# For production and staging environments, use DATABASE_URL for configuration. production: <<: *default url: <%= ENV['DATABASE_URL'] %>