aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
Commit message (Collapse)AuthorAgeFilesLines
...
* | Ignore index name in `index_exists?` when not passed a name to check forGrey Baker2015-12-151-2/+1
|/
* Merge pull request #22214 from ↵Rafael França2015-11-241-1/+1
|\ | | | | | | | | kamipo/not_passing_native_database_types_to_table_definition Not passing `native_database_types` to `TableDefinition`
| * Not passing `native_database_types` to `TableDefinition`Ryuta Kamizono2015-11-081-1/+1
| | | | | | | | | | | | The `native_database_types` only used in `TableDefinition` for look up the default `:limit` option. But this is duplicated process with `type_to_sql`. Passing `native_database_types` is not needed.
* | Deprecate `#table_exists?`, `#tables` and passing arguments to `#talbes`yui-knk2015-11-091-2/+2
|/ | | | | | | | | | Reported on #21509, how views is treated by `#tables` are differ by each adapters. To fix this different behavior, after Rails 5.0 is released, deprecate `#tables`. And `#table_exists?` would check both tables and views. To make their behavior consistent with `#tables`, after Rails 5.0 is released, deprecate `#table_exists?`.
* move documentation of column options to `add_column`. Closes #20400.Yves Senn2015-10-211-6/+75
| | | | | | | | | | | | [ci skip] It's been a source of confusion that the lower-level `add_column` referenced the higher level `column` method for available options. `column` supports additional functionality like `index: true` that is not present on `add_column`. This patch moves common option documentation to `add_column` and only documents the additional options in `column`.
* applies new doc guidelines to Active Record.Yves Senn2015-10-141-10/+11
| | | | | | | | | | | | | | | | | | | The focus of this change is to make the API more accessible. References to method and classes should be linked to make it easy to navigate around. This patch makes exzessiv use of `rdoc-ref:` to provide more readable docs. This makes it possible to document `ActiveRecord::Base#save` even though the method is within a separate module `ActiveRecord::Persistence`. The goal here is to bring the API closer to the actual code that you would write. This commit only deals with Active Record. The other gems will be updated accordingly but in different commits. The pass through Active Record is not completely finished yet. A follow up commit will change the spots I haven't yet had the time to update. /cc @fxn
* `:to_table` when adding a fk through `add_reference`.Yves Senn2015-10-131-0/+4
| | | | | | | | | | | | Closes #21563. The `name` argument of `add_references` was both used to generate the column name `<name>_id` and as the target table for the foreign key `name.pluralize`. It's primary purpose is to define the column name. In cases where the `to_table` of the foreign key is different than the column name we should be able to specify it individually.
* Merge pull request #21005 from jaredbeck/patch-1Arthur Nogueira Neves2015-10-041-1/+3
|\ | | | | Docs: Update options for add_reference
| * Docs: Update options for add_referenceJared Beck2015-07-231-1/+3
| | | | | | [ci skip]
* | Fix proper fonts in `change_column_null` method docs. [ci skip]amitkumarsuroliya2015-09-271-2/+2
| |
* | introduce `conn.data_source_exists?` and `conn.data_sources`.Yves Senn2015-09-221-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* | Merge pull request #21693 from joshuapinter/patch-1Jeremy Daer2015-09-201-0/+2
|\ \ | | | | | | Add title for key lengths for multiple keys.
| * | Add title for key lengths for multiple keys.Joshua Pinter2015-09-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Previously there was no separator between the two code examples so it looked like: ```ruby CREATE INDEX by_name ON accounts(name(10)) add_index(:accounts, [:name, :surname], name: 'by_name_surname', length: {name: 10, surname: 15}) ```
* | | Support for foreign keys in create tableRyuta Kamizono2015-09-201-13/+8
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If foreign keys specified in create table, generated SQL is slightly more efficient. Definition: ``` create_table :testings do |t| t.references :testing_parent, foreign_key: true end ``` Before: ``` CREATE TABLE "testings" ("id" serial primary key, "testing_parent_id" integer); ALTER TABLE "testings" ADD CONSTRAINT "fk_rails_a196c353b2" FOREIGN KEY ("testing_parent_id") REFERENCES "testing_parents" ("id"); ``` After: ``` CREATE TABLE "testings" ("id" serial primary key, "testing_parent_id" integer, CONSTRAINT "fk_rails_a196c353b2" FOREIGN KEY ("testing_parent_id") REFERENCES "testing_parents" ("id")); ```
* | Merge pull request #21609 from kamipo/do_not_dump_view_as_tableJeremy Daer2015-09-191-0/+13
|\ \ | | | | | | | | | Do not dump a view as a table in sqlite3, mysql and mysql2 adapters
| * | Add `#views` and `#view_exists?` methods on connection adaptersRyuta Kamizono2015-09-131-0/+13
| | |
* | | Merge pull request #21607 from kamipo/remove_unnecessary_display_widthJeremy Daer2015-09-191-3/+3
|\ \ \ | | | | | | | | Remove unnecessary display width
| * | | Remove unnecessary display widthRyuta Kamizono2015-09-161-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The **(11)** does not affect the storage size of the data type, which for an INT will always be 4 bytes. It affects the **display width**. http://www.tocker.ca/2015/07/02/proposal-to-deprecate-mysql-integer-display-width-and-zerofill.html
* | | | Merge pull request #21608 from ↵Jeremy Daer2015-09-191-4/+4
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | kamipo/eliminate_duplicated_options_include_default_method Eliminate the duplicated `options_include_default?` method
| * | | | Eliminate the duplicated `options_include_default?` methodRyuta Kamizono2015-09-131-4/+4
| | |/ / | |/| | | | | | | | | | Follow up 7ba2cd06.
* | | | Correctly dump composite primary keyRyuta Kamizono2015-09-201-1/+11
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | Example: create_table :barcodes, primary_key: ["region", "code"] do |t| t.string :region t.integer :code end
* | | [ci skip] Remove `DEFAULT NULL` from examplesYasuo Honda2015-09-161-2/+2
|/ /
* | Don't set the default argumentRafael Mendonça França2015-09-091-1/+1
| | | | | | | | It is always passed in
* | Merge pull request #21548 from yui-knk/feature/define_tables_as_interfaceYves Senn2015-09-081-0/+5
|\ \ | | | | | | | | | Define `SchemaStatements#tables` as interface
| * | Define `SchemaStatements#tables` as interfaceyui-knk2015-09-081-0/+6
|/ / | | | | | | | | | | | | | | | | These 3 methods expect `ConnectionAdapters` to have `tables` method, so make it clear that `tables` method is interface. * `ConnectionAdapters::SchemaCache#prepare_tables` * `db:schema:cache:dump` task * `SchemaDumper#tables`
* / Support dropping indexes concurrently in PostgresGrey Baker2015-09-051-4/+1
|/ | | | | See http://www.postgresql.org/docs/9.4/static/sql-dropindex.html for more details.
* Fixes documentation typo.Дмитро Будник2015-07-231-2/+2
| | | Documentation had extra colon after keyword.
* Merge pull request #20699 from ↵Rafael Mendonça França2015-06-271-1/+4
|\ | | | | | | | | vngrs/foreign_key_with_table_name_suffix_and_prefix Add table name prefix and suffix support for foreign keys
| * Add table name prefix and suffix support to add_foreign_key and ↵Mehmet Emin İNAÇ2015-06-251-1/+4
| | | | | | | | | | | | remove_foreign_key methods fix tests
* | Add reversible syntax for change_column_defaultPrem Sichanugrist2015-06-261-1/+14
|/ | | | | | | | | | | | | Passing `:from` and `:to` to `change_column_default` makes this command reversible as user has defined its previous state. So, instead of having the migration command as: change_column_default(:posts, :state, "draft") They can write it as: change_column_default(:posts, :state, from: nil, to: "draft")
* make `remove_index :table, :column` reversible.Yves Senn2015-06-151-1/+1
| | | | | | | | | This used to raise a `IrreversibleMigration` error (since #10437). However since `remove_index :table, :column` is probably the most basic use-case we should make it reversible again. Conflicts: activerecord/CHANGELOG.md
* Merge pull request #20226 from EpicH0liday/reversible-remove-foreign-keyYves Senn2015-06-121-1/+5
|\ | | | | | | | | | | | | Make remove_foreign_key reversible Conflicts: activerecord/CHANGELOG.md
| * Add an invert method for remove_foreign_keyAster Ryan2015-06-111-1/+6
|/
* A few documentation tweaks [ci skip]Robin Dupret2015-06-071-1/+1
| | | | [Robin Dupret & Shunsuke Aida]
* better `add_reference` documentation. [ci skip]Yves Senn2015-05-181-7/+13
| | | | | | | | | This patch - reduces the duplication among the `reference`-family methods. - better explains all the optians available for `add_reference`. - redirects to user from `references` to `add_reference`. Originated by #20184.
* More exercise the create index sql testsRyuta Kamizono2015-05-041-2/+2
|
* Correctly dump `:options` on `create_table` for MySQLRyuta Kamizono2015-05-031-0/+4
|
* Nodoc validate_index_length! methodPrathamesh Sonpatki2015-04-301-1/+1
| | | | - This method is used only by adapters to validate length of new index names.
* use a more descriptive example. [ci skip]Yves Senn2015-04-241-6/+4
| | | | follow up to 107526e809ea2b6de8b2775ecf83e55d60833206
* docs for `create_table` and non-int primary keys. [ci skip]Yves Senn2015-04-241-0/+17
|
* Document that partial indexes are only supported by Postgres and SQLite.Grey Baker2015-04-131-0/+2
| | | | Fixes #18106
* Add a note regarding add_column restricted API [ci skip]Zachary Scott2015-04-121-0/+4
| | | | | | We should document current behavior, and this is design of API for now. Closes #17597
* fix documentation for SchemaStatements#add_foreign_keySimon Stemplinger2015-04-081-2/+2
| | | | | | The implementation of the generation of the foreign key name was changed between Rails 4.2.0 and 4.2.1 from a random to a deterministic behavior, however the documentation still describes the old randomized behavior.
* No need to document drop_table in the PostgreSQLAdapterRafael Mendonça França2015-04-061-0/+3
| | | | | | It behaves in the same way that the abstract adapter. [ci skip]
* use singular table name if pluralize_table_names is setted as false while ↵Mehmet Emin İNAÇ2015-04-061-1/+4
| | | | | | | | | | | | | | creating foreign key test case for use singular table name if pluralize_table_names is setted as false while creating foreign key refactor references foreign key addition tests use singular table name while removing foreign key merge foreign key singular table name methods remove unnecessary drop table from test
* [ci skip] Remove unacceptable method nameyui-knk2015-03-241-1/+1
|
* Tiny documentation edits [ci skip]Robin Dupret2015-02-241-1/+1
|
* Allow `:precision` option for time type columnsRyuta Kamizono2015-02-201-0/+6
|
* Revert "Allow `:precision` option for time type columns"Sean Griffin2015-02-171-6/+0
| | | | | | | | | | This reverts commit 1502caefd30b137fd1a0865be34c5bbf85ba64c1. The test suite for the mysql adapter broke when this commit was used with MySQL 5.6. Conflicts: activerecord/CHANGELOG.md
* Merge pull request #18662 from estum/foreign-key-existsYves Senn2015-02-161-15/+26
|\ | | | | | | Add `foreign_key_exists?` method.