DEV Community

Discussion on: User Authorization in NodeJS using PostgreSQL

Collapse
 
cide74 profile image
Régis BRUNET BLEC • Edited

hello great TUTO, but in your 'Users' table schema in PostgresSQL, there is an error there is no "," to

 '' password " varchar NOT NULL    ', '
); 
Enter fullscreen mode Exit fullscreen mode

otherwise the table does not work.

Here is my DataBase on ElephantSQL

BEGIN;

-- Data Table --
DROP TABLE IF EXISTS "users" CASCADE;

CREATE TABLE IF NOT EXISTS "users" (
     - serial PRIMARY KEY for unique id
     "id" SERIAL PRIMARY KEY,
     "name" text NOT NULL,
     "email" text NOT NULL UNIQUE,
     "phonenumber" text NOT NULL UNIQUE,
     "password" varchar NOT NULL
);

-- DataBase --
INSERT INTO "users" (
     "id",
     "name",
     "E-mail",
     "phonenumber",
     "password"
) VALUES

     (1, 'john', 'john.doe@email.zzz', 'phoneNumber', 'password');

COMMIT;
Enter fullscreen mode Exit fullscreen mode
Collapse
 
shreshthgoyal profile image
Shreshth Goyal • Edited

Hi! Thanks for the compliment, but this schema did work for me while creating my database diagram for this user authentication.
Also I'll look into it, thanks for the insights.