aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
Commit message (Collapse)AuthorAgeFilesLines
...
* Add an `:if_exists` option to `drop_table`Stefan Kanev2015-01-191-1/+1
| | | | | | | | | | | If set to `if_exists: true`, it generates a statement like: DROP TABLE IF EXISTS posts This syntax is supported in the popular SQL servers, that is (at least) SQLite, PostgreSQL, MySQL, Oracle and MS SQL Sever. Closes #16366.
* Extract the index length validation to a auxiliar methodRafael Mendonça França2014-12-301-3/+2
|
* Ensures that primary_key method will return nil when multi-pkArthur Neves2014-12-301-4/+4
| | | | | | | When table has a composite primary key, the `primary_key` method for sqlite3 and postgresql was only returning the first field of the key. Ensures that it will return nil instead, as AR dont support composite pks.
* Support for any type primary key.Ryuta Kamizono2014-12-281-9/+0
|
* `force: :cascade` to recreate tables referenced by foreign-keys.Yves Senn2014-12-191-0/+4
|
* Merge pull request #17799 from kamipo/refactor_add_column_optionsRafael Mendonça França2014-11-281-4/+12
|\ | | | | Refactor `add_column_options!`, to move the quoting of default value for :uuid in `quote_value`.
| * Rename to `quote_default_expression` from `quote_value`Ryuta Kamizono2014-11-281-1/+1
| |
| * Refactor `add_column_options!`, to move the quoting of default value for ↵Ryuta Kamizono2014-11-281-4/+12
| | | | | | | | :uuid in `quote_value`.
* | Refactor `SchemaCreation#visit_AddColumn`Ryuta Kamizono2014-11-271-6/+0
|/
* allow types to be passed in for USING castsAaron Patterson2014-11-241-0/+3
| | | | | | | This allows us so abstract the migration from the type that is actually used by Rails. For example, ":string" may be a varchar or something, but the framework does that translation, and the app shouldn't need to know.
* allow the "USING" statement to be specified on change column callsAaron Patterson2014-11-241-1/+3
|
* Rename the primary key index when renaming a table in pgSean Griffin2014-11-221-0/+3
| | | | | | | | Also checked to make sure this does not affect foreign key constraints. (It doesn't). Fixes #12856 Closes #14088
* raise a better exception for renaming long indexesAaron Patterson2014-11-201-0/+3
|
* remove unused and untested APIAaron Patterson2014-10-311-6/+2
|
* fix set_pk_sequence and add a test for it.Aaron Patterson2014-10-311-1/+1
|
* Added region sequencing of primary keys for Postgres.Joe Rafaniello2014-10-311-0/+21
| | | | | | | Skip setting sequence on a table create if the value is 0 since it will start the first value at 1 anyway. This fixes the PG error 'setval: value 0 is out of bounds for sequence vms_id_seq...' encountered when migrating a new DB. BugzID: 15452,9772,13475,16850
* Use #inject over #sum to build PG create DB statementGeoff Harcourt2014-09-171-2/+2
| | | | | | | | | | | | While investigating #16951 I found that another library's monkey-patching of `Enumerable` was causing the test migrations helper to break when trying to build the `CREATE DATABASE` statement. The prior approach used `#sum` to build the string from the options hash. As the code that combines the options to build the database statement is not user-facing, using `#inject` here instead will remove the only place where the database creation/migration code is dependent on ActiveSupport's monkey-patching of `Enumerable`.
* pg, correctly dump foreign keys targeting tables in a different schema.Yves Senn2014-09-171-1/+2
| | | | | | Closes #16907. [Matthew Draper & Yves Senn]
* pg, `default_sequence_name` needs to return a string.Yves Senn2014-08-251-2/+2
| | | | | | | | | This is a reacon to https://github.com/rails/rails/commit/d6c1205584b1ba597db4071b168681678b1e9875#commitcomment-7502487 This backwards incompatibility was introduced with d6c12055 to fix #7516. However both `connection.default_sequence_name` and `model.sequence_name` are public API. The PostgreSQL adapter should honor the interface and return strings. /cc @matthewd @chancancode
* CHANGELOG & improvements to #16649Godfrey Chan2014-08-231-2/+2
| | | | | * Require either FIRST or LAST qualifier for "NULLS ..." * Require whitespace before "NULLS ..."
* Don't trim excess whitespace in pg #columns_for_distinctAgis-2014-08-241-1/+2
| | | | Fixes #16623 introduced by https://github.com/rails/rails/commit/3d5a2019bcccc6fb01bee4811ca669f4383edb51
* pg, `change_column_default, :table, :column, nil` issues `DROP DEFAULT`.Yves Senn2014-07-241-1/+9
| | | | | | | | | | | | Closes #16261. [Matthew Draper, Yves Senn] Using `DEFAULT NULL` results in the same behavior as `DROP DEFAULT`. However, PostgreSQL will cast the default to the columns type, which leaves us with a default like "default NULL::character varying". /cc @matthewd
* Always pass a column with a type object to quoteSean Griffin2014-06-281-0/+8
| | | | | | | | The only case where we got a column that was not `nil`, but did not respond to `cast_type` was when type casting the default value during schema creation. We can look up the cast type, and add that object to the column definition. Will allow us to consistently rely on the type objects for type casting in all directions.
* rename sequence only if it existsAbdelkader Boudih2014-06-271-3/+3
|
* fk: review corrections: indent, visibility, syntax, wording.Yves Senn2014-06-261-12/+12
|
* fk: support for on_updateYves Senn2014-06-261-7/+12
|
* fk: rename `dependent` to `on_delete`Yves Senn2014-06-261-2/+2
|
* fk: support dependent option (:delete, :nullify and :restrict).Yves Senn2014-06-261-1/+8
|
* fk: generalize using `AlterTable` and `SchemaCreation`.Yves Senn2014-06-261-20/+0
|
* fk: `foreign_keys`, `add_foreign_key` and `remove_foreign_key` for MySQLYves Senn2014-06-261-7/+0
|
* fk: add `foreign_keys` for PostgreSQL adapter.Yves Senn2014-06-261-0/+24
|
* fk: `add_foreign_key` and `remove_foreign_key` for PostgreSQL adapter.Yves Senn2014-06-261-0/+27
|
* pg, support default values for enum types. Closes #7814.Yves Senn2014-05-301-1/+1
| | | | | This is an intermediate solution. It is related to the refactoring @sgrif is making and will change in the future.
* pg, `default_sequence_name` respects schema. Closes #7516.Yves Senn2014-05-301-2/+2
|
* Merge pull request #11896 from nkondratyev/fix_pg_columns_for_distinctYves Senn2014-05-301-1/+1
|\ | | | | | | | | | | | | Fixed #columns_for_distinct of postgresql adapter Conflicts: activerecord/CHANGELOG.md
| * Fixed `columns_for_distinct` of postgresql adapterNikolay Kondratyev2013-08-151-1/+1
| |
* | pg, `reset_pk_sequence!` respects schemas. Closes #14719.Yves Senn2014-05-301-5/+13
| |
* | pg, `PostgreSQL::Name` to hold schema qualified names.Yves Senn2014-05-301-4/+4
| |
* | Ensure we always use instances of the adapter specific column classSean Griffin2014-05-281-1/+5
| | | | | | | | | | | | - Create a consistent API across adapters for building new columns - Use it for custom properties so we don't get `UndefinedMethodError`s in stuff I'm implementing elsewhere.
* | remove unwanted `to_sym` call.Kuldeep Aggarwal2014-05-261-1/+1
| |
* | Move parsing of PG sql strings for defaults out of columnSean Griffin2014-05-231-1/+3
| |
* | Allow additional arguments to be used during type map lookupsSean Griffin2014-05-221-1/+1
| | | | | | | | | | | | | | | | Determining things like precision and scale in postgresql will require the given blocks to take additional arguments besides the OID. - Adds the ability to handle additional arguments to `TypeMap` - Passes the column type to blocks when looking up PG types
* | pg, re-introduce `PostgreSQL::Utils` to unify schema/table extraction.Yves Senn2014-05-191-18/+1
| | | | | | | | Partial revert of c0bfc3f412834ffe8327a15ae3a46602cc28e425
* | :scissors:Rafael Mendonça França2014-05-141-1/+0
| |
* | PostgreSQLAdapter::Utils seems to be only used from a single spot - quite ↵kares2014-05-141-1/+19
| | | | | | | | redundant
* | PostgreSQL's SchemaStatements seems a could candidate for re-use (with AR-JDBC)kares2014-05-141-6/+2
| |
* | pg, `change_column_default` accepts `[]`. Closes #11586.Yves Senn2014-05-121-0/+1
| |
* | Handle other pk types in PostgreSQL gracefully.Patrick Robertson2014-05-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In #10410 it was noted that you can no longer create PK's with the type of bigserial in PostgreSQL in 4.0.0.rc1. This is mostly because the newer adapter is checking for column type with the id column instead of just letting it pass through like it did before. Side effects: You may just create a PK column of a type that you really don't want to be your PK. As far as I can tell this was allowed in 3.2.X and perhaps an exception should be raised if you try and do something extremely dumb.
* | refactor, move `column_for` to `AbstractAdapter` for better reuse.Yves Senn2014-05-041-4/+0
| |
* | Changed change_column in PG schema_statements.rb to make sure that the ↵Eric Chahin2014-04-151-2/+8
| | | | | | | | uuid_generate function was not being quoted.