ufront / ufront-orm

The Object Relational Mapper, allows easy, type-safe access to your database. Builds on Haxe's SPOD but adds macro powered relationships, validation and client side usage
MIT License
13 stars 4 forks source link

ManyToMany.createJoinTable() produces wrong table name #10

Closed milkmangames closed 9 years ago

milkmangames commented 9 years ago

ManyToMany.createJoinTable() creates a table with the name "relationship" instead of "_join_x_y". Tested on PHP and Neko.

Tried changing the 'Relationship.manager' on lines 117 and 118 to 'manager', but issue persists.

Verified that ManyToMany.getManager is successfully setting the correct value to m.table_name. However, resulting SQL from TableCreate is still using the name 'relationship':

CREATE TABLE Relationship (id INTEGER UNSIGNED AUTO_INCREMENT NOT NULL,created DATETIME NOT NULL,modified DATETIME NOT NULL,r1 INTEGER UNSIGNED NOT NULL,r2 INTEGER UNSIGNED NOT NULL,PRIMARY KEY (id))

I think that the haxe db api takes the table_name from the class not the instance, but haven't really figured out what's going on.

milkmangames commented 9 years ago

side note: It appears that my build is using the sys.db.Manager from haxe std and not the sys.db.Manager that is included in ufront-orm. Does this variation of manager do something special that could be causing my problem?

milkmangames commented 9 years ago

(Issue was unintentionally closed)

jasononeil commented 9 years ago

Thanks @milkmangames, I think this should be fixed now. I've written some unit tests and running on Neko/PHP, SQLite/MySQL, and all passing. Latest Haxe development branch, I will test with 3.1.3 soon.