aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/schema_dumper_test.rb
Commit message (Collapse)AuthorAgeFilesLines
...
* Dump `bigint` instead of `integer` with `limit: 8` for schema dumperRyuta Kamizono2016-03-111-6/+6
| | | | | | | | | | | | | | | | | | Before: ```ruby create_table "big_numbers", force: :cascade do |t| t.integer "bigint_column", limit: 8 end ``` After: ```ruby create_table "big_numbers", force: :cascade do |t| t.bigint "bigint_column" end ```
* Revert "Dump indexes in `create_table` instead of `add_index`"Sean Griffin2016-02-051-10/+10
| | | | | | | | | | This reverts commit 99801c6a7b69eb4b006a55de17ada78f3a0fa4c1. 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.
* Shorten ActiveRecord::InternalMetadata.table_name to ar_internal_metadataYasuo Honda2016-02-011-4/+4
| | | | to support Oracle database which only supports 30 byte identifier length
* Merge pull request #22967 from schneems/schneems/generic-metadataSean Griffin2016-01-081-0/+4
|\ | | | | Prevent destructive action on production database
| * Fixing tests and re-locating error checking.schneems2016-01-081-4/+4
| |
| * Prevent destructive action on production databaseschneems2016-01-071-0/+4
| | | | | | | | | | | | | | 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`.
* | Merge pull request #20815 from ↵Matthew Draper2015-12-181-1/+1
|\ \ | | | | | | | | | | | | | | | byroot/do-not-include-column-limit-if-it-is-default Do not include column limit in schema.rb if it matches the default
| * | Do not include column limit in schema.rb if it matches the defaultJean Boussier2015-07-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | When working on engines that supports multiple databases, it's very annoying to have a different schema.rb output based on which database you use. MySQL being the primary offender. This patch should reduce the disparities a bit.
* | | Remove legacy mysql adapterAbdelkader Boudih2015-12-171-4/+4
| |/ |/|
* | Internal test migrations use the private 'Current' versionMatthew Draper2015-12-151-2/+2
| | | | | | | | | | | | | | | | Apart from specific versioning support, our tests should focus on the behaviour of whatever version they're accompanying, regardless of when they were written. Application code should *not* do this.
* | Merge pull request #22271 from ↵Yves Senn2015-11-171-0/+32
|\ \ | | | | | | | | | | | | | | | timbreitkreutz/twb-9015-schema-dumper-test-for-prefix-and-ignore Test case for Issue #9015 - ignore_table and table_prefix at same time
| * | TWB Test case for Issue #9015 - ignore_table and table_prefix at same timeTim Breitkreutz2015-11-131-0/+32
|/ /
* / Fix to correctly schema dump the `tinyblob`Ryuta Kamizono2015-10-151-1/+1
|/ | | | | | Currently `tinyblob` is dumped to `t.binary "tiny_blob", limit: 255`. But `t.binary ... limit: 255` is generating SQL to `varchar(255)`. It is incorrect. This commit fixes this problem.
* Display decimal defaults as strings to keep precisionJohn Gesimondo2015-06-231-2/+2
|
* Correctly handle array columns with defaults in the schema dumperSean Griffin2015-06-111-0/+5
| | | | | | | | | If the subtype provides custom schema dumping behavior, we need to defer to it. We purposely choose not to handle any values other than an array (which technically should only ever be `nil`, but I'd rather code defensively here). Fixes #20515.
* Dump indexes in `create_table` instead of `add_index`Ryuta Kamizono2015-05-031-10/+10
| | | | | If the adapter supports indexes in create table, generated SQL is slightly more efficient.
* Fix (intermittent?) test failureMatthew Draper2015-04-131-1/+1
| | | | | | We don't actually need to enumerate the possible types here any more; that dates back to before e105e599e706780905d4c348394da989de3b200f, when they were symbols, and indistinguishable from other options.
* Delegate limit to subtypewallerjake2015-03-211-0/+5
| | | | | | | | | | As described here https://github.com/rails/rails/issues/19420. When using the Postgres BigInt[] field type the big int value was not being translated into schema.rb. This caused the field to become just a regular integer field when building off of schema.rb. This fix will address this by delegating the limit from the subtype to the Array type. https://github.com/rails/rails/issues/19420
* Closes rails/rails#18864: Renaming transactional fixtures to transactional testsBrandon Weiss2015-03-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | I’m renaming all instances of `use_transcational_fixtures` to `use_transactional_tests` and “transactional fixtures” to “transactional tests”. I’m deprecating `use_transactional_fixtures=`. So anyone who is explicitly setting this will get a warning telling them to use `use_transactional_tests=` instead. I’m maintaining backwards compatibility—both forms will work. `use_transactional_tests` will check to see if `use_transactional_fixtures` is set and use that, otherwise it will use itself. But because `use_transactional_tests` is a class attribute (created with `class_attribute`) this requires a little bit of hoop jumping. The writer method that `class_attribute` generates defines a new reader method that return the value being set. Which means we can’t set the default of `true` using `use_transactional_tests=` as was done previously because that won’t take into account anyone using `use_transactional_fixtures`. Instead I defined the reader method manually and it checks `use_transactional_fixtures`. If it was set then it should be used, otherwise it should return the default, which is `true`. If someone uses `use_transactional_tests=` then it will overwrite the backwards-compatible method with whatever they set.
* Fix mysql's schema.rb dumper so it does not include limit on emulated ↵Court3nay2015-02-241-0/+5
| | | | boolean tinyint(1) fields
* Add schema dumping tests for datetime and time precisionRyuta Kamizono2015-02-201-7/+0
|
* Prefer `drop_table if_exists: true` over raw SQLRyuta Kamizono2015-02-181-1/+1
| | | | | Lowercase raw SQL has been replaced by 07b659c already. This commit replaces everything else of raw SQL.
* Remove debug codeCarlos Antonio da Silva2015-02-081-5/+0
| | | | Added by 101c19f55f5f1d86d35574b805278f11e9a1a48e.
* Allow a symbol to be passed to `attribute`, in place of a type objectSean Griffin2015-02-061-0/+5
| | | | | | | | | | | | | | | | | | The same is not true of `define_attribute`, which is meant to be the low level no-magic API that sits underneath. The differences between the two APIs are: - `attribute` - Lazy (the attribute will be defined after the schema has loaded) - Allows either a type object or a symbol - `define_attribute` - Runs immediately (might get trampled by schema loading) - Requires a type object This was the last blocker in terms of public interface requirements originally discussed for this feature back in May. All the implementation blockers have been cleared, so this feature is probably ready for release (pending one more look-over by me).
* Fix `test_types_line_up` when column type missingRyuta Kamizono2015-01-301-2/+2
| | | | | | | a column type `xml` is missing in regexp pattarn. However, `assert_equal 1, lengths.uniq.length` is success when `lengths` are all `nil` because a column type is missing. a test will be failed by using `compact` when a column type is missing.
* Should escape regexp wildcard character `.`Ryuta Kamizono2015-01-191-18/+18
| | | | | `.` is regexp meta character. It should be escape for `assert_match` correctly.
* Add firebird support to test suiteRay Zane2015-01-051-0/+2
|
* Allow precision option for MySQL datetimes.Ryuta Kamizono2015-01-021-0/+7
|
* `force: :cascade` to recreate tables referenced by foreign-keys.Yves Senn2014-12-191-0/+5
|
* tests, move schema shorthand assertions into pg specific tests.Yves Senn2014-12-021-71/+0
|
* Remove is_a? check when ignoring tablesSean Griffin2014-11-201-10/+0
| | | | | Technically changes the API, as it will allow any object which responds to `===`. Personally, I think this is more flexible.
* Added SchemaDumper support for tables with jsonb columns.Ted O'Meara2014-11-041-7/+0
|
* Replace Enumerable#reverse.each with Enumerable#reverse_eachErik Michaels-Ober2014-10-131-1/+1
|
* do not dump foreign keys for ignored tables.Yves Senn2014-09-171-0/+5
|
* Speed up schema dumper testsJeremy Kemper2014-09-101-11/+9
| | | | Dump the standard schema once instead of redoing it per test
* Include default column limits in schema.rbJeremy Kemper2014-09-101-4/+10
| | | | | | Allows :limit defaults to be changed without pulling the rug out from under old migrations that omitted :limit because it matched the default at the time.
* MySQL: schema.rb now includes TEXT and BLOB column limits.Jeremy Kemper2014-09-101-4/+4
|
* MySQL: correct LONGTEXT and LONGBLOB limits from 2GB to their true 4GBJeremy Kemper2014-09-101-2/+2
|
* Reset ActiveRecord::SchemaDumper.ignore_tables value after changed in testsAkira Matsuda2014-09-031-26/+12
|
* Remove 'if exists' from drop table statement then use `table_exists?`Yasuo Honda2014-09-031-1/+1
| | | | | Since 'drop table if exists' statement does not always work with some databases such as Oracle.
* create_table + transactional_fixtures = :bomb:Akira Matsuda2014-08-151-0/+4
|
* fk: dump foreign keys at the bottom to make sure tables exist.Yves Senn2014-06-261-0/+7
|
* fk: dump foreign keys to schema.rbYves Senn2014-06-261-1/+11
| | | | respect `table_name_prefix` and `table_name_suffix`.
* test, fix typo, `create_index` does not exist.Yves Senn2014-06-101-1/+1
|
* Add missing test cases for schema dumping defaultsSean Griffin2014-06-061-0/+29
|
* pg, preserve point type when schema dumping.Yves Senn2014-06-031-1/+1
|
* Remove duplicated setup in testSean Griffin2014-05-231-4/+3
|
* Move extract_scale to decimal typeSean Griffin2014-05-211-2/+2
| | | | | | The only type that has a scale is decimal. There's a special case where decimal columns with 0 scale are type cast to integers if the scale is not specified. Appears to only affect schema dumping.
* Merge pull request #12016 from roderickvd/uuid_fixesRafael Mendonça França2014-04-041-1/+1
|\ | | | | | | | | | | | | | | | | | | Auto-generate stable fixture UUIDs on PostgreSQL Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/fixtures.rb activerecord/test/cases/adapters/postgresql/uuid_test.rb activesupport/CHANGELOG.md
| * Auto-generate stable fixture UUIDs on PostgreSQL.Roderick van Domburg2014-01-071-1/+1
| | | | | | | | Fixes: #11524