Steps to reproduce:

  • do a clean install using SQLite
  • enable the testing module
  • run the Entity API test group. It'll die with:
    ResponseText: A fatal error occurred: SQLSTATE[HY000]: General error: 1 table "entity_test_rev_revision" has more than one primary key: CREATE TABLE {entity_test_rev_revision} ( id INTEGER NOT NULL CHECK (id>= 0), revision_id INTEGER PRIMARY KEY AUTOINCREMENT CHECK (revision_id>= 0), langcode VARCHAR(12) NOT NULL DEFAULT '', name VARCHAR(32) NOT NULL DEFAULT '', user_id INTEGER NULL CHECK (user_id>= 0) DEFAULT NULL, PRIMARY KEY (id, langcode) );

The issue is that the serial field types get a "PRIMARY KEY" attached to them when converted to SQL. SQLite doesn't like getting two differently defined PRIMARY KEYs in a CREATE TABLE.

The RDF tests depend on Entity API's tests and thus also fail right now, which is how I ran into this. The RDF tests run cleanly on SQLite after applying the attached patch.

The attached patch elliminates the complex primary keys in the entity api test schemas which allows the tables to install on SQLite. The tests still run cleanly and not noticeably slower on MySQL after the change.

Unfortunately, afterward you run into an uncaught exception...

General error: 1 a GROUP BY clause is required before HAVING: SELECT COUNT( AS id_count FROM {entity_test} base_table LEFT JOIN {entity_test} entity_test ON = INNER JOIN {entity_test} entity_test_2 ON = HAVING (COUNT( = :db_placeholder_0) ; Array ( [:db_placeholder_0] => 8 )

..and a fatal error...
Cannot access protected property Drupal\field_test\Plugin\Core\Entity\TestEntity::$isDefaultRevision

...that prevent the tests from running successfully. At this point it is deep enough into core entity stuff that others are much more qualified to take it from here. I hope this helps though.
drupal-entity_api_tests_fail_on_sqlite.patch920 bytesfloydm
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch drupal-entity_api_tests_fail_on_sqlite.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]


floydm’s picture

Issue summary:View changes

Just tweaking the copy.

Crisz’s picture

Status:Needs work» Needs review

Status:Needs review» Needs work

The last submitted patch, drupal-entity_api_tests_fail_on_sqlite.patch, failed testing.