Sha256: 7b7d962a72d711ad80041f1013df742b69623758c0c4f5c8cc9f8fb447d6820c
Contents?: true
Size: 1.37 KB
Versions: 2
Compression:
Stored size: 1.37 KB
Contents
# Add database methods for the migration class module Volt class Migration def initialize(db=nil) @db ||= Volt.current_app.database.raw_db end def add_column(table_name, column_name, klasses, options={}) sequel_type, sequel_options = Helper.column_type_and_options_for_sequel(klasses, options) @db.alter_table(table_name) do add_column(column_name, sequel_type, sequel_options) end end def rename_column(table_name, from, to, options={}) # TODO: add options check @db.alter_table(table_name) do rename_column from, to end end def drop_column(table_name, column_name) @db.alter_table(table_name) do drop_column column_name end end def set_column_type(table_name, column_name, type, options={}) @db.alter_table(table_name) do set_column_type(column_name, type, options) end end def set_column_allow_null(table_name, column_name) @db.alter_table(table_name) do set_column_allow_null(column_name) end end def set_column_not_null(table_name, column_name) @db.alter_table(table_name) do set_column_not_null(column_name) end end def set_column_default(table_name, column_name, default) @db.alter_table(table_name) do set_column_default(column_name, default) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
volt-sql-0.0.3 | app/sql/lib/migration.rb |
volt-sql-0.0.2 | app/sql/lib/migration.rb |