- Published on
CS06 - Adding PostgreSQL
- Authors
 - Name
- MDolce
 
 
Table of Contents
Problems we need to solve:
Adding a PostgresSQL database using @vercel/postgres
Also, because of this error message:
Solution:
- Import the project to GitHub
- Connect and deploy the project to a Vercel account
- Create a new Storefrom the project dashboard in Vercel
- Install Vercel CLI and postgres package npm i -g vercel @vercel/postgres
- Select Postgres Serverless SQL
- Accept terms, assign a database name then select a region
- Copy .env.local snippet to a .env project file
- Update .gitignore and add .env
Seed data
roles-placeholder-data-js
const roles = [
  {
    rolename: 'guest', //unconfirmed registration
  },
{
    rolename: 'subscriber', //confirmed registration, unpaid membership
  },
{
    rolename: 'member', //confirmed registration, paid membership
  },
{
    rolename: 'author', //confirmed registration, approved author
  },
{
    rolename: 'admin', // one
  },
];
users-placeholder-data-js
const { db } = require('@vercel/postgres');
const {
 users,