1. 20 4月, 2016 1 次提交
  2. 19 4月, 2016 1 次提交
  3. 16 4月, 2016 1 次提交
  4. 11 3月, 2016 1 次提交
  5. 08 3月, 2016 1 次提交
  6. 06 2月, 2016 1 次提交
    • S
      Revert "Dump indexes in `create_table` instead of `add_index`" · d666a5a5
      Sean Griffin 提交于
      This reverts commit 99801c6a.
      
      Ultimately it doesn't matter whether `add_index` or `t.index` are used
      in the schema dumper in any meaningful way. There are gems out there
      which hook into the old behavior for things like indexing materialized
      views. Since the reverted commit doesn't seem to add much benefit,
      there's no reason for us to break these gems.
      d666a5a5
  7. 08 1月, 2016 1 次提交
    • S
      Prevent destructive action on production database · 900bfd94
      schneems 提交于
      This PR introduces a key/value type store to Active Record that can be used for storing internal values. It is an alternative implementation to #21237 cc @sgrif @matthewd.
      
      It is possible to run your tests against your production database by accident right now. While infrequently, but as an anecdotal data point, Heroku receives a non-trivial number of requests for a database restore due to this happening. In these cases the loss can be large.
      
      To prevent against running tests against production we can store the "environment" version that was used when migrating the database in a new internal table. Before executing tests we can see if the database is a listed in `protected_environments` and abort. There is a manual escape valve to force this check from happening with environment variable `DISABLE_DATABASE_ENVIRONMENT_CHECK=1`.
      900bfd94
  8. 23 9月, 2015 1 次提交
    • Y
      introduce `conn.data_source_exists?` and `conn.data_sources`. · 152b85f0
      Yves Senn 提交于
      These new methods are used from the Active Record model layer to
      determine which relations are viable to back a model. These new methods
      allow us to change `conn.tables` in the future to only return tables and
      no views. Same for `conn.table_exists?`.
      
      The goal is to provide the following introspection methods on the
      connection:
      
      * `tables`
      * `table_exists?`
      * `views`
      * `view_exists?`
      * `data_sources` (views + tables)
      * `data_source_exists?` (views + tables)
      152b85f0
  9. 20 9月, 2015 1 次提交
  10. 17 9月, 2015 1 次提交
    • S
      Don't hardcode table name · 03bd6bed
      schneems 提交于
      The schema_migrations table name is configurable. We should use this value when checking for ignored table names when dumping schema instead of a hardcoded value.
      03bd6bed
  11. 13 9月, 2015 1 次提交
  12. 20 5月, 2015 1 次提交
  13. 03 5月, 2015 2 次提交
  14. 06 3月, 2015 1 次提交
  15. 29 12月, 2014 1 次提交
  16. 26 12月, 2014 1 次提交
  17. 19 12月, 2014 1 次提交
  18. 02 12月, 2014 1 次提交
  19. 21 11月, 2014 1 次提交
  20. 30 10月, 2014 1 次提交
  21. 17 9月, 2014 1 次提交
  22. 08 9月, 2014 4 次提交
  23. 26 7月, 2014 1 次提交
    • C
      Extract iterator method in AR::SchemaDumper · 75f3584d
      Caleb Thompson 提交于
      Gems which wish to tie into ActiveRecord::SchemaDumper need to
      duplicate this logic currently. [Foreigner] is one such example, as is a
      library I'm currently working on but which hasn't been released yet:
      
          def tables_with_foreign_keys(stream)
            tables_without_foreign_keys(stream)
            @connection.tables.sort.each do |table|
              next if ['schema_migrations', ignore_tables].flatten.any? do |ignored|
                case ignored
                when String; table == ignored
                when Regexp; table =~ ignored
                else
                  raise StandardError, 'ActiveRecord::SchemaDumper.ignore_tables accepts an array of String and / or Regexp values.'
                end
              end
              foreign_keys(table, stream)
            end
          end
      
      [Foreigner]: https://github.com/matthuhiggins/foreigner/blob/master/lib/foreigner/schema_dumper.rb#L36-L43
      
      Extract the skip logic to a method, making it much simpler to follow
      this same behavior in gems that are tying into the migration flow and
      let them dump only tables that aren't skipped without copying this block
      of code. The above code could then be simplified to:
      
          def tables_with_foreign_keys(stream)
            tables_without_foreign_keys(stream)
            @connection.tables.sort.each do |table|
              foreign_keys(table, stream) unless ignored?(table)
            end
          end
      
      It also, in my opinion, simplifies the logic on ActiveRecord's side, and
      clarifies the intent of the skip logic.
      75f3584d
  24. 11 7月, 2014 1 次提交
    • A
      Dump PostgreSQL primary key with custom function as a default. · 584fc8b3
      Andrey Novikov 提交于
      For example, if use pgcrypto extension in PostgreSQL 9.4 beta 1, where
      uuid-ossp extension isn't available for moment of writing, and thus to
      use a gen_random_uuid() method as a primary key default.
      
      In this case schema dumper wasn't able to correctly reconstruct
      create_table statement and lost primary key constraint on schema load.
      
      Fixes #16111.
      584fc8b3
  25. 27 6月, 2014 6 次提交
  26. 14 10月, 2013 2 次提交
  27. 23 8月, 2013 1 次提交
    • W
      Creating options for schema dumper. · 9f82fb3f
      wangjohn 提交于
      These options make it easier to change the config from
      ActiveRecord::Base to use something else inside of the SchemaDumper.
      9f82fb3f
  28. 04 5月, 2013 1 次提交
  29. 28 3月, 2013 2 次提交