From 2ddd810dea41de3b23dca6705d086e52481ebe54 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Sat, 22 Jan 2011 12:25:08 +0100 Subject: [PATCH] db: Fixed the migration of the database. The limit down to 127 is needed cause of a long time bug in mysql. The error message looks like this when creating an index. Mysql2::Error: Specified key was too long; max key length is 1000 bytes So with utf8 (3 bytes for one char) you exceed this with two varchar(255). See http://bugs.mysql.com/bug.php?id=4541 --- db/migrate/0000_create_schema.rb | 4 ++-- db/migrate/20110105051803_create_import_tables.rb | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/db/migrate/0000_create_schema.rb b/db/migrate/0000_create_schema.rb index 65a14130a..ff1469b6e 100644 --- a/db/migrate/0000_create_schema.rb +++ b/db/migrate/0000_create_schema.rb @@ -105,8 +105,8 @@ class CreateSchema < ActiveRecord::Migration create_table :profiles do |t| t.string :diaspora_handle - t.string :first_name - t.string :last_name + t.string :first_name, :limit => 127 + t.string :last_name, :limit => 127 t.string :image_url t.string :image_url_small t.string :image_url_medium diff --git a/db/migrate/20110105051803_create_import_tables.rb b/db/migrate/20110105051803_create_import_tables.rb index c3f374e2a..cb936b920 100644 --- a/db/migrate/20110105051803_create_import_tables.rb +++ b/db/migrate/20110105051803_create_import_tables.rb @@ -95,8 +95,8 @@ class CreateImportTables < ActiveRecord::Migration add_index :mongo_invitations, :sender_mongo_id create_table :mongo_notifications do |t| t.string :mongo_id - t.string :target_type - t.string :target_mongo_id + t.string :target_type, :limit => 127 + t.string :target_mongo_id, :limit => 127 t.string :recipient_mongo_id t.string :actor_mongo_id t.string :action @@ -114,8 +114,8 @@ class CreateImportTables < ActiveRecord::Migration create_table :mongo_profiles do |t| t.string :diaspora_handle - t.string :first_name - t.string :last_name + t.string :first_name, :limit => 127 + t.string :last_name, :limit => 127 t.string :image_url t.string :image_url_small t.string :image_url_medium @@ -134,8 +134,8 @@ class CreateImportTables < ActiveRecord::Migration create_table :mongo_requests do |t| t.string :mongo_id - t.string :sender_mongo_id - t.string :recipient_mongo_id + t.string :sender_mongo_id, :limit => 127 + t.string :recipient_mongo_id, :limit => 127 t.string :aspect_mongo_id t.timestamps end