aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
Commit message (Collapse)AuthorAgeFilesLines
...
* 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.
* | PostgreSQL, adapter automatically reloads it's type map. Closes #14678.Yves Senn2014-04-111-3/+1
| | | | | | | | [Yves Senn & Matthew Draper]
* | PostgreSQL, Support for materialized views. [Dave Lee & Yves Senn]Dave Lee2014-04-021-4/+1
| | | | | | | | | | Expand the query used in #table_exists? to include materialized views in the kinds of relations it searches.
* | Postgres schema: Constrain sequence search classidJosh Williams2014-03-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | The pk_an_sequence_for query previously joined against pg_class's oid for rows in pg_depend, but pg_depend's objid may point to other system tables, such as pg_attrdef. If a row in one of those other tables coincidentally has the same oid as an (unrelated) sequence, that sequence name may be returned instead of the real one. This ensures that only the pg_depend entries pointing to pg_class are considered.
* | psql implementation of #index_name_exists?Jonathan Baudanza2014-01-161-0/+13
| |
* | make the type_map per connection. fixes #13182Aaron Patterson2013-12-041-1/+1
| |
* | Merge pull request #10664 from aderyabin/docpatchYves Senn2013-10-291-1/+1
|\ \ | |/ |/| Fix doc in Postgres database creation [ci skip]
| * Fix doc in Postgres database creationAndrey Deryabin2013-06-251-1/+1
| |
* | `change_column` for PG adapter respects `:array` option.Yves Senn2013-07-161-2/+3
|/
* Reject blank order_values within #columns_for_distinct, as the orders aren't ↵Ben Woosley2013-05-101-1/+1
| | | | used at all on non-postgres adapters.
* Fix that #exists? can produce invalid SQL: "SELECT DISTINCT DISTINCT"Ben Woosley2013-05-101-7/+2
| | | | | | | | | | | | The combination of a :uniq => true association and the #distinct call in #construct_limited_ids_condition combine to create invalid SQL, because we're explicitly selecting DISTINCT, and also sending #distinct on to AREL, via the relation#distinct_value. Rather than build a select distinct clause in #construct_limited_ids_condition, I set #distinct! and pass just the columns into the select statement. This requires introducing a #columns_for_distinct method to return the select columns but not the statement itself.
* Make SchemaDumper emit "id: :uuid" when appropriate. Fixes #10451.Brian Buchanan2013-05-031-1/+2
|
* Do not calculate values if they are not going to be usedCarlos Antonio da Silva2013-03-301-7/+9
| | | | | | | | | When building the indexes list in PostgreSQL, IndexDefinition objects are only created if the query for the related attributes really returns something matching the attributes. In case it does not, the variables for building the definition objects were being created but not used.
* Add support for FULLTEXT and SPATIAL indexes using the :type flag for MySQL.Ken Mazaika2013-03-271-2/+2
|
* Adds support for concurrent indexing in PostgreSQL adapterDan McClain2013-03-251-6/+2
| | | | | | | | Adds support for algorithm option in MySQL indexes Moves USING and algorithm options upstream The syntax is still specific to the Adapter, so the actual executed string happens in the corresponding adapter