Module: SQL::Postgresql

Defined in:
lib/gems/dm-migrations-0.9.9/lib/sql/postgresql.rb

Defined Under Namespace

Classes: Column, Table

Instance Method Summary collapse

Instance Method Details

#property_schema_statement(schema) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/gems/dm-migrations-0.9.9/lib/sql/postgresql.rb', line 22

def property_schema_statement(schema)
  if supports_serial? && schema[:serial]
    statement = "#{schema[:quote_column_name]} serial PRIMARY KEY"
  else
    statement = super
    if schema.has_key?(:sequence_name)
      statement << " DEFAULT nextval('#{schema[:sequence_name]}') NOT NULL"
    end
    statement
  end
  statement
end

#recreate_databaseObject



12
13
14
15
16
# File 'lib/gems/dm-migrations-0.9.9/lib/sql/postgresql.rb', line 12

def recreate_database
  execute "DROP SCHEMA IF EXISTS test CASCADE"
  execute "CREATE SCHEMA test"
  execute "SET search_path TO test"
end

#supports_schema_transactions?Boolean

Returns:



4
5
6
# File 'lib/gems/dm-migrations-0.9.9/lib/sql/postgresql.rb', line 4

def supports_schema_transactions?
  true
end

#supports_serial?Boolean

Returns:



18
19
20
# File 'lib/gems/dm-migrations-0.9.9/lib/sql/postgresql.rb', line 18

def supports_serial?
  true
end

#table(table_name) ⇒ Object



8
9
10
# File 'lib/gems/dm-migrations-0.9.9/lib/sql/postgresql.rb', line 8

def table(table_name)
  SQL::Postgresql::Table.new(self, table_name)
end