Refactor to use SpringJPA
This commit is contained in:
21
db/docker-compose.yml
Normal file
21
db/docker-compose.yml
Normal file
@ -0,0 +1,21 @@
|
||||
version: '3.8'
|
||||
services:
|
||||
cc-database:
|
||||
image: postgres
|
||||
restart: always
|
||||
environment:
|
||||
POSTGRES_USER: biblenotes
|
||||
POSTGRES_PASSWORD: ujhfdogiuhfdgiusdfhoviufdnpviusdhdfiuqbfoiudzsfzidfugofduszbdv
|
||||
POSTGRES_DB: biblenotes
|
||||
volumes:
|
||||
- ./sql-scripts:/docker-entrypoint-initdb.d
|
||||
ports:
|
||||
- "5432:5432"
|
||||
|
||||
adminer:
|
||||
image: adminer
|
||||
restart: always
|
||||
environment:
|
||||
ADMINER_DEFAULT_SERVER: biblenotes
|
||||
ports:
|
||||
- "8081:8081"
|
19
db/sql-scripts/init.sql
Normal file
19
db/sql-scripts/init.sql
Normal file
@ -0,0 +1,19 @@
|
||||
CREATE TABLE users
|
||||
(
|
||||
id SERIAL PRIMARY KEY,
|
||||
username VARCHAR(255) UNIQUE NOT NULL,
|
||||
password VARCHAR(255) NOT NULL,
|
||||
email VARCHAR(255) UNIQUE NOT NULL,
|
||||
role VARCHAR(255) NOT NULL,
|
||||
created_at TIMESTAMP NOT NULL,
|
||||
updated_at TIMESTAMP NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE user_logins
|
||||
(
|
||||
id SERIAL PRIMARY KEY,
|
||||
user_id BIGINT NOT NULL,
|
||||
login_time TIMESTAMP NOT NULL,
|
||||
login_ip VARCHAR(255) NOT NULL,
|
||||
FOREIGN KEY (user_id) REFERENCES users (id)
|
||||
);
|
Reference in New Issue
Block a user