Closed awd closed 12 years ago
In Ruby 1.9 Hash maintains order. In 1.8 Hash order is unspecified.
I'm having the same problem. Is it possible to apply this patch and make a new release ?
Thank you so much for this great tool.
In fact I still have an issue, even after using @colin's fork
Here is the log from my migration :
→ rake db:migrate
Using AdapterExtensions
== OptimizePricesForTaxesAndBreakfast: migrating =============================
-- last inserted id in prices: 37965742
-- execute("drop table if exists lhmn_prices")
-- execute("show create table prices")
-- execute("CREATE TABLE `lhmn_prices` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `broker_location_id` bigint(20) DEFAULT NULL,\n `broker_location_type` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,\n `location_id` int(11) DEFAULT NULL,\n `search_id` varchar(24) COLLATE utf8_unicode_ci DEFAULT NULL,\n `price_avg` decimal(6,2) DEFAULT NULL,\n `price_total` decimal(6,2) DEFAULT NULL,\n `currency` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL,\n `date` date DEFAULT NULL,\n `nights` int(11) DEFAULT NULL,\n `people` int(11) DEFAULT NULL,\n `room_kind` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL,\n `room_description` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,\n `room_code` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,\n `tax_included` tinyint(1) DEFAULT '0',\n `created_at` datetime DEFAULT NULL,\n `updated_at` datetime DEFAULT NULL,\n PRIMARY KEY (`id`),\n KEY `index_prices_on_search_id` (`search_id`),\n KEY `index_prices_on_location_id` (`location_id`),\n KEY `index_prices_on_broker_location_type_and_broker_location_id` (`broker_location_type`,`broker_location_id`)\n) ENGINE=InnoDB auto_increment=45393347 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci")
-- execute("show create table prices")
-- execute("CREATE TABLE `lhmj_2011_11_25_11_01_26_3N_prices` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `broker_location_id` bigint(20) DEFAULT NULL,\n `broker_location_type` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,\n `location_id` int(11) DEFAULT NULL,\n `search_id` varchar(24) COLLATE utf8_unicode_ci DEFAULT NULL,\n `price_avg` decimal(6,2) DEFAULT NULL,\n `price_total` decimal(6,2) DEFAULT NULL,\n `currency` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL,\n `date` date DEFAULT NULL,\n `nights` int(11) DEFAULT NULL,\n `people` int(11) DEFAULT NULL,\n `room_kind` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL,\n `room_description` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,\n `room_code` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,\n `tax_included` tinyint(1) DEFAULT '0',\n `created_at` datetime DEFAULT NULL,\n `updated_at` datetime DEFAULT NULL,\n PRIMARY KEY (`id`),\n KEY `index_prices_on_search_id` (`search_id`),\n KEY `index_prices_on_location_id` (`location_id`),\n KEY `index_prices_on_broker_location_type_and_broker_location_id` (`broker_location_type`,`broker_location_id`)\n, hadron_action ENUM('update', 'insert', 'delete'), INDEX hadron_action (hadron_action) USING BTREE) ENGINE=InnoDB auto_increment=45382347 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci")
-- execute("\n create trigger `after_insert_prices`\n after insert on prices for each row\n begin\n insert into lhmj_2011_11_25_11_01_26_3N_prices (`id`,`broker_location_id`,`broker_location_type`,`location_id`,`search_id`,`price_avg`,`price_total`,`currency`,`date`,`nights`,`people`,`room_kind`,`room_description`,`room_code`,`tax_included`,`created_at`,`updated_at`, `hadron_action`)\n values (NEW.`id`,NEW.`broker_location_id`,NEW.`broker_location_type`,NEW.`location_id`,NEW.`search_id`,NEW.`price_avg`,NEW.`price_total`,NEW.`currency`,NEW.`date`,NEW.`nights`,NEW.`people`,NEW.`room_kind`,NEW.`room_description`,NEW.`room_code`,NEW.`tax_included`,NEW.`created_at`,NEW.`updated_at`, 'insert')\n ON DUPLICATE KEY UPDATE `id` = NEW.`id`,`broker_location_id` = NEW.`broker_location_id`,`broker_location_type` = NEW.`broker_location_type`,`location_id` = NEW.`location_id`,`search_id` = NEW.`search_id`,`price_avg` = NEW.`price_avg`,`price_total` = NEW.`price_total`,`currency` = NEW.`currency`,`date` = NEW.`date`,`nights` = NEW.`nights`,`people` = NEW.`people`,`room_kind` = NEW.`room_kind`,`room_description` = NEW.`room_description`,`room_code` = NEW.`room_code`,`tax_included` = NEW.`tax_included`,`created_at` = NEW.`created_at`,`updated_at` = NEW.`updated_at`;\n end\n ")
-- execute("\n create trigger `after_update_prices`\n after update on prices for each row\n begin\n insert into lhmj_2011_11_25_11_01_26_3N_prices (`id`,`broker_location_id`,`broker_location_type`,`location_id`,`search_id`,`price_avg`,`price_total`,`currency`,`date`,`nights`,`people`,`room_kind`,`room_description`,`room_code`,`tax_included`,`created_at`,`updated_at`, `hadron_action`)\n values (NEW.`id`,NEW.`broker_location_id`,NEW.`broker_location_type`,NEW.`location_id`,NEW.`search_id`,NEW.`price_avg`,NEW.`price_total`,NEW.`currency`,NEW.`date`,NEW.`nights`,NEW.`people`,NEW.`room_kind`,NEW.`room_description`,NEW.`room_code`,NEW.`tax_included`,NEW.`created_at`,NEW.`updated_at`, 'update')\n ON DUPLICATE KEY UPDATE `id` = NEW.`id`,`broker_location_id` = NEW.`broker_location_id`,`broker_location_type` = NEW.`broker_location_type`,`location_id` = NEW.`location_id`,`search_id` = NEW.`search_id`,`price_avg` = NEW.`price_avg`,`price_total` = NEW.`price_total`,`currency` = NEW.`currency`,`date` = NEW.`date`,`nights` = NEW.`nights`,`people` = NEW.`people`,`room_kind` = NEW.`room_kind`,`room_description` = NEW.`room_description`,`room_code` = NEW.`room_code`,`tax_included` = NEW.`tax_included`,`created_at` = NEW.`created_at`,`updated_at` = NEW.`updated_at`;\n end\n ")
-- execute("\n create trigger `after_delete_prices`\n after delete on prices for each row\n begin\n insert into lhmj_2011_11_25_11_01_26_3N_prices (`id`,`broker_location_id`,`broker_location_type`,`location_id`,`search_id`,`price_avg`,`price_total`,`currency`,`date`,`nights`,`people`,`room_kind`,`room_description`,`room_code`,`tax_included`,`created_at`,`updated_at`, `hadron_action`)\n values (OLD.`id`,OLD.`broker_location_id`,OLD.`broker_location_type`,OLD.`location_id`,OLD.`search_id`,OLD.`price_avg`,OLD.`price_total`,OLD.`currency`,OLD.`date`,OLD.`nights`,OLD.`people`,OLD.`room_kind`,OLD.`room_description`,OLD.`room_code`,OLD.`tax_included`,OLD.`created_at`,OLD.`updated_at`, 'delete')\n ON DUPLICATE KEY UPDATE `hadron_action` = 'delete';\n end\n ")
-- execute("\n alter table lhmn_prices\n CHANGE `broker_location_type` `broker_location_type` varchar(30) DEFAULT NULL,\n CHANGE `nights` `nights` tinyint DEFAULT NULL,\n CHANGE `people` `people` tinyint DEFAULT NULL,\n ADD `breakfast_included` tinyint(1) DEFAULT NULL AFTER `tax_included`,\n CHANGE `tax_included` `tax_included` tinyint(1) DEFAULT NULL,\n DROP `updated_at`\n ")
-- execute("start transaction")
-- execute("\n insert into lhmn_prices\n (`room_kind`,`created_at`,`broker_location_type`,`room_description`,`search_id`,`broker_location_id`,`room_code`,`price_avg`,`tax_included`,`nights`,`price_total`,`location_id`,`id`,`people`,`currency`,`date`)\n select `room_kind`,`created_at`,`broker_location_type`,`room_description`,`search_id`,`broker_location_id`,`room_code`,`price_avg`,`tax_included`,`nights`,`price_total`,`location_id`,`id`,`people`,`currency`,`date`\n from prices\n where (id between 1 and 10000000) \n\n ")
-- execute("COMMIT")
-- 3 more chunks to go, estimated end: Fri Nov 25 11:01:27 +0100 2011
-- execute("start transaction")
-- execute("\n insert into lhmn_prices\n (`room_kind`,`created_at`,`broker_location_type`,`room_description`,`search_id`,`broker_location_id`,`room_code`,`price_avg`,`tax_included`,`nights`,`price_total`,`location_id`,`id`,`people`,`currency`,`date`)\n select `room_kind`,`created_at`,`broker_location_type`,`room_description`,`search_id`,`broker_location_id`,`room_code`,`price_avg`,`tax_included`,`nights`,`price_total`,`location_id`,`id`,`people`,`currency`,`date`\n from prices\n where (id between 10000001 and 20000000) \n\n ")
-- execute("COMMIT")
-- 2 more chunks to go, estimated end: Fri Nov 25 11:01:27 +0100 2011
-- execute("start transaction")
-- execute("\n insert into lhmn_prices\n (`room_kind`,`created_at`,`broker_location_type`,`room_description`,`search_id`,`broker_location_id`,`room_code`,`price_avg`,`tax_included`,`nights`,`price_total`,`location_id`,`id`,`people`,`currency`,`date`)\n select `room_kind`,`created_at`,`broker_location_type`,`room_description`,`search_id`,`broker_location_id`,`room_code`,`price_avg`,`tax_included`,`nights`,`price_total`,`location_id`,`id`,`people`,`currency`,`date`\n from prices\n where (id between 20000001 and 30000000) \n\n ")
-- execute("COMMIT")
-- 1 more chunks to go, estimated end: Fri Nov 25 11:01:27 +0100 2011
-- execute("start transaction")
-- execute("\n insert into lhmn_prices\n (`room_kind`,`created_at`,`broker_location_type`,`room_description`,`search_id`,`broker_location_id`,`room_code`,`price_avg`,`tax_included`,`nights`,`price_total`,`location_id`,`id`,`people`,`currency`,`date`)\n select `room_kind`,`created_at`,`broker_location_type`,`room_description`,`search_id`,`broker_location_id`,`room_code`,`price_avg`,`tax_included`,`nights`,`price_total`,`location_id`,`id`,`people`,`currency`,`date`\n from prices\n where (id between 30000001 and 37965742) \n\n ")
-- execute("COMMIT")
-- 0 more chunks to go, estimated end: Fri Nov 25 11:01:28 +0100 2011
-- execute("rename table prices to lhmo_2011_11_25_11_01_26_3N_prices, lhmn_prices to prices")
-- execute("drop trigger if exists `after_insert_prices`")
-- execute("drop trigger if exists `after_insert_prices`")
rake aborted!
An error has occurred, all later migrations canceled:
Mysql::Error: Table 'dbadmin_development.lhmo_2011_11_25_11_01_26_3N_prices' doesn't exist: drop trigger if exists `after_insert_prices`
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
I obviously would more than happy to help sorting this out.
Thanks NB : I've cleaned the output a little (removing the execution times).
I've checked in my database ; the table exists (I can use it), the trigger exists, but I can't drop it.
i've posted a message in the MySQL forum : http://forums.mysql.com/read.php?99,502738,502738
I've found the origin of the problem, it is solved in issue #10
Is anyone else experiencing failing tests on master as of now?
I am seeing 2 failing tests:
This is a snippet of the error output: Mysql::Error: Table 'addscolumn' already exists: rename table new_addscolumn to addscolumn, addscolumn to 2011_06_12_16_51_51_3N_addscolumn
Looks like the Hash order changes when passed into the rename_tables method.
I am running Ruby 1.8.7, and the command: spec spec in my terminal window