When testing schema_compare_table() I discovered a bug in schema_compare_table() and in schema_mysql_inspect():
When table prefixes are enabled (i. e. with simpletest) in schema_compare_table() :
$ref_name = db_prefix_tables('{'. $ref['name'] .'}');
$inspect = schema_invoke('inspect', $ref_name);
$inspect = $inspect[$ref_name];
Needs to be:
$ref_name = db_prefix_tables('{'. $ref['name'] .'}');
$inspect = schema_invoke('inspect', $ref_name);
$inspect = $inspect[$ref['name']]; // use the unprefixed name!
Further, there were a bunch of notices popping up due to the fact that schema_mysql_inspect() if a $name is given, first queries only for the schema info by name, but then proceeds to collect further information about any table which in turn leads to notices that 'name' is not set in line 174 of the file.
This is fixed by adding WHERE constraints on all queries in schema_mysql_inspect(). I expect similar problems to occur with pgsql, don't have an environment set up at the moment to test though.
Patch coming.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 533596_fix_schema_compare_table.patch | 2.58 KB | alex_b |
Comments
Comment #1
alex_b commented- Fixes the issues outlined above
- Adds test
Comment #2
mikeryanCommitted, thanks!