activerecord-aurora-serverless-adapter icon indicating copy to clipboard operation
activerecord-aurora-serverless-adapter copied to clipboard

Command rails db:create doesn't work

Open kihaya opened this issue 4 years ago • 3 comments

Environment

  • Rails 6.1.3.1
  • MySQL 5.7

Issue

Rails command db:create doesn't work. After manually create db by DDL in MySQL console, I can correctly connect to the database in my Rails console.

$ bundle exec rails db:create
Rake tasks not supported by 'aurora_serverless' adapter
Couldn't create 'myapp_development' database. Please check your configuration.
rails aborted!
ActiveRecord::Tasks::DatabaseNotSupported: Rake tasks not supported by 'aurora_serverless' adapter
/myapp/bin/rails:5:in `<top (required)>'
/myapp/bin/spring:10:in `require'
/myapp/bin/spring:10:in `block in <top (required)>'
/myapp/bin/spring:7:in `<top (required)>'
Tasks: TOP => db:create
(See full trace by running task with --trace)
make: *** [create] Error 1

kihaya avatar Apr 30 '21 08:04 kihaya

Correct. As far as I know this is impossible. Setting up an Aurora Serverless cluster in a production environment is out of scope for this gem. In fact, setting up a "production" DB for any ActiveRecord adapter is out of scope either. For development, you should use local MySQL server or one hosted in a Docker container.

metaskills avatar May 02 '21 00:05 metaskills

Maybe I should update the README with something like this?

group :development, :test do
  gem 'mysql'
end

group :production do
  gem 'mysql2-lambda'
  gem 'activerecord-aurora-serverless-adapter'
end

metaskills avatar May 02 '21 00:05 metaskills

Maybe I should update the README with something like this?


group :development, :test do

  gem 'mysql'

end



group :production do

  gem 'mysql2-lambda'

  gem 'activerecord-aurora-serverless-adapter'

end

Sorry for my less information. I use this stack for local Aurora Serverless data API emulation to connect from my Rails app througn Docker container.

https://koxudaxi.github.io/local-data-api/

Is it correct that db:create task is not available (or not yet implemented, hard to implement) for this moment for this gem ?

kihaya avatar May 02 '21 05:05 kihaya