module SQL::Postgres

Public Instance Methods

change_column_type_statement(name, column) click to toggle source
# File lib/dm-migrations/sql/postgres.rb, line 39
def change_column_type_statement(name, column)
  "ALTER TABLE #{quote_name(name)} ALTER COLUMN #{column.to_sql}"
end
property_schema_statement(connection, schema) click to toggle source
Calls superclass method
# File lib/dm-migrations/sql/postgres.rb, line 22
def property_schema_statement(connection, 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_database() click to toggle source
# File lib/dm-migrations/sql/postgres.rb, line 12
def recreate_database
  execute 'DROP SCHEMA IF EXISTS test CASCADE'
  execute 'CREATE SCHEMA test'
  execute 'SET search_path TO test'
end
rename_column_type_statement(table_name, old_col, new_col) click to toggle source
# File lib/dm-migrations/sql/postgres.rb, line 43
def rename_column_type_statement(table_name, old_col, new_col)
  "ALTER TABLE #{quote_name(table_name)} RENAME COLUMN #{quote_name(old_col)} TO #{quote_name(new_col)}"
end
supports_schema_transactions?() click to toggle source
# File lib/dm-migrations/sql/postgres.rb, line 4
def supports_schema_transactions?
  true
end
supports_serial?() click to toggle source
# File lib/dm-migrations/sql/postgres.rb, line 18
def supports_serial?
  true
end
table(table_name) click to toggle source
# File lib/dm-migrations/sql/postgres.rb, line 8
def table(table_name)
  SQL::Postgres::Table.new(self, table_name)
end
table_options(opts) click to toggle source
# File lib/dm-migrations/sql/postgres.rb, line 35
def table_options(opts)
  ''
end