In a local dev site, trying to install the module to better understand it (for creating your own) results in the following error if the database being used is SQLite3:
PDOException: SQLSTATE[HY000]: General error: 1 there is already an index named model_type: CREATE TABLE {model_type} ( id INTEGER PRIMARY KEY AUTOINCREMENT, type VARCHAR(255) NOT NULL, label VARCHAR(255) NOT NULL DEFAULT '', weight INTEGER NOT NULL DEFAULT 0, data TEXT NULL DEFAULT NULL, status INTEGER NOT NULL DEFAULT 1, module VARCHAR(255) NULL DEFAULT NULL ); ; Array ( ) in db_create_table() (line 2717 of /var/www/drupal/includes/database/database.inc).
This issue could not be reproduced when using a MySQL database, but could be reproduced on a fresh SQLite3 install.
Comment | File | Size | Author |
---|---|---|---|
#2 | model-sqlite-1988576-summary.patch | 790 bytes | awochna |
Comments
Comment #1
awochna CreditAttribution: awochna commentedComment #2
awochna CreditAttribution: awochna commentedThis is the result of SQLite prefixing its keys with the name of the parent table. Therefore, the key "type" in the table "model" results in an object already called "model_type" which prevents you from creating a table of the same name.
The attached patch changes the name of the table to model_types to avoid this issue.
Comment #3
a.ross CreditAttribution: a.ross commentedThe convention is to use [entity]_type as table for the bundle types. This should be fixed in another way.