
Fix/report issues with MySQL and migrations
Reported by Martin Stannard | February 16th, 2009 @ 03:33 AM
The query produced by the create_db command is failing when I try to run it.
mysql Ver 14.12 Distrib 5.0.51a, for debian-linux-gnu (x86_64) using readline 5.2
The query and error is
/usr/lib/ruby/gems/1.8/gems/dm-core-0.9.10/lib/dm-core/adapters/data_objects_adapter.rb:92:in
execute_non_query': (mysql_errno=1064, sql_state=42000) You have an
error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'DEFAULT
NULL,branchVARCHAR(50) DEFAULT
'master',
commandVARCHAR(50) DEFAU' at line 1
(MysqlError)
Query: CREATE TABLE integrity_projects
(id
serial PRIMARY KEY, name
VARCHAR(50),
permalink
VARCHAR(50), uri
VARCHAR
DEFAULT NULL, branch
VARCHAR(50) DEFAULT 'master',
command
VARCHAR(50) DEFAULT 'rake',
public
TINYINT DEFAULT 1, building
TINYINT DEFAULT 0, created_at
DATETIME,
updated_at
DATETIME, build_id
INT(11),
notifier_id
INT(11)) from
/usr/lib/ruby/gems/1.8/gems/dm-core-0.9.10/lib/dm-core/adapters/data_objects_adapter.rb:92:in
execute'
Running the query on the command line reveals that
uri
VARCHAR DEFAULT NULL is causing the problem.
Looks like a value is needed for the VARCHAR
Comments and changes to this ticket
-
Simon Rozet February 16th, 2009 @ 05:12 AM
- Tag changed from mysql to dm, external, mysql
- State changed from new to open
- Assigned user changed from ronin-278 (at lighthouseapp) to Simon Rozet
-
-
Uros Zekar March 24th, 2009 @ 10:58 PM
I bypassed this by changing the following line in migrations.rb: -column :uri, URI, :nullable => false +column :uri, String, :nullable => false
After that I got an error about output column (I believe mysql doesn't take DEFAULT option for text columns). fixed by modifying two occurrences of output column like this: -column :output, Text, :nullable => false, :default => "" +column :output, Text, :nullable => false
-
Simon Rozet March 28th, 2009 @ 05:55 PM
- Milestone cleared.
-
Simon Rozet March 28th, 2009 @ 09:41 PM
I pushed a fix for this: http://github.com/foca/integrity/commit/fd5396e31bf4841f24c79a452e96c22cdf794abd. Please try it.
-
Simon Rozet March 31st, 2009 @ 06:26 PM
- Title changed from create_db option not working for mysql to Fix/report issues with MySQL and migrations
From #127, by Uros Zekar:
The migration for mySQL creates varchar(50) for all "String" columns. It results in the error like this when it finds a message or author that exceeds 50 chars:
(mysql_errno=1406, sql_state=22001) Data too long for column 'message' at row 1 Query: UPDATE integrity_commits SET message = 'Build distributables under pkg/ instead of dist/ (per blake's request)', updated_at = '2009-03-24 14:28:48', author = 'Ryan Tomayko rtomayko@gmail.com', committed_at = '2009-03-24 01:47:24' WHERE (id = 1)
I resized the message and author manually to varchar(255): ALTER TABLE integrity_commits MODIFY message varchar(255), MODIFY author varchar(255);
-
Simon Rozet October 21st, 2009 @ 08:21 PM
- State changed from open to wontfix
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
Automated continuous integration server that doesn't suck.
People watching this ticket
Referenced by
-
127 mysql ignoring :length option while migrating Merged with #92.
-
160 Long commands return a SQL error. Duplicate of #92
-
174 Bug in MySQL Query for integrity migrate_db (gem version 0.1.10) dupe of #92