Project

General

Profile

Actions

Bug #2264

closed

schema.rb invalid for MySQL, fails creating index on sources.value TEXT column

Added by Dominic Cleal over 11 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Database
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

On MySQL, the sources table gets created with a full text index in the 20101018120603_create_sources.rb migration:

CreateSources: migrating ==================================================
-- create_table(:sources)
> 0.2536s
-
execute("ALTER TABLE sources ENGINE = MYISAM")
> 0.1248s
-
execute("ALTER TABLE sources ADD FULLTEXT (value)")
-> 0.0606s
CreateSources: migrated (0.4396s) =========================================

db/schema.rb gets written out as:

create_table "sources", :force => true do |t|
t.text "value"
end
add_index "sources", ["value"], :name => "value"

However when this is run as part of loading test fixtures, it fails as it doesn't create a full text index:

CREATE TABLE `sources` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `value` text) ENGINE=InnoDB
CREATE INDEX `value` ON `sources` (`value`)^[[0m
Mysql::Error: BLOB/TEXT column 'value' used in key specification without a key length: CREATE INDEX `value` ON `sources` (`value`)

I'd suggest the same fix used for #2126 is applied to sources, or change it to use a SQL schema.


Related issues 1 (0 open1 closed)

Has duplicate Foreman - Bug #1614: SQL index on sources.value columnDuplicate05/10/2012Actions
Actions

Also available in: Atom PDF