1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

13 commits

Author SHA1 Message Date
schneems
707be603cf ensure environment is run before db:structure:load
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
```
2013-12-25 18:03:55 -05:00
schneems
ba882934bb Partial fix of database url tests
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
2013-12-25 18:03:55 -05:00
Kuldeep Aggarwal
b9d79b1f5f using symbol instead of string in establish_connection 2013-12-25 15:24:25 +05:30
schneems
dd93a5f459 Use Full path to sqlite database in tests 2013-12-22 00:56:59 -05:00
Arun Agrawal
c10a78124c More Warnings removed for ruby trunk
Same as 4d4ff531b8
2013-11-01 13:47:23 +01:00
José Valim
dd5a80dc3d Remove hard coded references to Active Record in railties 2013-03-02 13:52:32 -07:00
Terence Lee
e3f5d023ff run the load_structure test in the test environment 2013-02-21 01:25:05 +11:00
Terence Lee
44298c39e4 test DATABASE_URL without database.yml around 2013-02-21 01:25:05 +11:00
Carlos Antonio da Silva
cf05e5f6ea Stop shelling out more than necessary 2012-12-07 00:06:08 -02:00
Carlos Antonio da Silva
43c284297b Run rake tasks all at once in rake dbs test for a speed up
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
2012-12-06 21:43:14 -02:00
Rafael Mendonça França
9cd831a0b0 Fix syntax error in assert_match 2012-09-15 09:13:48 -03:00
Arun Agrawal
ff04bb84e1 Few more warnings removed.
I found them when I was running
warning mode on with railties

See https://github.com/rails/rails/pull/3782
2012-09-15 14:26:04 +05:30
Grace Liu
148c50b49a fixed support for DATABASE_URL for rake db tasks
- 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).
2012-09-11 20:40:13 -07:00