Does the TLE layer still add value now that dbdev generates migration files? #389
point-source
started this conversation in
General
Replies: 1 comment
-
|
Thanks for starting this discussion @point-source. You raise some valid points. We are re-evaluating whether pg_tle is really required and having internal discussion about this. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Is dbdev still solving a problem? If so, what problem is it solving?
Context
I maintain https://github.com/point-source/supabase-tenant-rbac, a package distributed via database.dev. I've been working through several user-reported issues that all trace back to the same root cause: objects created via CREATE EXTENSION are registered as extension members in pg_depend, which causes standard PostgreSQL tooling to skip them.
The problems I and my users encounter
These aren't edge cases, they're core local development and operational workflows. See point-source/supabase-tenant-rbac#23 and point-source/supabase-tenant-rbac#41 on my repo for real user impact.
My question
With the deprecated in-database client, there was a clear reason for pg_tle: users ran dbdev.install(...) directly in their database, so TLE was the delivery mechanism. But now that the recommended workflow is
dbdev add, which generates a migration file, the TLE layer sits between the user and what they actually need, which is plain SQL objects in their database. Why are we using a cli tool to generate migration files that pretty much just take normal migration files and wrap them in a pg_tle extension?The current flow:
The alternative flow:
Both flows end with a migration file. The only difference is whether the SQL inside is wrapped in TLE or not. The TLE wrapping is what causes the tooling breakage.
What TLE provides vs. what it costs
Benefits of the TLE layer:
generate an upgrade migration just as easily.
Costs:
Proposal
Could dbdev add have an option (or even a new default) to generate plain SQL migrations instead of TLE-wrapped ones? The CLI already fetches the package SQL from the registry — it would just need to resolve @extschema@ to the target schema and emit the raw DDL.
The registry, CLI, and versioning model all remain valuable. It's specifically the TLE install mechanism in the generated migration that causes problems.
For upgrades, dbdev upgrade could generate a migration containing only the diff (ALTER/CREATE OR REPLACE statements), which is what package authors already write as upgrade path scripts.
Am I missing something?
Beta Was this translation helpful? Give feedback.
All reactions