Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Use squiggly heredoc to strip odd indentation in the executed SQL | Ryuta Kamizono | 2018-11-22 | 1 | -7/+7 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: ``` LOG: execute <unnamed>: SELECT t.oid, t.typname FROM pg_type as t WHERE t.typname IN ('int2', 'int4', 'int8', 'oid', 'float4', 'float8', 'bool') LOG: execute <unnamed>: SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, r.rngsubtype, t.typtype, t.typbasetype FROM pg_type as t LEFT JOIN pg_range as r ON oid = rngtypid WHERE t.typname IN ('int2', 'int4', 'int8', 'oid', 'float4', 'float8', 'text', 'varchar', 'char', 'name', 'bpchar', 'bool', 'bit', 'varbit', 'timestamptz', 'date', 'money', 'bytea', 'point', 'hstore', 'json', 'jsonb', 'cidr', 'inet', 'uuid', 'xml', 'tsvector', 'macaddr', 'citext', 'ltree', 'interval', 'path', 'line', 'polygon', 'circle', 'lseg', 'box', 'time', 'timestamp', 'numeric') OR t.typtype IN ('r', 'e', 'd') OR t.typinput::varchar = 'array_in' OR t.typelem != 0 LOG: statement: SHOW TIME ZONE LOG: statement: SELECT 1 LOG: execute <unnamed>: SELECT COUNT(*) FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = c.relnamespace WHERE c.relkind IN ('r','v','m') -- (r)elation/table, (v)iew, (m)aterialized view AND c.relname = 'accounts' AND n.nspname = ANY (current_schemas(false)) ``` After: ``` LOG: execute <unnamed>: SELECT t.oid, t.typname FROM pg_type as t WHERE t.typname IN ('int2', 'int4', 'int8', 'oid', 'float4', 'float8', 'bool') LOG: execute <unnamed>: SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, r.rngsubtype, t.typtype, t.typbasetype FROM pg_type as t LEFT JOIN pg_range as r ON oid = rngtypid WHERE t.typname IN ('int2', 'int4', 'int8', 'oid', 'float4', 'float8', 'text', 'varchar', 'char', 'name', 'bpchar', 'bool', 'bit', 'varbit', 'timestamptz', 'date', 'money', 'bytea', 'point', 'hstore', 'json', 'jsonb', 'cidr', 'inet', 'uuid', 'xml', 'tsvector', 'macaddr', 'citext', 'ltree', 'interval', 'path', 'line', 'polygon', 'circle', 'lseg', 'box', 'time', 'timestamp', 'numeric') OR t.typtype IN ('r', 'e', 'd') OR t.typinput::varchar = 'array_in' OR t.typelem != 0 LOG: statement: SHOW TIME ZONE LOG: statement: SELECT 1 LOG: execute <unnamed>: SELECT COUNT(*) FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = c.relnamespace WHERE c.relkind IN ('r','v','m') -- (r)elation/table, (v)iew, (m)aterialized view AND c.relname = 'accounts' AND n.nspname = ANY (current_schemas(false)) ``` | ||||
* | Use assert_predicate and assert_not_predicate | Daniel Colson | 2018-01-25 | 1 | -4/+4 |
| | |||||
* | Merge pull request #29869 from kamipo/make_type_map_to_private | Rafael França | 2017-07-21 | 1 | -1/+1 |
|\ | | | | | Make `type_map` to private because it is only used in the connection adapter | ||||
| * | Make `type_map` to private because it is only used in the connection adapter | Ryuta Kamizono | 2017-07-20 | 1 | -1/+1 |
| | | | | | | | | | | | | | | `type_map` is an internal API and it is only used in the connection adapter. And also, some type map initializer methods requires passed `type_map`, but those instances already has `type_map` in itself. So we don't need explicit passing `type_map` to the initializers. | ||||
* | | Use frozen-string-literal in ActiveRecord | Kir Shatrov | 2017-07-19 | 1 | -0/+2 |
|/ | |||||
* | Revert "Merge pull request #29540 from kirs/rubocop-frozen-string" | Matthew Draper | 2017-07-02 | 1 | -1/+0 |
| | | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa. | ||||
* | Enforce frozen string in Rubocop | Kir Shatrov | 2017-07-01 | 1 | -0/+1 |
| | |||||
* | normalizes indentation and whitespace across the project | Xavier Noria | 2016-08-06 | 1 | -5/+5 |
| | |||||
* | applies new string literal convention in activerecord/test | Xavier Noria | 2016-08-06 | 1 | -6/+6 |
| | | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default. | ||||
* | make it possible to run AR tests with bin/test | Yves Senn | 2015-06-11 | 1 | -2/+2 |
| | |||||
* | Prefer `drop_table if_exists: true` over raw SQL | Ryuta Kamizono | 2015-02-18 | 1 | -1/+1 |
| | | | | | Lowercase raw SQL has been replaced by 07b659c already. This commit replaces everything else of raw SQL. | ||||
* | `type_cast_from_user` -> `cast` | Sean Griffin | 2015-02-17 | 1 | -1/+1 |
| | |||||
* | `type_cast_for_database` -> `serialize` | Sean Griffin | 2015-02-17 | 1 | -1/+1 |
| | |||||
* | `Type#type_cast_from_database` -> `Type#deserialize` | Sean Griffin | 2015-02-17 | 1 | -1/+1 |
| | |||||
* | rm `Type#number?` | Sean Griffin | 2015-02-07 | 1 | -2/+0 |
| | | | | | This predicate is only used in `query_attribute`, and is relatively easy to remove without adding a bunch of is a checks. | ||||
* | Removed magic comments # encoding: utf-8 , since its default from ruby 2.0 ↵ | Vipul A M | 2015-02-03 | 1 | -1/+0 |
| | | | | onwards. | ||||
* | Remove most type related predicates from `Column` | Sean Griffin | 2015-01-30 | 1 | -4/+8 |
| | | | | | | Remaining are `limit`, `precision`, `scale`, and `type` (the symbol version). These will remain on the column, since they mirror the options to the `column` method in the schema definition DSL | ||||
* | Prefer `array?` rather than `array` | Ryuta Kamizono | 2015-01-04 | 1 | -2/+2 |
| | | | | | | Slightly refactoring `PostgreSQLColumn`. `array` should be readonly. `default_function` should be initialized by `super`. `sql_type` has been removed `[]`. Since we already choose to remove it we should not change. | ||||
* | Remove the `text?` predicate from the type objects | Sean Griffin | 2014-07-06 | 1 | -2/+0 |
| | | | | | | | This was only used for uniqueness validations. The first usage was in conjunction with `limit`. Types which cast to string, but are not considered text cannot have a limit. The second case was only with an explicit `:case_sensitive => true` option given by the user. | ||||
* | Introduce an Attribute object to handle the type casting dance | Sean Griffin | 2014-06-13 | 1 | -1/+1 |
| | | | | | | | | | | | | | | | There's a lot more that can be moved to these, but this felt like a good place to introduce the object. Plans are: - Remove all knowledge of type casting from the columns, beyond a reference to the cast_type - Move type_cast_for_database to these objects - Potentially make them mutable, introduce a state machine, and have dirty checking handled here as well - Move `attribute`, `decorate_attribute`, and anything else that modifies types to mess with this object, not the columns hash - Introduce a collection object to manage these, reduce allocations, and not require serializing the types | ||||
* | Make `_before_type_cast` actually be before type cast | Sean Griffin | 2014-06-09 | 1 | -1/+5 |
| | | | | | | | | | | | | | - The following is now true for all types, all the time - `model.attribute_before_type_cast == given_value` - `model.attribute == model.save_and_reload.attribute` - `model.attribute == model.dup.attribute` - `model.attribute == YAML.load(YAML.dump(model)).attribute` - Removes the remaining types implementing `type_cast_for_write` - Simplifies the implementation of time zone aware attributes - Brings tz aware attributes closer to being implemented as an attribute decorator - Adds additional point of control for custom types | ||||
* | test pg, rm unused requires. | Yves Senn | 2014-06-03 | 1 | -2/+0 |
| | |||||
* | Remove most code related to serialized properties | Sean Griffin | 2014-06-01 | 1 | -0/+1 |
| | | | | | | | | | | | Nearly completely implemented in terms of custom properties. `_before_type_cast` now stores the raw serialized string consistently, which removes the need to keep track of "state". The following is now consistently true: - `model.serialized == model.reload.serialized` - A model can be dumped and loaded infinitely without changing - A model can be saved and reloaded infinitely without changing | ||||
* | Move types to the top level `ActiveRecord` namespace | Sean Griffin | 2014-05-27 | 1 | -1/+1 |
| | | | | | `ActiveRecord::ConnectionAdapters::Type::Value` => `ActiveRecord::Type::Value` | ||||
* | Add an interface for type objects to control Ruby => SQL | Sean Griffin | 2014-05-26 | 1 | -1/+0 |
| | | | | | Adds the ability to save custom types, which type cast to non-primitive ruby objects. | ||||
* | Use the generic type map for all PG type registrations | Sean Griffin | 2014-05-22 | 1 | -9/+1 |
| | | | | | | | We're going to want all of the benefits of the type map object for registrations, including block registration and real aliasing. Moves type name registrations to the adapter, and aliases the OIDs to the named types | ||||
* | Delegate predicate methods to injected type object on Column | Sean Griffin | 2014-05-20 | 1 | -1/+1 |
| | |||||
* | Delegate `Column#type` to the injected type object | Sean Griffin | 2014-05-19 | 1 | -1/+0 |
| | | | | | | | | | | | | | | | | The decision to wrap type registrations in a proc was made for two reasons. 1. Some cases need to make an additional decision based on the type (e.g. a `Decimal` with a 0 scale) 2. Aliased types are automatically updated if they type they point to is updated later. If a user or another adapter decides to change the object used for `decimal` columns, `numeric`, and `number` will automatically point to the new type, without having to track what types are aliased explicitly. Everything else here should be pretty straightforward. PostgreSQL ranges had to change slightly, since the `simplified_type` method is gone. | ||||
* | pg, clarify default behavior for composite types. | Yves Senn | 2014-05-13 | 1 | -7/+94 |
| | | | | | | | | | | | | * by default composite types are mapped as `OID::Identity` and issue a warning * the user is advised to register his own `OID::Type` to make use of composite types Registering a new `OID::Type` does currently not allow to specify the type casting behavior when writing to the database. In order for it to work we need to use the values within `@attributes`. They are already being type casted and are ready to be written to the DB. See https://github.com/rails/rails/blob/57643c961feb24b662620d330e71103a830003e8/activerecord/lib/active_record/attribute_methods.rb#L460-L462 | ||||
* | PostgreSQL, test cases to lock the current column types. | Yves Senn | 2014-03-28 | 1 | -0/+11 |
| | |||||
* | Use teardown helper method. | Guo Xiang Tan | 2014-03-14 | 1 | -1/+1 |
| | | | | | | | | Follow-Up to https://github.com/rails/rails/pull/14348 Ensure that SQLCounter.clear_log is called after each test. This is a step to prevent side effects when running tests. This will allow us to run them in random order. | ||||
* | test case to illustrate current PostgreSQL composite behavior. | Yves Senn | 2014-02-11 | 1 | -0/+42 |