@saasak/tool-supa
v0.0.9
Published
A small util to manage supabase
Readme
How to use
This is simple (albeit still barebone)
- Add
"db:deploy": "supa deploy"to your package.json at root - Add
"db:seed": "supa seed"to your package.json at root - Add
"db:extensions": "supa ext"to your package.json at root And finally, - Add
"db:reset": "supabase start && supabase db reset && pnpm -s run db:extensions && pnpm -s run db:seed"to it too !
You'll obviously need to leave out the default seeding script seed.sql inside your supabase directory.
Inside your supabase directory, you will need:
- seeds/
- 00-configs.sql
- 01-whatever.sql
- 02-these-are-obviously-whatever.sql
- extensions/
- auth/
- 00-first-step.sql
- 01-second-step.sql
- _enable.sql
- logging/
- 00-first-step.sql
- _enable.sql
- auth/
Notes
- In the extensions directory, extensions will be installed in the alphabetical order of the directories, and then the files inside each directory will be executed in the order they are named.
- In the extensions directory, the
_enable.sqlfile will be executed first to know if the extension needs to run again. There is a--forceflag tosupa extwhich allows to disregard the result of this script. This script must returntrueif the extension is already installed, andfalseif not. - The tool now uses Node.js
pglibrary instead of thepsqlbinary, making it more portable and easier to deploy.
Available Options
--debug- Enable debug output for all commands--force- Force execution (for extensions, disregards enable check)
