Skip to content

Commit

Permalink
fix: Any artisan command that drops tables erroring with unknown func…
Browse files Browse the repository at this point in the history
…tion: 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]>
  • Loading branch information
wsamoht and peterfox authored Dec 2, 2023
1 parent bebcf9e commit 58055c2
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Schema/CockroachGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,23 @@

class CockroachGrammar extends PostgresGrammar
{
/**
* Compile the query to determine the tables.
*
* CockroachDB doesn't yet support pg_total_relation_size()
* https://github.com/cockroachdb/cockroach/issues/20712
* https://github.com/cockroachdb/cockroach/pull/59604
*
* @return string
*/
public function compileTables()
{
return 'select c.relname as name, n.nspname as schema, -1 as size, '
. 'obj_description(c.oid, \'pg_class\') as comment from pg_class c, pg_namespace n '
. 'where c.relkind = \'r\' and n.oid = c.relnamespace '
. 'order by c.relname';
}

/**
* Compile a fulltext index key command.
*
Expand Down

0 comments on commit 58055c2

Please sign in to comment.