Class | BigRecord::Migration |
In: |
lib/big_record/migration.rb
|
Parent: | Object |
Although column-oriented databases are generally schema-less, certain ones (like HBase) require the creation of tables and column families ahead of time. The individual columns, however, are defined in the model itself and can be modified dynamically without the need for migrations.
Unless you‘re familiar with column families, the majority of use cases work perfectly fine within one column family. When you generate a bigrecord_model, it will default to creating the :attribute column family.
The following is a standard migration file that creates a table called "Books" with the default column family :attribute that has the following option of 100 versions and uses the ‘lzo’ compression scheme. Leave any options blank for the default value.
class CreateBooks < BigRecord::Migration def self.up create_table :books, :force => true do |t| t.family :attribute, :versions => 100, :compression => 'lzo' end end def self.down drop_table :books end end
any column family. Changing this value on the creation will change this behavior.
column families can be stored using compression. The compression scheme you define here must be installed on the Hbase servers!
Run the following rake task to migrate your tables and column families up to the latest version:
rake bigrecord:migrate