Want more control over your database tables in DataMapper?
Overview
Plugin Name: dm-mysql
Summary: Plugin that allows MySQL DataMapper user the ability to specify MySQL table options when DataMapper creates database tables.
Requirements: Your DataMapper version must be > 0.9.10
Options: For available MySQL table options see the MySQL documentation. Note that this plugin was created against MySQL 5.1.
To Install: Make sure you have github listed as one of your sources.
sudo gem install neovintage-dm-mysql
Example
require 'dm-core'
require 'dm-mysql'
# Shows available options
class HasAllOption
include DataMapper::Resource
property :id, Serial
property :name, String
table_opts :engine => 'MyISAM',
:avg_row_length => 7,
:checksum => 1,
:comment => "Best Comment EVER!!",
:connection => 'another_connection',
:data_directory => '/dude/wheres/my/dictionary',
:delay_key_write => 0,
:index_directory => '/index/this',
:insert_method => 'FIRST',
:key_block_size => 256,
:max_rows => 5,
:min_rows => 0,
:pack_keys => 0,
:password => 'secret',
:row_format => 'COMPRESSED',
:tablespace => 'DUDE',
:union => 'has_its, not_includeds'
end
As always, I appreciate any feedback on the code or any features that you'd like to see implemented as part of this.
0 comments