Command Line Setup (CLI)
Generate a new File
Use the command, The classic template will automatically be added to your project main directory.
Default filename will be connection.js
Automatic configuration
npx presql --auto-config
Or use this, Replace --filename
with your own file name like: connection.js,dbconnection.js,config.js etc
Automatic configuration with custom filename
npx presql --auto-config --filename
You can type this command into Command Prompt, Powershell, Terminal, or any other integrated terminal of your code editor.
After that a file will be automatically created named as connection.js
, this file contains the configuration of the database connection.
More Commands
Upload Your SQL file to the database
npx presql db push
This require schema.sql
file in the presql
directory like (presql/schema.sql
). If you moved the configuration file to other directory please make sure to pass path in CLI.
it will use the root path of the current working directory where package.json file is located
npx presql db push ./path/to/[filename].[extension]
Create SQL file from the database
npx presql db pull
A new schema.sql
file in the presql
directory is created. (presql/schema.sql
)
Automatic configuration with custom filename
Evertime when you make changes in SQL file or in the database , dont forget to use run this command, this will help you handle PreSQL functionality more easily.
It will give suggestions , in method show tables
npx presql generate