Parent

SQL::TableCreator

Attributes

table_name[RW]
opts[RW]

Public Class Methods

new(adapter, table_name, opts = {}, &block) click to toggle source
    # File lib/dm-migrations/sql/table_creator.rb, line 10
10:     def initialize(adapter, table_name, opts = {}, &block)
11:       @adapter = adapter
12:       @table_name = table_name.to_s
13:       @opts = opts
14: 
15:       @columns = []
16: 
17:       self.instance_eval &block
18:     end

Public Instance Methods

column(name, type, opts = {}) click to toggle source
    # File lib/dm-migrations/sql/table_creator.rb, line 24
24:     def column(name, type, opts = {})
25:       @columns << Column.new(@adapter, name, type, opts)
26:     end
now() click to toggle source

A helper for using the native NOW() SQL function in a default

    # File lib/dm-migrations/sql/table_creator.rb, line 33
33:     def now
34:       SqlExpr.new('NOW()')
35:     end
quoted_table_name() click to toggle source
    # File lib/dm-migrations/sql/table_creator.rb, line 20
20:     def quoted_table_name
21:       @adapter.send(:quote_name, table_name)
22:     end
to_sql() click to toggle source
    # File lib/dm-migrations/sql/table_creator.rb, line 28
28:     def to_sql
29:       "CREATE TABLE #{quoted_table_name} (#{@columns.map{ |c| c.to_sql }.join(', ')})#{@adapter.table_options(@opts)}"
30:     end
uuid() click to toggle source

A helper for using the native UUID() SQL function in a default

    # File lib/dm-migrations/sql/table_creator.rb, line 38
38:     def uuid
39:       SqlExpr.new('UUID()')
40:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.