Esempio n. 1
0
    public function testDrop()
    {
        $xml = <<<XML
<schema name="domains">
  <type name="my_domain" type="domain">
    <domainType baseType="varchar(20)" default="abc"/>
  </type>
</schema>
XML;
        $schema = simplexml_load_string($xml);
        $type = $schema->type;
        $this->assertEquals('DROP DOMAIN "domains"."my_domain";', pgsql8_type::get_drop_sql($schema, $type));
    }
 /**
  * Outputs commands for dropping types.
  *
  * @param $ofs          output file pointer
  * @param $old_schema   original schema
  * @param $new_schema   new schema
  */
 private static function drop_types($ofs, $old_schema, $new_schema)
 {
     if ($old_schema != NULL) {
         foreach (dbx::get_types($old_schema) as $type) {
             if (!pgsql8_schema::contains_type($new_schema, $type['name'])) {
                 pgsql8::set_context_replica_set_id($type);
                 $ofs->write(pgsql8_type::get_drop_sql($new_schema, $type) . "\n");
             }
         }
     }
 }