Module: SQL::Mysql

### Home Classes Methods

### In Files

- lib/dm-migrations/sql/mysql.rb

### Namespace

- CLASS SQL::Mysql::Column
- CLASS SQL::Mysql::Table

### Methods

- #change_column_type_statement
- #property_schema_statement
- #recreate_database
- #supports_schema_transactions?
- #supports_serial?
- #table
- #table_options

### Files

- LICENSE
- README.rdoc

### Class/Module Index

Quicksearch

- DataMapper
- DataMapper::Adapters
- DataMapper::Migration
- DataMapper::MigrationRunner
- DataMapper::Migrations
- DataMapper::Migrations::DataObjectsAdapter
- DataMapper::Migrations::DataObjectsAdapter::ClassMethods
- DataMapper::Migrations::DuplicateMigration
- DataMapper::Migrations::Model
- DataMapper::Migrations::MysqlAdapter
- DataMapper::Migrations::MysqlAdapter::ClassMethods
- DataMapper::Migrations::OracleAdapter
- DataMapper::Migrations::OracleAdapter::ClassMethods
- DataMapper::Migrations::PostgresAdapter
- DataMapper::Migrations::PostgresAdapter::ClassMethods
- DataMapper::Migrations::Repository
- DataMapper::Migrations::SingletonMethods
- DataMapper::Migrations::SqliteAdapter
- DataMapper::Migrations::SqliteAdapter::ClassMethods
- DataMapper::Migrations::SqlserverAdapter
- DataMapper::Migrations::SqlserverAdapter::ClassMethods
- DataMapper::Migrations::YamlAdapter
- SQL
- SQL::Column
- SQL::Mysql
- SQL::Mysql::Column
- SQL::Mysql::Table
- SQL::Postgres
- SQL::Postgres::Column
- SQL::Postgres::Table
- SQL::Sqlite
- SQL::Sqlite::Column
- SQL::Sqlite::Table
- SQL::Table
- SQL::TableCreator
- SQL::TableCreator::Column
- SQL::TableCreator::SqlExpr
- SQL::TableModifier
- Spec
- Spec::Example
- Spec::Example::MigrationExampleGroup
- Spec::Matchers
- Spec::Matchers::Migration
- Spec::Matchers::Migration::HaveColumnMatcher
- Spec::Matchers::Migration::HaveTableMatcher
- Spec::Matchers::Migration::NullableColumnMatcher
- Spec::Matchers::Migration::PrimaryKeyMatcher
- Object

No matching classes.

# SQL::Mysql

### Public Instance Methods

change_column_type_statement(name, column) click to toggle source

    # File lib/dm-migrations/sql/mysql.rb, line 40
    def change_column_type_statement(name, column)
      "ALTER TABLE #{quote_name(name)} MODIFY COLUMN #{column.to_sql}"
    end

property_schema_statement(connection, schema) click to toggle source

    # File lib/dm-migrations/sql/mysql.rb, line 32
    def property_schema_statement(connection, schema)
      if supports_serial? && schema[:serial]
        statement = "#{schema[:quote_column_name]} SERIAL PRIMARY KEY"
      else
        super
      end
    end

recreate_database() click to toggle source

    # 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?() click to toggle source

    # File lib/dm-migrations/sql/mysql.rb, line 6
    def supports_schema_transactions?
      false
    end

supports_serial?() click to toggle source

    # File lib/dm-migrations/sql/mysql.rb, line 20
    def supports_serial?
      true
    end

table(table_name) click to toggle source

    # File lib/dm-migrations/sql/mysql.rb, line 10
    def table(table_name)
      SQL::Mysql::Table.new(self, table_name)
    end

table_options(opts) click to toggle source

    # File lib/dm-migrations/sql/mysql.rb, line 24
    def table_options(opts)
      opt_engine    = opts[:storage_engine] || storage_engine
      opt_char_set  = opts[:character_set] || character_set
      opt_collation = opts[:collation] || collation

      " ENGINE = #{opt_engine} CHARACTER SET #{opt_char_set} COLLATE #{opt_collation}"
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.