customink / activerecord-aurora-serverless-adapter

ActiveRecord Adapter for Amazon Aurora Serverless
https://technology.customink.com/blog/2020/01/03/migrate-your-rails-app-from-heroku-to-aws-lambda/
MIT License
66 stars 7 forks source link

Command rails db:create doesn't work #24

Open kihaya opened 3 years ago

kihaya commented 3 years ago

Environment

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
metaskills commented 3 years ago

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 commented 3 years ago

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
kihaya commented 3 years ago

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 ?