aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md10
-rw-r--r--config/initializers/ar_innodb_row_format.rb16
-rw-r--r--db/schema.rb4
3 files changed, 27 insertions, 3 deletions
diff --git a/README.md b/README.md
index 853c8b6..eb56e56 100644
--- a/README.md
+++ b/README.md
@@ -11,6 +11,14 @@ A web service like Favstar.
## Requirements
* Ruby 1.9.3+
-* MySQL
+* MySQL 5.5.14+
+
+## Setup
+Add to my.cnf
+
+ [mysqld]
+ innodb_file_format = Barracuda
+ innodb_file_per_table = 1
+ innodb_large_prefix
diff --git a/config/initializers/ar_innodb_row_format.rb b/config/initializers/ar_innodb_row_format.rb
new file mode 100644
index 0000000..f6b88e1
--- /dev/null
+++ b/config/initializers/ar_innodb_row_format.rb
@@ -0,0 +1,16 @@
+# http://qiita.com/items/101aaf8159cf1470d823
+ActiveSupport.on_load :active_record do
+ module ActiveRecord::ConnectionAdapters
+
+ class AbstractMysqlAdapter
+ def create_table_with_innodb_row_format(table_name, options = {})
+ table_options = options.reverse_merge(:options => 'ENGINE=InnoDB ROW_FORMAT=DYNAMIC')
+ create_table_without_innodb_row_format(table_name, table_options) do |td|
+ yield td if block_given?
+ end
+ end
+ alias_method_chain :create_table, :innodb_row_format
+ end
+
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 1e35c00..9517459 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -36,7 +36,7 @@ ActiveRecord::Schema.define(version: 20130413042256) do
create_table "issues", force: true do |t|
t.integer "issue_type", limit: 2
t.integer "status", limit: 2
- t.text "data"
+ t.text "data", limit: 16777215
t.datetime "created_at"
t.datetime "updated_at"
end
@@ -81,6 +81,6 @@ ActiveRecord::Schema.define(version: 20130413042256) do
t.boolean "protected"
end
- add_index "users", ["screen_name"], name: "index_users_on_screen_name", length: {"screen_name"=>191}
+ add_index "users", ["screen_name"], name: "index_users_on_screen_name"
end