#728 ✓resolved
Erik Michaels-Ober

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

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.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Attachments

Pages