
BUG for Model with association but no properties
Reported by Erik Michaels-Ober | December 24th, 2008 @ 01:58 AM
DataMapper generates SQL like this for a Model with an association but no properties defined:
CREATE TABLE `foo` () ENGINE = InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci
which generates an error like this:
MysqlError: 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 ') ENGINE = InnoDB CHARACTER SET utf8
COLLATE utf8_general_ci' at line 1
(mysql_error_code=0001)
or this:
Sqlite3Error: near ")": syntax error
Should be reproducible with the following code:
class Foo
include DataMapper::Resource
belongs_to :bar
end
class Bar
include DataMapper::Resource
has 1, :foo
end
Dan had this to say on #merb:
dkubb: sferik: DM shouldn't generate invalid SQL in any
circumstances, so I would consider that a bug
dkubb: sferik: do you have any properties defined inside
the Model?
dkubb: sferik: even if you don't, I still consider it a
bug. DM should just skip creating a table with no
properties
Comments and changes to this ticket
-
Dan Kubb (dkubb) January 8th, 2009 @ 05:17 AM
- State changed from unconfirmed to accepted
- Assigned user set to Dan Kubb (dkubb)
-
-
Jonathan Stott (namelessjon) February 22nd, 2009 @ 10:35 AM
- Tag changed from 0.9.8, bug, datamapper, mysql, sql, sqlite3 to 0.9.8, bug, datamapper, mysql, one_file_test, sql, sqlite3
- State changed from accepted to resolved
This is fixed in 0.10.0, with no tables created (see attached one file test)
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 »