29 lines
1.3 KiB
SQL
29 lines
1.3 KiB
SQL
CREATE TABLE IF NOT EXISTS users (
|
|
id SERIAL PRIMARY KEY,
|
|
name VARCHAR(255) NOT NULL,
|
|
email VARCHAR(255) UNIQUE NOT NULL,
|
|
password_hash TEXT NOT NULL,
|
|
reset_token TEXT NULL,
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS sneakers(
|
|
id SERIAL PRIMARY KEY,
|
|
name VARCHAR(255) NOT NULL,
|
|
description VARCHAR(255) NOT NULL,
|
|
cost DECIMAL(10,2) NOT NULL,
|
|
discount INTEGER NOT NULL CHECK (discount >= 0 AND discount <= 100),
|
|
photo VARCHAR(255) NOT NULL,
|
|
gender CHAR(1) NOT NULL CHECK (gender IN ('M', 'F', 'U')),
|
|
bootSize INTEGER NOT NULL
|
|
);
|
|
|
|
INSERT INTO sneakers (name, description, cost, discount, photo, gender, bootSize)
|
|
VALUES ('Adidas', 'fast', 120.50, 10, 'https://i8.amplience.net/i/jpl/jd_619310_a?qlt=92', 'M', 42);
|
|
|
|
INSERT INTO sneakers (name, description, cost, discount, photo, gender, bootSize)
|
|
VALUES ('Nike Air Max', 'Comfortable running shoes', 140, 40, 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRe7ZbQ92u1JD-JgD4Kkhkju83p_uvKelP5jw&s', 'F', 39);
|
|
|
|
INSERT INTO sneakers (name, description, cost, discount, photo, gender, bootSize)
|
|
VALUES ('Puma', 'fast too', 80.12, 80, 'https://img01.ztat.net/article/spp-media-p1/c6ebc4348bd34d9fa4235a82453230fe/3c034c2c43b94d879d41d33d0eb18e14.jpg?imwidth=1800&filter=packshot', 'U', 41);
|