aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/schema_cache.rb
Commit message (Collapse)AuthorAgeFilesLines
* Refactor migration to move migrations paths to connectioneileencodes2018-01-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rails has some support for multiple databases but it can be hard to handle migrations with those. The easiest way to implement multiple databases is to contain migrations into their own folder ("db/migrate" for the primary db and "db/seconddb_migrate" for the second db). Without this you would need to write code that allowed you to switch connections in migrations. I can tell you from experience that is not a fun way to implement multiple databases. This refactoring is a pre-requisite for implementing other features related to parallel testing and improved handling for multiple databases. The refactoring here moves the class methods from the `Migrator` class into it's own new class `MigrationContext`. The goal was to move the `migrations_paths` method off of the `Migrator` class and onto the connection. This allows users to do the following in their `database.yml`: ``` development: adapter: mysql2 username: root password: development_seconddb: adapter: mysql2 username: root password: migrations_paths: "db/second_db_migrate" ``` Migrations for the `seconddb` can now be store in the `db/second_db_migrate` directory. Migrations for the primary database are stored in `db/migrate`". The refactoring here drastically reduces the internal API for migrations since we don't need to pass `migrations_paths` around to every single method. Additionally this change does not require any Rails applications to make changes unless they want to use the new public API. All of the class methods from the `Migrator` class were `nodoc`'d except for the `migrations_paths` and `migrations_path` getter/setters respectively.
* Use frozen-string-literal in ActiveRecordKir Shatrov2017-07-191-0/+2
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* `#tables` and `#table_exists?` and returns only tables and not viewsRafael Mendonça França2016-12-291-6/+0
|
* Use YAML to serialize schema cacheKir Shatrov2016-11-271-0/+16
|
* Add `Style/EmptyLines` in `.rubocop.yml` and remove extra empty linesRyuta Kamizono2016-08-071-1/+0
|
* modernizes hash syntax in activerecordXavier Noria2016-08-061-3/+3
|
* introduce `conn.data_source_exists?` and `conn.data_sources`.Yves Senn2015-09-221-22/+29
| | | | | | | | | | | | | | | | | 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)
* Apply schema cache dump when creating connectionsEugene Kenny2015-04-291-0/+8
| | | | | | | | | | | | | | | The `db:schema:cache:dump` rake task dumps the database schema structure to `db/schema_cache.dump`. If this file is present, the schema details are loaded into the currently checked out connection by a railtie while Rails is booting, to avoid having to query the database for its schema. The schema cache dump is only applied to the initial connection used to boot the application though; other connections from the same pool are created with an empty schema cache, and still have to load the structure of each table directly from the database. With this change, a copy of the schema cache is associated with the connection pool and applied to connections as they are created.
* Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-291-3/+1
|
* change to empty? from blank?tsukasaoishi2014-08-081-1/+1
|
* Tables existence check query is executed in large quantitiestsukasaoishi2014-08-071-0/+7
| | | | | | | | | | | | | | When Rails starts, tables existence check query is executed number of models. In case of mysql, SHOW TABLES LIKE 'table1'; SHOW TABLES LIKE 'table2'; SHOW TABLES LIKE 'table3'; ... SHOW TABLES LIKE 'table999'; Add process to get the names of all tables by one query.
* remove blank lines in the start of the ActiveRecord filesPonomarev Nikolay2014-07-291-1/+0
|
* Simplify the code in schema cacheSean Griffin2014-05-231-31/+11
| | | | | The use of default procs was unnessecary, made the code confusing to follow, and made marshalling needlessly complex.
* Removed unsued deprecation requireRashmi Yadav2013-07-041-1/+0
|
* Remove deprecated nil-passing to `SchemaCache` methods.Yves Senn2013-07-041-28/+8
|
* fix hash duping on 1.9Aaron Patterson2013-03-141-1/+1
|
* just access the ivars rather than rb_iv_getAaron Patterson2013-03-141-5/+3
|
* hide more data in the schema cacheAaron Patterson2013-03-141-1/+21
|
* safely publish columns and columns hash infoAaron Patterson2013-03-141-4/+12
|
* dup and set the default proc to nil rather than looping through everythingAaron Patterson2013-03-141-1/+3
|
* schema cache already has the columns as a hash, so use thatAaron Patterson2012-11-251-1/+11
|
* speed up fixture loading by querying the schema cache for column namesAaron Patterson2012-11-251-1/+10
|
* Support judgement expired schema cache dump.kennyj2012-03-011-3/+6
|
* Load db/schema_cache.dump duaring boot time.kennyj2012-03-011-1/+1
|
* Add db:schema:cache:dump and db:schema:cache:clear tasks.kennyj2012-03-011-0/+9
|
* Add support schema cache dump and load.kennyj2012-03-011-14/+34
|
* columns method doesn't have name argumentRafael Mendonça França2012-02-021-1/+1
|
* Should clear the primary keys cache alsoJon Leighton2011-12-161-0/+1
|
* Don't store defaults in the schema cacheJon Leighton2011-12-161-3/+2
|
* Defaults hash can go on the modelJon Leighton2011-12-161-14/+1
|
* Cache columns at the model level.Jon Leighton2011-12-161-9/+2
| | | | Allows two models to use the same table but have different primary keys.
* Use `table_exists?` from the schema cache.Aaron Patterson2011-12-091-4/+2
|
* pushing caching and visitors down to the connectionAaron Patterson2011-11-191-0/+72