"Problem" with CodeIgniter and DataMapper (Databasedesign) |
[eluser]felix_[/eluser]
[quote author="WanWizard" date="1305146591"]The logic needed for autocreation of tables is something you drag along with every load of Datamapper. So for performance reasons I've choosen not to add this automatic mechanism. I am thinking about some semi-automatic ways of doing this, but haven't found a good solution yet. The naming rules of Datamapper are quite simple, and very well documented in the user guide: - models are named singular, tables plural (model User, table users) - every table MUST have a primary key called 'id', which MUST be an integer - every foreign key MUST be named {model}_id If you have one-to-many relations, you can work with in-table foreign keys (for example, a country has many users, users only one country. In this case you can add country_id to the users table). If you have a many-to-many relationship, you MUST create a relationship or junction table. This table MUST contain a primary key ('id'), and the foreign keys of both tables in the relationship. The junction table MUST be called {tableA}_{tableB}, in alphabetical order. For consistency reasons you can also use junction tables for one-to-many relationships, but it's not required. I suggest you spend some time reading the user guide, in particular http://datamapper.wanwizard.eu/pages/relationtypes.html[/quote] thanks for your answer... i found my mistake i did not name the columns exactly as needed workin now |
Messages In This Thread |
"Problem" with CodeIgniter and DataMapper (Databasedesign) - by El Forum - 05-11-2011, 08:18 AM
"Problem" with CodeIgniter and DataMapper (Databasedesign) - by El Forum - 05-11-2011, 08:52 AM
"Problem" with CodeIgniter and DataMapper (Databasedesign) - by El Forum - 05-11-2011, 09:43 AM
"Problem" with CodeIgniter and DataMapper (Databasedesign) - by El Forum - 05-11-2011, 09:49 AM
|