-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FR-#4.0] Add docker.yaml && sql files for initial DB version
- Loading branch information
Showing
4 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
version: "3" | ||
|
||
services: | ||
data-base: | ||
image: postgres | ||
restart: unless-stopped | ||
environment: | ||
- POSTGRES_DB=rpa-DB | ||
- POSTGRES_USER=postgres | ||
- POSTGRES_PASSWORD=postgres | ||
- POSTGRES_MAX_CONNECTIONS=2000 | ||
ports: | ||
- "7777:5432" | ||
volumes: | ||
- ./modules/harmonist/src/main/sql/create_database.sql:/docker-entrypoint-initdb.d/01_init.sql | ||
- ./modules/harmonist/src/main/sql/insert_database.sql:/docker-entrypoint-initdb.d/02_insert_values.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
spring: | ||
application: | ||
name: rpa | ||
datasource: | ||
url: jdbc:postgresql://localhost:7777/rpa-DB | ||
driverClassName: org.postgresql.Driver | ||
username: postgres | ||
password: postgres | ||
jpa: | ||
show-sql: true | ||
hibernate: | ||
ddl-auto: update | ||
springdoc: | ||
swagger-ui: | ||
path: /swagger/src | ||
api-docs: | ||
path: /swagger/docs | ||
token: | ||
signing: | ||
key: 53A73E5F1C4E0A2D3B5F2D784E6A1B423D6F247D1F6E5C3A596D635A75327855 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
CREATE TABLE IF NOT EXISTS users ( | ||
id serial PRIMARY KEY, | ||
nickname varchar NOT NULL UNIQUE, | ||
email varchar NOT NULL UNIQUE, | ||
password varchar NOT NULL, | ||
phone varchar NULL UNIQUE, | ||
role varchar NOT NULL DEFAULT ('user') | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS groups ( | ||
id serial PRIMARY KEY, | ||
leader integer REFERENCES users (id), | ||
name varchar NOT NULL UNIQUE, | ||
description text NOT NULL | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS participants ( | ||
user_id integer REFERENCES users (id), | ||
group_id integer REFERENCES groups (id), | ||
status integer NOT NULL, | ||
|
||
PRIMARY KEY (user_id, group_id) | ||
); | ||
|
||
|
||
CREATE TABLE IF NOT EXISTS scripts ( | ||
id serial PRIMARY KEY, | ||
code text NOT NULL, | ||
name varchar NOT NULL, | ||
description text NOT NULL, | ||
input_data jsonb NOT NULL, | ||
|
||
version varchar NOT NULL, | ||
created timestamp, | ||
creator integer REFERENCES users (id) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS authors ( | ||
user_id integer REFERENCES users (id), | ||
script_id integer REFERENCES scripts (id), | ||
|
||
PRIMARY KEY (user_id, script_id) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS executors ( | ||
group_id integer REFERENCES groups (id), | ||
script_id integer REFERENCES scripts (id), | ||
|
||
PRIMARY KEY (group_id, script_id) | ||
); | ||
|
||
CREATE TABLE IF NOT EXISTS actions ( | ||
user_id integer REFERENCES users (id), | ||
script_id integer REFERENCES scripts (id), | ||
time_begin timestamp NOT NULL, | ||
time_exec timestamp DEFAULT (NULL), | ||
input_data varchar NULL, | ||
|
||
PRIMARY KEY (user_id, script_id, time_begin, time_exec) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
INSERT INTO users (nickname, email, password, phone) | ||
VALUES ('IThror', '[email protected]', '12345', '8-800'), | ||
('Alien', '[email protected]', 'qwerty', '8-700'), | ||
('Tutor', '[email protected]', '1q2w3e', '8-600'); | ||
|
||
INSERT INTO groups (leader, name, description) | ||
VALUES (1, 'Itmo SE Students', '2023/2025 Itmo SE Students group'), | ||
(3, 'Itmo SE Tutors', 'ITMO SE Tutors'); | ||
|
||
INSERT INTO participants (user_id, group_id, status) | ||
VALUES (1, 1, 0), -- Editor | ||
(2, 1, 1), -- User | ||
(3, 2, 0); |