t('Schema Regression Tests'), 'description' => t('Schema Regression Tests'), 'group' => t('Schema'), ); } function setUp() { parent::setUp('schema'); } function tearDown() { $ret = array(); db_drop_table($ret, 'schema_testtbl'); db_query("DROP TABLE schema_testtbl"); parent::tearDown(); } /** * Test API for adding tables */ function testInspectionConflict518210() { // Create an unprefixed table... $tablename = "schema_testtbl"; $sql = "CREATE TABLE $tablename ( fid INT NOT NULL, destid INT NOT NULL )"; db_query($sql); // ...and a prefixed table, with a different column list $ret = array(); $schema = array( 'fields' => array( 'sourceid' => array( 'type' => 'int', 'not null' => TRUE, ), 'destid' => array( 'type' => 'int', 'not null' => TRUE, ), ), ); db_create_table($ret, $tablename, $schema); // Do the full inspection, and get our specified tablename $inspect = schema_invoke('inspect'); $fields = $inspect[$tablename]['fields']; // We should see only the columns from the prefixed version $this->assertFalse(isset($fields['fid']), t('fid does not exist')); $this->assertTrue(isset($fields['sourceid']), t('sourceid exists')); $this->assertTrue(isset($fields['destid']), t('destid exists')); // Inspect the table by using schema_compare(). $comparison = schema_compare_table($inspect[$tablename]); $this->assertEqual($comparison['status'], 'same'); } }