public function schema($output_file) { $command = sprintf("pg_dump -U %s -Fp -s -f '%s' %s --host %s", $this->db_info['user'], $output_file, $this->db_info['database'], $this->db_info['host']); return system($command); }
/** * test if we can dump the current schema */ public function test_can_dump_schema() { $this->adapter->execute_ddl('DROP TABLE IF EXISTS "animals"'); $this->adapter->execute_ddl("CREATE TABLE animals (id serial primary key, name varchar(32))"); $this->adapter->execute_ddl("CREATE INDEX idx_animals_on_name ON animals(name)"); $file = RUCKUSING_BASE . '/tests/logs/schema.txt'; $this->adapter->schema($file); $this->assertFileExists($file); if (file_exists($file)) { unlink($file); } $this->adapter->execute_ddl('DROP TABLE IF EXISTS "animals"'); }