Bad news: DatabaseSchema_sqlite is severely broken. Good news: with the upgrade tests, we know have some intense Schema tests :)

Are broken:

  • dropField() exits with FALSE when the field exists (oups!)
  • changeField() and alterTable() doesn't map the old field name to the new field name, so the data migration query fails (re-oups!)
  • changeField() doesn't change the name of a renamed field in the index / unique key definitions (re-re-oups!)
  • dropField() doesn't remove the name of the dropped field, so the data migration query fails (re-re-re-oups!)

Critical because the Upgrade path test fails on SQLite (because the Schema is broken).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Damien Tournoud’s picture

Status: Active » Needs review
FileSize
8.16 KB
Damien Tournoud’s picture

Also, we are creating / destroying the indexes twice during a field rename operation: once for the data migration, once for the table rename. We should avoid creating the indexes when creating the temporary table. This affects performance but doesn't affect functionality.

Status: Needs review » Needs work

The last submitted patch, 851698-sqlite-schema-broken.patch, failed testing.

Damien Tournoud’s picture

Status: Needs work » Needs review

This one relies on the other DatabaseSchema_sqlite patches I posted earlier. It doesn't apply on top of a vanilla tree, but it can still be reviewed :)

MySQL is not affected anyway.

Damien Tournoud’s picture

Some additional issues:

  • There doesn't seem to be a need for renaming the table twice in alterTable()
  • dropIndex() and dropUniqueKey() were broken: they deleted the index without proper schema prefixing
Damien Tournoud’s picture

Status: Needs review » Needs work

The last submitted patch, 851698-sqlite-schema-broken.patch, failed testing.

Damien Tournoud’s picture

Status: Needs work » Needs review
FileSize
12.52 KB
Stevel’s picture

Still works on mysql according to testbot, and this patch makes the basic upgrade test work on sqlite, which is definitely a huge plus. One small thing though:

+++ includes/database/sqlite/schema.inc
@@ -20,8 +20,10 @@ class DatabaseSchema_sqlite extends DatabaseSchema {
+    return (bool) $this->connection->query("SELECT 1 FROM {$info['schema']}.sqlite_master WHERE type = :type AND name = :name", array(':type' => 'table', ':name' => $info['table']))->fetchField();

Using the brackets around {$info['schema']} is a bit confusing here: It's not clear whether they show up in the resulting string or not?
I think it would be better for clarity to use concatenation here to include the variable

51 critical left. Go review some!

chx’s picture

Status: Needs review » Needs work

Right. So this needs work.

Damien Tournoud’s picture

Status: Needs work » Needs review
FileSize
13.73 KB

Fixes #9.

chx’s picture

Status: Needs review » Reviewed & tested by the community

Good job.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.