lib/baza/column.rb in baza-0.0.20 vs lib/baza/column.rb in baza-0.0.21
- old
+ new
@@ -10,6 +10,32 @@
end
def to_param
name
end
+
+ def table
+ @db.tables[table_name]
+ end
+
+ def after
+ last = nil
+ table.columns.each do |column|
+ break if column.name == name
+ last = column.name
+ end
+
+ last
+ end
+
+ def data
+ {
+ type: type,
+ name: name,
+ null: null?,
+ maxlength: maxlength,
+ default: default,
+ primarykey: primarykey?,
+ autoincr: autoincr?
+ }
+ end
end