Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Any artisan command that drops tables erroring with unknown function: pg_total_relation_size() #26

Merged
merged 3 commits into from
Dec 2, 2023
Merged

Conversation

wsamoht
Copy link
Contributor

@wsamoht wsamoht commented Dec 1, 2023

As of Laravel v10.34.0, any Artisan command that drops tables, errors with unknown function: pg_total_relation_size().

At least these three commands are affected:

  • db:wipe
  • migrate:fresh
  • migrate:refresh

This is due to PR #49020 that changed how the list of tables is loaded.

As far as I can tell, CRDB doesn't support getting table file size via SQL. There is an open issue here and corresponding PR to add pg_total_relation_size().

This PR overrides compileTables() hardcoding the table size to -1. -1 as size instead of pg_total_relation_size(c.oid) as size.

@wsamoht wsamoht requested a review from peterfox as a code owner December 1, 2023 19:44
Copy link
Collaborator

@peterfox peterfox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you can change the string quotes as suggested I think I can merge this in as it looks like it will fixes.

src/Schema/CockroachGrammar.php Outdated Show resolved Hide resolved
Copy link

codecov bot commented Dec 1, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (2a80c80) 87.30% compared to head (1c5516a) 88.23%.
Report is 3 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main      #26      +/-   ##
============================================
+ Coverage     87.30%   88.23%   +0.93%     
- Complexity       25       26       +1     
============================================
  Files             6        6              
  Lines            63       68       +5     
============================================
+ Hits             55       60       +5     
  Misses            8        8              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@peterfox peterfox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this ❤️

@peterfox peterfox merged commit 58055c2 into ylsideas:main Dec 2, 2023
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants