|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Schema questionsI'm starting to play with metastorage and I'm wondering about a few
things I'm seeing in the generated MySQL database. 1) The "id" columns generated for OIDs in the tables are specified as "int(11) unsigned" but the corresponding FK columns in other tables are only "int(11)". That's a bug; it should be consistent. 2) I have some text fields defined in two different classes (User and Session). In the table definition for one (User) those columns are "char(xx)" but in the other table (Session) they are "varchar(xx)". My definitions are virtually identical except for the "length" attributes. What causes the different data types to be used? For instance, here's the definitions of two text fields: User.class: <variable> <name>loginname</name> <type>text</type> <length>20</length> </variable> Session.class: <variable> <name>sessionid</name> <type>text</type> <length>40</length> </variable> Here are the columns defs from MySQL: User: loginname char(20) Session: sessionid varchar(40) 3) In the virtual tables generated for many-to-many relationships, the column names are not very meaningful. For instance, I have two classes, Role and Permission, with a N:N relationship. The generated columns are: Permission_roles int(11) Role_permissions int(11) (Note the problem mentioned in (1) as well). Why can't the columns be named Permission_id and Role_id? Wouldn't that be more meaningful when poking around the DB by hand? Right now, I can't tell which column holds which FK. Answers would be appreciated. -Tab Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/metal-dev/ <*> To unsubscribe from this group, send an email to: metal-dev-unsubscribe@... <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/ |
|
|
Re: Schema questionsHello,
on 03/24/2006 02:02 PM Tab Bennedum said the following: > 1) The "id" columns generated for OIDs in the tables are specified > as "int(11) unsigned" but the corresponding FK columns in other > tables are only "int(11)". That's a bug; it should be consistent. Ok, not a big deal, but I agree that using unsigned everywhere would be more consistent. The schema generation was fixed in the latest CVS version. > 2) I have some text fields defined in two different classes (User > and Session). In the table definition for one (User) those columns > are "char(xx)" but in the other table (Session) they are > "varchar(xx)". My definitions are virtually identical except for the > "length" attributes. What causes the different data types to be > used? For instance, here's the definitions of two text fields: Metabase MySQL driver always declares the fields as VARCHAR. However, MySQL performs silent column specification changes in some cases: http://dev.mysql.com/doc/refman/4.1/en/silent-column-changes.html > 3) In the virtual tables generated for many-to-many relationships, > the column names are not very meaningful. For instance, I have two > classes, Role and Permission, with a N:N relationship. The generated > columns are: > > Permission_roles int(11) > Role_permissions int(11) The names are generated automatically using the class and collection names in such way that these fields will never have the same names. > (Note the problem mentioned in (1) as well). Why can't the columns > be named Permission_id and Role_id? Wouldn't that be more meaningful Currently there is no way to tell Metastorage to generate fields with different names, so it assumes the default convention. Although this is not a trivial feature, it is on the to do list to be implemented in a future release. > when poking around the DB by hand? Right now, I can't tell which > column holds which FK. Currently Metabase does not yet support the definition of foreign key fields, so they are implicit. Even though, not all databases support foreign keys, foreign keys will be supported in a future Metabase release, so you will be able to tell which field refers to what regardless of the naming convention that is used. -- Regards, Manuel Lemos Metastorage - Data object relational mapping layer generator http://www.metastorage.net/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/metal-dev/ <*> To unsubscribe from this group, send an email to: metal-dev-unsubscribe@... <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/ |
| Free Forum Powered by Nabble | Forum Help |