aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/schema
Commit message (Collapse)AuthorAgeFilesLines
* Test microsecond on mysql 5.6Arthur Neves2014-03-121-1/+5
|
* register OID for PostgreSQL citex datatype [Troy Kruthoff & Lachlan Sylvester]lsylvester2014-03-111-1/+10
| | | | citext makes it possible to use AR Hash finders for case-insensitive matching as sql UPPER/LOWER functions are not needed.
* Fixed STI classes not defining an attribute method if there is aGodfrey Chan2014-02-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | conflicting private method defined on its ancestors. The problem is that `method_defined_within?(name, klass, superklass)` only works correclty when `klass` and `superklass` are both `Class`es. If both `klass` and `superklass` are both `Class`es, they share the same inheritance chain, so if a method is defined on `klass` but not `superklass`, this method must be introduced at some point between `klass` and `superklass`. This does not work when `superklass` is a `Module`. A `Module`'s inheritance chain contains just itself. So if a method is defined on `klass` but not on `superklass`, the method could still be defined somewhere upstream, e.g. in `Object`. This fix works by avoiding calling `method_defined_within?` with a module while still fufilling the requirement (checking that the method is defined withing `superclass` but not is not a generated attribute method). 4d8ee288 is likely an attempted partial fix for this problem. This unrolls that fix and properly check the `superclass` as intended. Fixes #11569.
* Add more tests for the dirty feature for enumsRafael Mendonça França2014-01-211-0/+1
|
* Don't try to get the subclass if the inheritance column doesn't existUjjwal Thaakar2014-01-141-0/+5
| | | | | | | The `subclass_from_attrs` method is called even if the column specified by the `inheritance_column` setting doesn't exist. This prevents setting associations via the attributes hash if the association name clashes with the value of the setting, typically `:type`. This worked previously in Rails 3.2.
* Fix: ActiveRecord::Store TypeError conversion when using YAML coderThales Oliveira2014-01-061-0/+1
| | | | | | | | | | Renaming the test accordingly to its behaviour Adding 'Fixes' statement to changelog Improving tests legibility & changelog Undoing mistakenly removed empty line & further improving changelog
* Building new records with enum scopes now works as expectedGodfrey Chan2014-01-031-4/+0
| | | | | | | | | | | | | | | | | | | | | | Previously, this would give an `ArgumentError`: class Issue < ActiveRecord::Base enum :status, [:open, :finished] end Issue.open.build # => ArgumentError: '0' is not a valid status Issue.open.create # => ArgumentError: '0' is not a valid status PR #13542 muted the error, but the issue remains. This commit fixes the issue by allowing the enum value to be written directly via the setter: Issue.new.status = 0 # This now sets status to :open Assigning a value directly via the setter like this is not part of the documented public API, so users should not rely on this behavior. Closes #13530.
* Fix the enums writer methodsRobin Dupret2014-01-011-0/+4
| | | | | | | | | | | Previously, the writer methods would simply check whether the passed argument was the symbol representing the integer value of an enum field. Therefore, it was not possible to specify the numeric value itself but the dynamically defined scopes generate where clauses relying on this kind of values so a chained call to a method like `find_or_initialize_by` would trigger an `ArgumentError`. Reference #13530
* extract PG range tests from datatype_test.rb into range_test.rbYves Senn2013-12-131-14/+1
|
* Prevent invalid code when using dynamic finders with Ruby's reserved words.Lauro Caetano2013-12-111-0/+1
| | | | | | | | | | | | | | | | | | | | | The dynamic finder was creating the method signature with the parameters name, which may have reserved words and this way creating invalid Ruby code. Closes: #13261 Example: # Before Dog.find_by_alias('dog name') # Was creating this method def self.find_by_alias(alias, options = {}) # After Dog.find_by_alias('dog name') # Will create this method def self.find_by_alias(_alias, options = {})
* Do not create synonym named subjectsYasuo Honda2013-11-271-3/+0
| | | | | | | because it is only used in `activerecord/test/cases/adapters/oracle/synonym_test.rb` See rails/rails#13054
* Use 1.9 Hash syntax consistentlyPablo Torres2013-11-051-1/+1
|
* Convert schema file to ruby 1.9 style hashCarlos Antonio da Silva2013-11-041-214/+214
|
* Style fixes on test schema fileCarlos Antonio da Silva2013-11-041-6/+6
|
* Explicit mapping for enumYury Korolev2013-11-021-0/+1
|
* Added ActiveRecord::Base#enum for declaring enum attributes where the values ↵David Heinemeier Hansson2013-11-021-0/+1
| | | | map to integers in the database, but can be queried by name
* scope_chain should not be mutated for other reflectionsNeeraj Singh2013-10-141-0/+16
| | | | | | | | | | | Currently `scope_chain` uses same array for building different `scope_chain` for different associations. During processing these arrays are sometimes mutated and because of in-place mutation the changed `scope_chain` impacts other reflections. Fix is to dup the value before adding to the `scope_chain`. Fixes #3882.
* Remove sqlite specific`supports_autoincrement?` which always defaults to trueVipul A M2013-08-101-5/+2
|
* Use the proper encoding comment on the fileRafael Mendonça França2013-08-061-0/+2
|
* adding a weird test caseAaron Patterson2013-08-061-0/+1
|
* Add test to AR's counter_cache_test.rbTakehiro Adachi2013-05-181-0/+1
| | | | | | | According to https://github.com/rails/rails/blob/b601399b72ab56cc01368f02615af99f45d1 4f02/activerecord/lib/active_record/counter_cache.rb#L14, u can pass more then one association to the `reset_counters` method.
* Correctly parse bigint defaults in PostgreSQLErik Peterson2013-04-051-0/+1
|
* fix detect column type of enummasarakki2013-04-012-2/+2
| | | | enum includes text or blob or ... hooked by wrong regex
* Add support for FULLTEXT and SPATIAL indexes using the :type flag for MySQL.Ken Mazaika2013-03-272-0/+20
|
* Dump the 'using' options for a SQL index into the schema.Ken Mazaika2013-03-271-0/+1
|
* Update other counter caches on destroyIan Young2013-03-201-3/+5
|
* Refactor Person/Friendship relationships to be more intuitiveMack Earnhardt2013-03-171-1/+2
| | | | | | | | PR #5210 added a Friendship model to illustrate a bug, but in doing so created a confusing structure because both belongs_to declarations in Friendship referred to the same side of the join. The new structure maintains the integrity of the bug test while changing the follower relationship to be more useful for other testing.
* Merge pull request #9597 from senny/9110_serialized_not_null_defaultRafael Mendonça França2013-03-071-0/+1
|\ | | | | test case for `serialize` default values.
| * test case for `serialize` default values.Yves Senn2013-03-071-0/+1
| | | | | | | | Closes #9110
* | Merge pull request #9105 from bemurphy/cache_key_updated_onRafael Mendonça França2013-03-071-0/+2
|\ \ | |/ |/| | | | | | | | | cache_key consults updated_on timestamp if present Conflicts: activerecord/CHANGELOG.md
| * cache_key consults updated_on timestamp if presentBrendon Murphy2013-02-261-0/+2
| | | | | | | | | | - Extract max timestamp retrieval for cache_key - Update changelog for cache_key changes
* | Revert "Merge pull request #9207 from dylanahsmith/mysql-quote-numeric"Steve Klabnik2013-02-271-2/+0
| | | | | | | | | | This reverts commit 408227d9c5ed7de26310d72a1a99c1ee02311c63, reversing changes made to dca0b57d03deffc933763482e615c3cf0b9a1d97.
* | Fix default output for postgres network address typesErik Peterson2013-02-261-3/+3
|/
* active_record: Quote numeric values compared to string columns.Dylan Smith2013-02-071-0/+2
|
* Prevent Relation#merge from collapsing wheres on the RHSJon Leighton2013-01-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | This caused a bug with the new associations implementation, because now association conditions are represented as Arel nodes internally right up to when the whole thing gets turned to SQL. In Rails 3.2, association conditions get turned to raw SQL early on, which prevents Relation#merge from interfering. The current implementation was buggy when a default_scope existed on the target model, since we would basically end up doing: default_scope.merge(association_scope) If default_scope contained a where(foo: 'a') and association_scope contained a where(foo: 'b').where(foo: 'c') then the merger would see that the same column is representated on both sides of the merge and collapse the wheres to all but the last: where(foo: 'c') Now, the RHS of the merge is left alone. Fixes #8990
* Fix PostgreSQL tests on TravisAndrew White2013-01-241-1/+1
| | | | Travis only has PostgreSQL 9.1.x but 9.2 is required for range datatypes.
* Add postgresql range types supportbUg2013-01-231-12/+14
|
* Support for PostgreSQL's ltree data type.Rob Worley2013-01-041-1/+10
|
* Serialized attribute can be serialized in an integer columnRafael Mendonça França2012-12-211-0/+1
| | | | Fix #8575
* AR supporting new intrange data type on PostgreSQL >= 9.2Alexey2012-12-161-1/+11
|
* Make sure the tests pass in the case closer to described in #8195Rafael Mendonça França2012-12-101-0/+1
| | | | | | Conflicts: activerecord/test/models/bulb.rb activerecord/test/schema/schema.rb
* Fix some indentation in the postgresql_specific_schemaRafael Mendonça França2012-11-281-9/+9
|
* Add comment to a table without model.Rafael Mendonça França2012-11-281-0/+1
| | | | | This table is being used to verify if the :limit options is being ignored for text and binary columns
* Postgresql doesn't accepts limits on text columns.Victor Costan2012-11-201-0/+5
|
* arel columns can be used for grouping so that "weird" column names are usableAaron Patterson2012-11-151-0/+1
|
* Use the MySQL varbinary type when appropriate in migrations.Victor Costan2012-10-272-18/+26
|
* Remove ActiveRecord::ModelJon Leighton2012-10-261-6/+0
| | | | | | | | | | In the end I think the pain of implementing this seamlessly was not worth the gain provided. The intention was that it would allow plain ruby objects that might not live in your main application to be subclassed and have persistence mixed in. But I've decided that the benefit of doing that is not worth the amount of complexity that the implementation introduced.
* #7914 get default value when type uses schema nameArturo Pie2012-10-131-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | PostgreSQL adapter properly parses default values when using multiple schemas and domains. When using domains across schemas, PostgresSQL prefixes the type of the default value with the name of the schema where that type (or domain) is. For example, this query: ``` SELECT a.attname, d.adsrc FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = "defaults"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum; ``` could return something like "'<default_value>'::pg_catalog.text" or "(''<default_value>'::pg_catalog.text)::text" for the text columns with defaults. I modified the regexp used to parse this value so that it ignores anything between ':: and \b(?:character varying|bpchar|text), and it allows to have optional parens like in the above second example.
* Fix reset_counters() crashing on has_many :through associations.lulalala2012-10-021-0/+1
| | | | | The counter column name in the intermediate model need to be access via the through reflection.
* Accept belongs_to assoc. keys in ActiveRecord queriesbeerlington2012-09-111-0/+1
| | | | | | | | | | | | | Allows you to specify the model association key in a belongs_to relationship instead of the foreign key. The following queries are now equivalent: Post.where(:author_id => Author.first) Post.where(:author => Author.first) PriceEstimate.where(:estimate_of_type => 'Treasure', :estimate_of_id => treasure) PriceEstimate.where(:estimate_of => treasure)