Skip to content

Commit 58055c2

Browse files
wsamohtpeterfox
andauthored
fix: Any artisan command that drops tables erroring with unknown function: pg_total_relation_size() (#26)
* Override compileTables setting table size to 0 * Change default size to -1 to make it apparent that it is not supported * Change all quotes to single Co-authored-by: Peter Fox <[email protected]> --------- Co-authored-by: Peter Fox <[email protected]>
1 parent bebcf9e commit 58055c2

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/Schema/CockroachGrammar.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,23 @@
99

1010
class CockroachGrammar extends PostgresGrammar
1111
{
12+
/**
13+
* Compile the query to determine the tables.
14+
*
15+
* CockroachDB doesn't yet support pg_total_relation_size()
16+
* https://github.com/cockroachdb/cockroach/issues/20712
17+
* https://github.com/cockroachdb/cockroach/pull/59604
18+
*
19+
* @return string
20+
*/
21+
public function compileTables()
22+
{
23+
return 'select c.relname as name, n.nspname as schema, -1 as size, '
24+
. 'obj_description(c.oid, \'pg_class\') as comment from pg_class c, pg_namespace n '
25+
. 'where c.relkind = \'r\' and n.oid = c.relnamespace '
26+
. 'order by c.relname';
27+
}
28+
1229
/**
1330
* Compile a fulltext index key command.
1431
*

0 commit comments

Comments
 (0)