Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I am trying to use entityform with SQLite, but get an error when enabling entityform. The problem seems to be that SQLite doesn't like the notion of having both a table and an index named entityform_type
.
Here is a complete set of steps to reproduce the error.
$ drush --version
drush version 5.8
# This is needed to allow installation with sqlite to proceed
patch -p1 < curl http://drupal.org/files/1266572-20-workaround-in-sqlite-some-update-missed-d7-do-not-test.patch
$ drush site-install --db-url=sqlite://sites/default/files/site.sqlite -y
You are about to create a sites/default/settings.php file and CREATE the 'sites/default/files/site.sqlite' da
tabase. Do you want to continue? (y/n): y
Starting Drupal installation. This takes a few seconds ... [ok]
Installation complete. User name: admin User password: cnUUaLH4MQ [ok]
$ drush dl entityform
Project entityform (7.x-1.0) downloaded to [success]
/home/haxney/Documents/durgood/sites/all/modules/entityform.
Project entityform contains 3 modules: entityform_notifications, entityform_test, entityform.
$ drush en -y entityform
The following projects have unmet dependencies:
entityform requires rules, views, entity
Would you like to download them? (y/n): y
Project rules (7.x-2.2) downloaded to /home/haxney/Documents/durgood/sites/all/modules/rules. [success]
Project rules contains 4 modules: rules_admin, rules_scheduler, rules_i18n, rules.
Project views (7.x-3.5) downloaded to /home/haxney/Documents/durgood/sites/all/modules/views. [success]
Project views contains 2 modules: views, views_ui.
Project entity (7.x-1.0) downloaded to /home/haxney/Documents/durgood/sites/all/modules/entity. [success]
Project entity contains 2 modules: entity, entity_token.
The following projects have unmet dependencies:
entityform requires ctools
Would you like to download them? (y/n): y
Project ctools (7.x-1.2) downloaded to /home/haxney/Documents/durgood/sites/all/modules/ctools. [success]
Project ctools contains 9 modules: ctools_access_ruleset, views_content, bulk_export, stylizer, ctools_plugin
example, ctools_custom_content, ctools_ajax_sample, page_manager, ctools.
The following extensions will be enabled: entityform, entity_token, rules, ctools, views, entity
Do you really want to continue? (y/n): y
WD php: PDOException: SQLSTATE[HY000]: General error: 1 there is already an index named [error]
entityform_type: CREATE TABLE {entityform_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 2688 of /home/haxney/Documents/durgood/includes/database/database.inc).
Cannot modify header information - headers already sent by (output started at [warning]
/usr/share/drush/includes/output.inc:37) bootstrap.inc:1212
PDOException: SQLSTATE[HY000]: General error: 1 there is already an index named entityform_type: CREATE TABLE{entityform_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 2688 of /home/haxney/Documents/durgood/includes/database/database.inc).
Drush command terminated abnormally due to an unrecoverable error. [error]
I'm on Drupal 7.18 under Ubuntu 12.10, 64-bit using PHP 5.4.6-1ubuntu1.1
Comment | File | Size | Author |
---|---|---|---|
#38 | entityform_schema_mismatch.png | 37.17 KB | nikathone |
#28 | entityform-sqlite_error-1876872-28.patch | 926 bytes | czigor |
Comments
Comment #1
haxney CreditAttribution: haxney commentedAha! I've found a solution. The problem is that Drupal forms index names by concatenating the table name with the index name, so the index named
type
on the tableentityform
created an index calledentityform_type
, which clashes with the table of the same name. Changing the name of$schema['entityform']['indexes']['type']
to$schema['entityform']['indexes']['entity_form_type_index']
(for example) produces an index namedentityform_entity_form_type_index
, which no longer clashes with the table name.Incidentally, there is an index called
entityform_type_type
because of the unique key on the tableentityform_type
. Not a problem, just FYI.Comment #2
tedbowOk, thinking about how to fix this.
Can you let me know what version of SQLite you are using?
Thanks
Comment #3
Mentor.37 CreditAttribution: Mentor.37 commentedSame problem, how can i fix it?
Comment #4
tedbowI never heard back from him about my question in #2. Can you let me what version of SQLite you are using?
Comment #5
Mentor.37 CreditAttribution: Mentor.37 commentedI'm using sqlite 3.
Comment #6
tedbow@Mentor, please confirm that you are using
From http://drupal.org/requirements
Before I investigate this problem I want to make sure that this is happening with the recommended version of SQLite
Comment #7
Mentor.37 CreditAttribution: Mentor.37 commentedYes, i have SQLite 3.7.7.1.
Comment #8
tedbow@Mentor, ok thanks.
I have attached that renames the index by dropping and re-adding it.
Let me know if this works for you.
Comment #9
tedbowchanging to needs review
Comment #11
tedbowpatch is against dev version
Comment #12
tedbow#8: entityform-rename_type_index-1876872-8.patch queued for re-testing.
Comment #13
tedbowI don't have SQLite installed. I have tested this with my setup that uses mysql but will need someone to test it on SQLite.
Comment #14
Mentor.37 CreditAttribution: Mentor.37 commentedI'm unable to apply patch. How can i do this?
Comment #15
jweowu CreditAttribution: jweowu commentedMentor: see http://drupal.org/node/1378306/git-instructions/7.x-1.x
Comment #16
jeyram CreditAttribution: jeyram commentedWell, the patch doesn't work for me. I'm using sqlite ver 3.7.9
Comment #17
tedbow@jeyram does it not work on an existing or new install?
Comment #18
tedbowmore info needed
Comment #19
geek-merlinI'm suffering from this on sqlite 3.6.20.
first for other sufferers how to cure the WSOD:
(the last line is important because although the module is marked uninstalled there IS an entityform table left.)
the i applied the patch to dev and tested fresh install, but got same exception as above #16.
reviewing the code - no wonder.
fixed the fix and made a happy clean install.
patch flying in.
Comment #20
upupax CreditAttribution: upupax commentedThe patch works for me
Comment #21
Xumorist CreditAttribution: Xumorist commented19: 0001-Issue-1876872-by-tedbow-haxney-axel.rutz-Fixed-SQLit.patch queued for re-testing.
Comment #22
czigor CreditAttribution: czigor commentedPatch works for me too. I don't understand what's the problem with the 'type' index though. Is 'type' a reserved word in sqlite?
Comment #23
geek-merlinrtbc as of #20
Comment #24
tedbow19: 0001-Issue-1876872-by-tedbow-haxney-axel.rutz-Fixed-SQLit.patch queued for re-testing.
Comment #25
tedbowI am going to re-test to make it sure it still applies.
Thanks,
Comment #26
geek-merlinOK, testbot is happy.
Comment #27
geek-merlinComment #28
czigor CreditAttribution: czigor commentedAbove patch does not apply any more, rerolling.
Comment #30
czigor CreditAttribution: czigor commentedWrong branch.
Comment #32
czigor CreditAttribution: czigor commentedComment #33
kenorb CreditAttribution: kenorb commentedThe same in here, patch works fine.
Reproducible steps:
1. Clone this sandbox.
2. Remove this patch from `contrib-core.yml`.
3. Build sandbox via `make`.
It should fail:
Comment #34
joelpittetThis is a bit strange because core has this in node, field, dblog and feeds also does this. Do you have to patch any of those as well?
Comment #36
joelpittetRe-rolled it for
entityform_update_7007
, and committed to -dev. I see that it's the _type that's likely causing this and none of the other modules tables are named that way.Comment #38
nikathoneThis issue fix seems to have introduced another one. The index rename change below is being done under
$schema['entityform']
while the
function entityform_update_7006(&$sandbox = NULL)
is targeting the$schema['entityform_type']
Noticed this error when I installed https://www.drupal.org/project/schema
Comment #39
joelpittetplease open a new issue, I'm not totally following the issue you have.