Class: DbDiff::Delta::DropRow
Instance Attribute Summary
#element
Instance Method Summary
collapse
#initialize, #table, #to_a
Constructor Details
This class inherits a constructor from DbDiff::Delta
Instance Method Details
#process(database) ⇒ Object
140
141
142
143
|
# File 'lib/dbdiff/delta.rb', line 140
def process(database)
table = table(database)
table.rows.delete(element)
end
|
#sql ⇒ Object
134
135
136
137
138
|
# File 'lib/dbdiff/delta.rb', line 134
def sql
data = element.data
where = element.primary_key.map {|k| "#{k}=" + Mysql.escape_string(data[k]) }.join(" AND ")
return "DELETE FROM #{element.table_name} WHERE #{where}"
end
|