Skip to content

nekushi/postgres-cli-localhost-template

Repository files navigation

Template for postgres in cli using Nextjs.

We are assuming that you already have Postgres in your device. To check, try to run psql --version in your cli to see your current psql version.

Install:

  • npm i
  • npm i pg
  • npm i --save-dev @types/pg

Things to do:

  • .env* to the .gitignore
  • EDIT your env file: change those parameters within the angle brackets.

PSQL commands:

  • psql -U postgres // to connect to your postgres localhost
  • \l // show list of databases
  • CREATE DATABASE <dbName>; // to create db
  • \c <dbName> // to connect to database
  • \dn // show list of schemas
  • SET search_path to <your-schema>; // to connect to you schema
  • SHOW search_path; // show current schema
  • \dt // show list of tables within that schema
  • SQL commands // eg. SELECT * FROM full.schema;
  • \q // to quit or terminate cli
  • \! cls // clear cli

About

a pre-made template to execute postgres cli in your nextjs projects.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors