| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
db:fixtures:load"
This reverts commit 482fdad5ef8a73688b50bba3991dd4ef6f286edd.
Fixes #17237.
|
|
|
|
|
| |
This is a follow-up to ded17a4 to get the build passing on Travis.
As Travis has `ENV["RACK_ENV"]` set to `test` we need to reset that as well.
|
|
|
|
|
|
|
|
|
|
| |
[Joshua Cody & Yves Senn]
Closes #16757.
Prior to this patch schema loading rake tasks had the potential to leak a
connection to a different database. This had side-effects when rake tasks
operating on the current connection (like `db:seed`) were chained.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Restore the 4.0 behaviour for 'sqlite3:///', but deprecate it. We'll
change to the absolute-path interpretation in 4.2.
The current "correct" spellings for in-memory, relative, and absolute
URLs, respectively, are:
sqlite3::memory:
sqlite3:relative/path
sqlite3:/full/path
Substantially reverses/defers fbb79b517f3127ba620fedd01849f9628b78d6ce.
Uncovered by @guilleiguaran while investigating #14495, though that
sounds like a different issue.
|
|
|
|
| |
This is a test case for the fix provided in eafec4694c5b37eff9d83b1188b8e331fa6027fa
|
|
|
|
|
| |
Just pass in the expected database as argument rather than "caching"
it in a hash and using the hash in the helper methods.
|
|
|
|
| |
Also fix indent of test block.
|
| |
|
|
|
| |
See https://github.com/rails/rails/pull/13463#issuecomment-31480799 for full conversation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Move check from generated helper to test_help.rb, so that all
applications can benefit
* Rather than just raising when the test schema has pending migrations,
try to load in the schema and only raise if there are pending
migrations afterwards
* Opt out of the check by setting
config.active_record.maintain_test_schema = false
* Deprecate db:test:* tasks. The test helper is now fully responsible
for maintaining the test schema, so we don't need rake tasks for this.
This is also a speed improvement since we're no longer reloading the
test database on every call to "rake test".
|
| |
|
|
|
|
| |
By using the URL sub key in the `database.yml` by default we are exposing the ability to set other attributes such as `pool` or `reap_frequency` without need of modifying the URL to contain non-connection specific information.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Right now `db:drop` depends on `load_config` since so when `db:drop` gets executed `load_config` gets run. `db:structure:load` depends on `[:environment, :load_config]`. So before it runs, it executes `environment` but because `load_config` has already executed it is skipped. Note `db:load_config` is "invoke"-d twice, but only "execute"-d once:
```
** Invoke db:drop (first_time)
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:drop
** Invoke db:structure:load (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config
** Execute db:structure:load
```
The fix for this is making sure that the environment is run before any `load_config`:
```
** Invoke environment (first_time)
** Execute environment
** Invoke db:drop (first_time)
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:drop
** Invoke db:structure:load (first_time)
** Invoke environment
** Invoke db:load_config
** Execute db:structure:load
```
|
|
|
|
|
|
|
|
| |
Prior to #13463 when `DATABASE_URL` was set, Rails automagically used that value instead of the database.yml. There are tests in dbs_test that expect this to still be true. After that PR, `RAILS_DATABASE_URL` is expected to be read into the YAML file via ERB, this PR fixes that behavior.
Note: this does not entirely fix the tests. It seems that `ActiveRecord::Tasks::DatabaseTasks.current_config` does not process the url string correctly (convert it into a hash), and ` ActiveRecord::Tasks::DatabaseTasks.structure_load(current_config, filename)` as well as other methods in `DatabaseTasks` expect a hash.
It seems like we should involve the resolver somewhere in this process to correctly convert the database url, I do not know the best place for that /cc @josevalim
|
| |
|
| |
|
|
|
|
| |
Same as 4d4ff531b8807ee88a3fc46875c7e76f613956fb
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
Finished tests in 56.245787s, 0.2133 tests/s, 0.0000 assertions/s.
12 tests, 0 assertions, 0 failures, 0 errors, 0 skips
After:
Finished tests in 42.401416s, 0.2830 tests/s, 0.0000 assertions/s.
12 tests, 0 assertions, 0 failures, 0 errors, 0 skips
|
| |
|
|
|
|
|
|
|
| |
I found them when I was running
warning mode on with railties
See https://github.com/rails/rails/pull/3782
|
|
- added tests to confirm establish_connection uses DATABASE_URL and
Rails.env correctly even when no arguments are passed in.
- updated rake db tasks to support DATABASE_URL, and added tests to
confirm correct behavior for these rake tasks. (Removed
establish_connection call from some tasks since in those cases
the :environment task already made sure the function would be called)
- updated Resolver so that when it resolves the database url, it
removes hash values with empty strings from the config spec (e.g.
to support connection to postgresql when no username is specified).
|