Skip to content

mw10013/art_of_postgresql

Repository files navigation

Art of Postgresql databases and queries with Supabase local db

  • Uses pnpm and supabase local db

Supabase CLI

Install via NPM, Supabase Local Development

  • pnpm add -D supabase
  • pnpm supabase -h
  • pnpm supabase init
  • pnpm supabase start | stop | status
  • pnpm supabase db diff --use-migra --file [file_name]
  • pnpm supabase db reset --debug
  • pnpm supabase db branch create | delete | list | switch
  • psql: \i supabase/seed.sql
  • psql postgresql://postgres:postgres@localhost:54322/postgres

Factbook Database

pg_restore -v -d postgresql://postgres:postgres@localhost:54322 --create factbook/factbook_db.dump
psql postgresql://postgres:postgres@localhost:54322/factbook
  • cd factbook
  • psql postgresql://postgres:postgres@localhost:54322/postgres
  • create database factbook;
  • \c factbook
  • \i factbook_setup.sql
  • pg_dump -Fc -v -f factbook_db.dump postgresql://postgres:postgres@localhost:54322/factbook
  • pg_dump -v -f factbook_db.sql postgresql://postgres:postgres@localhost:54322/factbook

Chinook Database

pg_restore -v -d postgresql://postgres:postgres@localhost:54322 --create chinook/chinook_db.dump
psql postgresql://postgres:postgres@localhost:54322/chinook

F1DB Database

pg_restore -v -d postgresql://postgres:postgres@localhost:54322 --create f1db/f1db_db.dump
psql postgresql://postgres:postgres@localhost:54322/f1db

Access Database

  • create database access;
  • psql postgresql://postgres:postgres@localhost:54322/access

Access Prisma Database

createdb --echo --owner postgres -T template0 --maintenance-db postgresql://postgres:postgres@localhost:54322/postgres access_prisma
pg_restore -v -d postgresql://postgres:postgres@localhost:54322/access_prisma access_prisma/access_prisma_db_20221015.dump
  • pg_restore -v --schema-only --file access_prisma/access_prisma_schema_20221015.sql access/access_db_20221015.dump
  • pg_restore -v --data-only --file access_prisma/access_prisma_data_20221015.sql access_prisma/access_prisma_db_20221015.dump

PostgreSQL VSC Extension

pgFormatter VSC Extension

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published