Back to results
Demo automated branching for managed postgres database using Neon and GH Actions.
- stars
- 100
- watchers
- 1
- forks
- 109
- open issues
- 1
- Last updated
- 02/27/2025
Demo automated branching for managed postgres database using Neon and GH Actions.
A simple Node.js application demonstrating database migrations with PostgreSQL using node-pg-migrate.
node-pg-migrate├── migrations/
│ └── 1698765432345_create-todos-table.js
├── .env.example
├── .env
├── index.js
├── package.json
└── README.md
npm install
.env file based on .env.example:
cp .env.example .env
.env file with your PostgreSQL connection details:
DATABASE_URL=postgres://username:password@localhost:5432/database_name
This project uses node-pg-migrate for managing database schema changes.
npm run migrate:up
npm run migrate:down
1698765432345_create-todos-table.js
todos table with:
id (Primary Key)title (varchar)completed (boolean)created_at (timestamp)Start the application:
npm start
The application will:
| Variable | Description | Example |
|---|---|---|
| DATABASE_URL | PostgreSQL connection URL | postgres://username:password@localhost:5432/todos |
.env file to version control.env.example file should not contain actual credentialsnpm start - Run the applicationnpm run migrate - Run database migrationsnpm run migrate:up - Apply pending migrationsnpm run migrate:down - Revert the last migrationpg - PostgreSQL client for Node.jsnode-pg-migrate - Database migration tooldotenv - Environment variable management