pennylane-hq / activerecord-adapter-redshift

Other
6 stars 26 forks source link

Add explicit RedshiftDatabaseTasks and correct Hash/kwargs confusion #37

Closed owst closed 2 months ago

owst commented 2 months ago

With this change rake db:create db:schema:dump db:drop no longer errors with the Redshift adapter.

This PR partially reverts:

https://github.com/pennylane-hq/activerecord-adapter-redshift/commit/1ce6bdbcba7ade96960886895e7ff1f85d5263c0

to be in-line with the Postgres adapter, where some Hash options still remain and haven't been converted to kwargs.

This avoids the error:

~/.rbenv/versions/3.3.3/lib/ruby/gems/3.3.0/gems/activerecord7-redshift-adapter-pennylane-1.0.4/lib/active_record/connection_adapters/redshift_7_1/schema_statements.rb:40:in `create_database': wrong number of arguments (given 2, expected 1) (ArgumentError)

It also adds an explicit (copy-pasted from the relevant PostgreSQLDatabaseTasks in Rails) RedshiftDatabaseTasks for Redshift. The only change is to make the public schema connection to a database named redshift not postgres. Without the override, attempting to use the database tasks errors with

connection to server at "X.Y.Z.W", port 5439 failed: FATAL:  database "postgres" does not exist
quentindemetz commented 2 months ago

Thank you!