Module: SQL::Mysql

Defined in:
lib/dm-migrations/sql/mysql.rb

Defined Under Namespace

Classes: Column, Table

Instance Method Summary collapse

Instance Method Details

#property_schema_statement(connection, schema) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/dm-migrations/sql/mysql.rb', line 28

def property_schema_statement(connection, schema)
  if supports_serial? && schema[:serial]
    statement = "#{schema[:quote_column_name]} SERIAL PRIMARY KEY"
  else
    super
  end
end

#recreate_databaseObject



14
15
16
17
18
# File 'lib/dm-migrations/sql/mysql.rb', line 14

def recreate_database
  execute "DROP DATABASE #{schema_name}"
  execute "CREATE DATABASE #{schema_name}"
  execute "USE #{schema_name}"
end

#supports_schema_transactions?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/dm-migrations/sql/mysql.rb', line 6

def supports_schema_transactions?
  false
end

#supports_serial?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/dm-migrations/sql/mysql.rb', line 20

def supports_serial?
  true
end

#table(table_name) ⇒ Object



10
11
12
# File 'lib/dm-migrations/sql/mysql.rb', line 10

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

#table_optionsObject



24
25
26
# File 'lib/dm-migrations/sql/mysql.rb', line 24

def table_options
  " ENGINE = InnoDB CHARACTER SET #{character_set} COLLATE #{collation}"
end