Module: Skr::Core::DB::CommandRecorder

Defined in:
lib/skr/core/db/migration_helpers.rb

Instance Method Summary collapse

Instance Method Details

#create_skr_table(*args) ⇒ Object



126
127
128
# File 'lib/skr/core/db/migration_helpers.rb', line 126

def create_skr_table(*args)
    record(:create_skr_table, args)
end

#drop_skr_table(*args) ⇒ Object



130
131
132
# File 'lib/skr/core/db/migration_helpers.rb', line 130

def drop_skr_table(*args)
    record(:drop_skr_table, args)
end

#invert_create_skr_table(args) ⇒ Object



134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/skr/core/db/migration_helpers.rb', line 134

def invert_create_skr_table(args)
    from_table, to_table, add_options = *args
    add_options ||= {}
    if add_options[:name]
        options = {name: add_options[:name]}
    elsif add_options[:column]
        options = {column: add_options[:column]}
    else
        options = to_table
    end
    [:drop_skr_table, [from_table, options]]
end

#invert_skr_add_index(args) ⇒ Object



150
151
152
153
# File 'lib/skr/core/db/migration_helpers.rb', line 150

def invert_skr_add_index(args)
    table, column = *args
    [:remove_skr_index, [table, column]]
end

#skr_add_index(*args) ⇒ Object



147
148
149
# File 'lib/skr/core/db/migration_helpers.rb', line 147

def skr_add_index(*args)
    record(:skr_add_index,args)
end