aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'joshsusser-master' into mergeAaron Patterson2012-12-051-4/+4
|\ | | | | | | | | | | | | | | | | | | | | * joshsusser-master: style cleanup Add migration history to schema.rb dump Add metadata to schema_migrations Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/schema.rb
| * Add migration history to schema.rb dumpJosh Susser2012-12-021-2/+2
| |
| * Add metadata to schema_migrationsJosh Susser2012-12-011-3/+3
| | | | | | | | | | migrated_at: timestamp when migration run fingerprint: md5 hash of migration source name: filename without version or extension
* | Fix #8414. Performance problem with postgresql adapter primary_key function.kennyj2012-12-051-3/+2
| |
* | pg_namespace table isn't used.kennyj2012-12-051-1/+0
|/
* Fix memory leak in development modeJon Leighton2012-11-301-8/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Keying these hashes by klass causes reloadable classes to never get freed. Thanks to @thedarkone for pointing this out in the comments on 221571beb6b4bb7437989bdefaf421f993ab6002. This doesn't seem to make a massive difference to performance. Benchmark --------- require 'active_record' require 'benchmark/ips' class Post < ActiveRecord::Base establish_connection adapter: 'sqlite3', database: ':memory:' end GC.disable Benchmark.ips(20) do |r| r.report { Post.connection } end Before ------ Calculating ------------------------------------- 5632 i/100ms ------------------------------------------------- 218671.0 (±1.9%) i/s - 4364800 in 19.969401s After ----- Calculating ------------------------------------- 8743 i/100ms ------------------------------------------------- 206525.9 (±17.8%) i/s - 4039266 in 19.992590s
* schema cache already has the columns as a hash, so use thatAaron Patterson2012-11-252-2/+12
|
* speed up fixture loading by querying the schema cache for column namesAaron Patterson2012-11-252-2/+11
|
* TypoChris Patuzzo2012-11-211-1/+1
|
* Merge pull request #6245 from bogdan/bc_timestampRafael Mendonça França2012-11-212-3/+9
|\ | | | | Postgresql adapter: fix handling of BC timestamps
| * Fix postgresql adapter to handle bc timestamps correctlyBogdan Gusiev2012-11-212-3/+9
| |
* | Refactoring, testing and documenting pg_connection.distinctSemyon Perepelitsa2012-11-211-13/+10
|/
* Postgresql doesn't accepts limits on text columns.Victor Costan2012-11-201-0/+7
|
* Be a bit less conservative with mysql in adapterCarlos Antonio da Silva2012-11-191-1/+1
|
* Add rename_index to change_table.Jarek Radosz2012-11-191-0/+8
|
* Bump mysql gem version to the newly 2.9.0, fix build.Carlos Antonio da Silva2012-11-171-1/+1
|
* Properly deprecate ConnectionHandler#connection_poolsJon Leighton2012-11-091-6/+14
| | | | | | | | Rather than just changing it and hoping for the best. Requested by @jeremy: https://github.com/rails/rails/commit/ba1544d71628abff2777c9c514142d7e9a159111#commitcomment-2106059
* Check if the options value is present before to send the deprecationRafael Mendonça França2012-11-031-4/+6
| | | | message
* Remove old commentRafael Mendonça França2012-11-021-1/+1
| | | | | | | | | | | | | | | This comment is not valid since that `if` is there to make possible to do: remove_index :users, :name Instead of: remove_index :users, column: :name What is a valid use case. [ci skip]
* Deprecate passing a string as third argument of `add_index`Rafael Mendonça França2012-11-021-0/+6
| | | | | | | This was there due historical reasons since 7dc45818dc43c163700efc9896a0f3feafa31138 to give the user the possibility to create unique indexes passing "UNIQUE" as the third argument
* Raise an ArgumentError when passing an invalid option to add_indexRafael Mendonça França2012-11-021-1/+4
| | | | Closes #8104
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-11-036-50/+50
|\ | | | | | | | | | | | | Conflicts: actionpack/lib/action_controller/metal/mime_responds.rb activerecord/lib/active_record/attribute_methods.rb guides/source/working_with_javascript_in_rails.md
| * Migration of docs to 1.9 hash syntaxAvnerCohen2012-10-236-50/+50
| |
* | Make caller attribute in deprecation methods optionalAlexey Gaziev2012-10-303-6/+6
| |
* | Fix bug when Column is trying to type cast boolean values to integer.Rafael Mendonça França2012-10-291-2/+13
| | | | | | | | | | | | | | | | | | | | | | This can occur if the user is using :integer columns to store boolean values. Now we are handling the boolean values but it still raises if the value can't type cast to integer and is not a boolean. See #7509. Fixes #8067. Conflicts: activerecord/CHANGELOG.md
* | Provide a call stack for deprecation warnings where needed.Nikita Afanasenko2012-10-293-9/+10
| | | | | | | | It's sometimes hard to quickly find where deprecated call was performed, especially in case of migrating between Rails versions. So this is an attempt to improve the call stack part of the warning message by providing caller explicitly.
* | SQLite3Adapter#type_cast should not mutate argumentsStefan Rusterholz2012-10-281-1/+1
| |
* | raise `ArgumentError` when redefining the primary key column. Closes #6378Yves Senn2012-10-281-0/+9
| |
* | refactor `SQLite3Adapter#copy_table` to prevent primary key redefinitions. #6378Yves Senn2012-10-281-5/+3
| |
* | Use the MySQL varbinary type when appropriate in migrations.Victor Costan2012-10-271-0/+7
| |
* | Decode attributes pulled from URI.parseShawn Veader2012-10-261-0/+2
| | | | | | | | | | | | | | The RFC indicates that username and passwords may be encoded. http://tools.ietf.org/html/rfc2396#section-3.2.2 Found this trying to use the mysql://username:password@host:port/db and having special characters in the password which needed to be URI encoded.
* | Remove ActiveRecord::ModelJon Leighton2012-10-261-4/+4
|/ | | | | | | | | | 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.
* The default value of a text/blob in mysql strict mode should be nilJon Leighton2012-10-194-20/+14
| | | | | | | | | In non-strict mode it is '', but if someone is in strict mode then we should honour the strict semantics. Also, this removes the need for a completely horrible hack in dirty.rb. Closes #7780
* Fix typo in inet and cidr savingMiguel Herranz2012-10-141-1/+1
|
* #7914 Remove code for unsupported postgreSQL version.Arturo Pie2012-10-132-6/+0
| | | | | | | Remove parsing of character type default values for 8.1 formatting since Rails doesn't support postgreSQL 8.1 anymore. Remove misleading comment unrelated to code.
* #7914 Using a better way to get the defaults from db.Arturo Pie2012-10-132-6/+7
| | | | | | | | | According to postgreSQL documentation: (http://www.postgresql.org/docs/8.2/static/catalog-pg-attrdef.html) we should not be using 'adsrc' field because this field is unaware of outside changes that could affect the way that default values are represented. Thus, I changed the queries to use "pg_get_expr(adbin, adrelid)" instead of the historical "adsrc" field.
* #7914 get default value when type uses schema nameArturo Pie2012-10-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-10-111-1/+1
|\ | | | | | | | | | | Conflicts: activerecord/lib/active_record/persistence.rb railties/lib/rails/generators/rails/resource_route/resource_route_generator.rb
| * Fixed unclosing tagAvnerCohen2012-10-091-1/+1
| |
* | PostgreSQL, quote table names when fetching the primary key. Closes #5920Yves Senn2012-10-051-1/+1
|/
* Support for partial inserts.Jon Leighton2012-09-284-5/+13
| | | | | | | | | | | When inserting new records, only the fields which have been changed from the defaults will actually be included in the INSERT statement. The other fields will be populated by the database. This is more efficient, and also means that it will be safe to remove database columns without getting subsequent errors in running app processes (so long as the code in those processes doesn't contain any references to the removed column).
* Support for specifying transaction isolation levelJon Leighton2012-09-216-15/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If your database supports setting the isolation level for a transaction, you can set it like so: Post.transaction(isolation: :serializable) do # ... end Valid isolation levels are: * `:read_uncommitted` * `:read_committed` * `:repeatable_read` * `:serializable` You should consult the documentation for your database to understand the semantics of these different levels: * http://www.postgresql.org/docs/9.1/static/transaction-iso.html * https://dev.mysql.com/doc/refman/5.0/en/set-transaction.html An `ActiveRecord::TransactionIsolationError` will be raised if: * The adapter does not support setting the isolation level * You are joining an existing open transaction * You are creating a nested (savepoint) transaction The mysql, mysql2 and postgresql adapters support setting the transaction isolation level. However, support is disabled for mysql versions below 5, because they are affected by a bug (http://bugs.mysql.com/bug.php?id=39170) which means the isolation level gets persisted outside the transaction.
* rename AR::Model::Tag to AR::Tag - fixes #7714Francesco Rodriguez2012-09-201-3/+3
|
* Merge pull request #7547 from danmcclain/pg-arraysRafael Mendonça França2012-09-167-15/+287
|\ | | | | Adds migration and type casting support for PostgreSQL Array datatype
| * Moves column dump specific code to a module included in AbstractAdapterDan McClain2012-09-147-15/+287
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Having column related schema dumper code in the AbstractAdapter. The code remains the same, but by placing it in the AbstractAdapter, we can then overwrite it with Adapter specific methods that will help with Adapter specific data types. The goal of moving this code here is to create a new migration key for PostgreSQL's array type. Since any datatype can be an array, the goal is to have ':array => true' as a migration option, turning the datatype into an array. I've implemented this in postgres_ext, the syntax is shown here: https://github.com/dockyard/postgres_ext#arrays Adds array migration support Adds array_test.rb outlining the test cases for array data type Adds pg_array_parser to Gemfile for testing Adds pg_array_parser to postgresql_adapter (unused in this commit) Adds schema dump support for arrays Adds postgres array type casting support Updates changelog, adds note for inet and cidr support, which I forgot to add before Removing debugger, Adds pg_array_parser to JRuby platform Removes pg_array_parser requirement, creates ArrayParser module used by PostgreSQLAdapter
* | Query for sequence info also should be markd as SCHEMA.kennyj2012-09-151-3/+3
| |
* | Query for loading index info should be marked as SCHEMA.kennyj2012-09-152-2/+2
| |
* | simplify rescueJon Leighton2012-09-151-3/+3
| |
* | Fix testJon Leighton2012-09-151-13/+19
| | | | | | | | Accidentally checked in commented test code. Fail. >_<
* | Ensure disconnecting or reconnecting resets the transaction stateJon Leighton2012-09-155-9/+19
| |