1. 12 3月, 2020 6 次提交
  2. 11 3月, 2020 5 次提交
  3. 10 3月, 2020 9 次提交
  4. 09 3月, 2020 1 次提交
    • E
      Refactor schema migration on connection · 095f1bfa
      eileencodes 提交于
      This method was jumping through extra hoops to find the name of the
      class the connection is stored on when we can get it from the connection
      itself. Since we already have the connection we don't need to loop through the
      pools.
      
      In addition, this was using the wrong class name. The class name for the
      schema migration should come from the connection owner class, not from
      the `db_config.name`. In this case, `db_config.name` is the name of the
      configuration in the database.yml. Rails uses the class name to lookup
      connections, not the db config name, so we should be consistent here.
      
      While working on this I noticed that we were generating an extra schema
      migration class for `ActiveRecord::Base`. Since `ActiveRecord::Base` can
      and should use the default and we don't want to create a new one for
      single db applications, we should skip creating this if the spec name is
      `ActiveRecord::Base`. I added an additional test that ensures the class
      generation is correct.
      095f1bfa
  5. 08 3月, 2020 1 次提交
  6. 07 3月, 2020 6 次提交
    • E
      Merge pull request #38672 from eileencodes/remove-owner_name · e00f9c8a
      Eileen M. Uchitelle 提交于
      Remove owner_name
      e00f9c8a
    • E
      Remove owner_name · 7400d195
      eileencodes 提交于
      We don't actually need this since the only reason it exists is to pass
      the owning class name down to the `handler`. This removes a level of
      indirection and an unnecessary accessor on db_config. db_config
      shouldn't have to know what class owns it, so we can just remove this
      and pass it to the handler.
      
      The Symbol case is needed to preserve current behavior. This doesn't
      need a changelog because it's changing un-released behavior.
      Co-authored-by: NJohn Crepezzi <john.crepezzi@gmail.com>
      7400d195
    • E
      Merge pull request #38670 from eileencodes/remove-unnecessary-lines · 526dd647
      Eileen M. Uchitelle 提交于
      Remove unnecessary creation of new hash config
      526dd647
    • E
      Remove unnecessary creation of new hash config · 1da6a906
      eileencodes 提交于
      This line was creating a new hash config, but we should always have a
      hash config to lookup at this point.
      
      Previously we needed this code because the pool name was merged into the
      hash. Now it's an accessor on the db_config, so we have no reason to
      create a new hash config.
      
      Also, change env_name to name since it's only an env in a single db
      application or an application with no arguments for
      establish_connection.
      1da6a906
    • E
      Move nil config_or_env handling · 0946cb92
      eileencodes 提交于
      `config_or_env` can only be `nil` if called by `establish_connection`.
      If `connects_to` had a `connects_to database: { writing: nil }` that
      would make no sense.
      
      This is a really minor refactoring that moves the assignment if `nil`
      into the only method that can actually receive nil. Then
      `resolve_config_for_connection` will never get nil passed to it.
      0946cb92
    • E
      Add erb tests for multi-db · 67b102a5
      eileencodes 提交于
      If I had had these tests previously I would have not created PR #38658
      and then promptly realize I needed to revert it.
      
      We need to load and parse the configurations twice. Once before the
      environment is loaded to create the named tasks and once after the
      environment is loaded to have the real configurations. The configs
      loaded before the env have the ERB stripped out and aren't valid
      configs.
      67b102a5
  7. 06 3月, 2020 12 次提交