Module: DataMapper::Migrations::PostgresAdapter::SQL
- Included in:
- DataMapper::Migrations::PostgresAdapter
- Defined in:
- lib/dm-migrations/adapters/dm-postgres-adapter.rb
Overview
:nodoc:
Instance Method Summary collapse
- #postgres_version ⇒ Object private
- #property_schema_hash(property) ⇒ Object private
- #schema_name ⇒ Object private
- #supports_drop_table_if_exists? ⇒ Boolean private
- #without_notices ⇒ Object private
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.
49 50 51 |
# File 'lib/dm-migrations/adapters/dm-postgres-adapter.rb', line 49 def postgres_version @postgres_version ||= select('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.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/dm-migrations/adapters/dm-postgres-adapter.rb', line 65 def property_schema_hash(property) schema = super primitive = property.primitive # Postgres does not support precision and scale for Float if primitive == Float schema.delete(:precision) schema.delete(:scale) end if property.kind_of?(Property::Integer) min = property.min max = property.max schema[:primitive] = integer_column_statement(min..max) if min && max end if schema[:serial] schema[:primitive] = serial_column_statement(min..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.
44 45 46 |
# File 'lib/dm-migrations/adapters/dm-postgres-adapter.rb', line 44 def schema_name @schema_name ||= select('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.
39 40 41 |
# File 'lib/dm-migrations/adapters/dm-postgres-adapter.rb', line 39 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.
54 55 56 57 58 59 60 61 62 |
# File 'lib/dm-migrations/adapters/dm-postgres-adapter.rb', line 54 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 |