/** * Return a description for each table. * * @return \Generator */ public function tables() { $schema = $this->db->connection()->getDoctrineConnection()->getSchemaManager(); $tables = $schema->listTableNames(); foreach ($tables as $table) { $columns = $this->describer->describe($table); (yield compact('table', 'columns')); } }
/** @test */ public function it_should_return_an_array_of_all_columns_for_a_table() { $describer = new Describer($this->database->getDatabaseManager()); $description = $describer->describe('posts'); $this->assertDbSchema('id', 'integer', $description[0]); $this->assertDbSchema('title', 'string', $description[1]); $this->assertDbSchema('body', 'text', $description[2]); $this->assertDbSchema('created_at', 'datetime', $description[3]); $this->assertDbSchema('updated_at', 'datetime', $description[4]); }