Skip to content
Permalink
Browse files

Don't include views in table list.

When using SQLServer we should only include 'BASE TABLE' types in the
list of tables. This prevents errors where bake and other schema tooling
tries to interact with views and fails.

Refs cakephp/bake#60
  • Loading branch information...
markstory committed Apr 2, 2015
1 parent 5d706fb commit de7ce1469e6aae57a2944b3d0abf362ef503c8f3
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/Database/Schema/SqlserverSchema.php
@@ -29,10 +29,11 @@ class SqlserverSchema extends BaseSchema
*/
public function listTablesSql($config)
{
$sql = 'SELECT TABLE_NAME
$sql = "SELECT TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = ?
ORDER BY TABLE_NAME';
AND TABLE_TYPE = 'BASE TABLE'
ORDER BY TABLE_NAME";
$schema = empty($config['schema']) ? static::DEFAULT_SCHEMA_NAME : $config['schema'];
return [$sql, [$schema]];
}

0 comments on commit de7ce14

Please sign in to comment.
You can’t perform that action at this time.