Module: DataMapper::Migrations::PostgresAdapter::SQL
- Included in:
- DataMapper::Migrations::PostgresAdapter
- Defined in:
- lib/dm-core/migrations.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#postgres_version ⇒ Object
private
TODO: document.
-
#property_schema_hash(property) ⇒ Object
private
TODO: document.
-
#schema_name ⇒ Object
private
TODO: document.
-
#supports_drop_table_if_exists? ⇒ Boolean
private
TODO: document.
-
#without_notices ⇒ Object
private
TODO: document.
Instance Method Details
#postgres_version ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
TODO: document
622 623 624 |
# File 'lib/dm-core/migrations.rb', line 622 def postgres_version @postgres_version ||= query('SELECT version()').first.split[1].freeze end |
#property_schema_hash(property) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
TODO: document
640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 |
# File 'lib/dm-core/migrations.rb', line 640 def property_schema_hash(property) schema = super # Postgres does not support precision and scale for Float if property.primitive == Float schema.delete(:precision) schema.delete(:scale) end if property.primitive == Integer && property.min && property.max schema[:primitive] = integer_column_statement(property.min..property.max) end if schema[:serial] schema[:primitive] = serial_column_statement(property.min..property.max) end schema end |
#schema_name ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
TODO: document
616 617 618 |
# File 'lib/dm-core/migrations.rb', line 616 def schema_name @schema_name ||= query('SELECT current_schema()').first.freeze end |
#supports_drop_table_if_exists? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
TODO: document
610 611 612 |
# File 'lib/dm-core/migrations.rb', line 610 def supports_drop_table_if_exists? @supports_drop_table_if_exists ||= postgres_version >= '8.2' end |
#without_notices ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
TODO: document
628 629 630 631 632 633 634 635 636 |
# File 'lib/dm-core/migrations.rb', line 628 def without_notices # execute the block with NOTICE messages disabled begin execute('SET client_min_messages = warning') yield ensure execute('RESET client_min_messages') end end |