From 63c94efccb20c0b398dd90c0d209d6894eb22d92 Mon Sep 17 00:00:00 2001 From: Steve Rice Date: Tue, 25 Mar 2014 21:13:29 -0700 Subject: Fixes bugs for using indexes in CREATE TABLE by adding checks for table existence Also: - updates tests by stubbing table_exists? method - adds entry for creating indexes in CREATE TABLE to changelog --- activerecord/CHANGELOG.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'activerecord/CHANGELOG.md') diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 6e77493de9..ccd07ce248 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,18 @@ +* Create indexes inline in CREATE TABLE for MySQL + + This is important, because adding an index on a temporary table after it has been created + would commit the transaction. + It also allows creating and dropping indexed tables with fewer queries and fewer permissions required. + + Example: + + create_table :temp, temporary: true, as: "SELECT id, name, zip FROM a_really_complicated_query" do |t| + t.index :zip + end + # => CREATE TEMPORARY TABLE temp (INDEX (zip)) AS SELECT id, name, zip FROM a_really_complicated_query + + *Cody Cutrer*, *Steve Rice* + * Save `has_one` association even if the record doesn't changed. Fixes #14407. -- cgit v1.2.3 From cbe1bc29722ddeda12d8652c409cea156ddb85a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Wed, 26 Mar 2014 20:31:32 -0300 Subject: Improve CHANGELOG entry --- activerecord/CHANGELOG.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'activerecord/CHANGELOG.md') diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index ccd07ce248..42b7618fa7 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,8 +1,10 @@ -* Create indexes inline in CREATE TABLE for MySQL +* Create indexes inline in CREATE TABLE for MySQL. This is important, because adding an index on a temporary table after it has been created would commit the transaction. - It also allows creating and dropping indexed tables with fewer queries and fewer permissions required. + + It also allows creating and dropping indexed tables with fewer queries and fewer permissions + required. Example: @@ -11,7 +13,7 @@ end # => CREATE TEMPORARY TABLE temp (INDEX (zip)) AS SELECT id, name, zip FROM a_really_complicated_query - *Cody Cutrer*, *Steve Rice* + *Cody Cutrer*, *Steve Rice*, *Rafael Mendonça Franca* * Save `has_one` association even if the record doesn't changed. -- cgit v1.2.3