Skip to content

Commit

Permalink
Merge pull request #70 from JimTheCat/CU-8696y6vhb_Create-database_Ki…
Browse files Browse the repository at this point in the history
…nga-Traczyk

Cu 8696y6vhb create database kinga traczyk
  • Loading branch information
KinTrae authored Dec 8, 2024
2 parents d02b2f9 + 294cc53 commit bef37de
Show file tree
Hide file tree
Showing 20 changed files with 1,387 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
# MeowHub
Engineering Thesis

## Database
If you don't have a created database yet, run script `database/install.sql`.

## Profiles
`d​ev` - to run application with H2 database and enabled swagger

## Swagger
To run swagger use `d​ev` profile.
Link to swagger documentation: http://localhost:8080/swagger-ui/index.html
28 changes: 28 additions & 0 deletions database/install.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
WHENEVER SQLERROR EXIT SQL.SQLCODE;

--drop
@scripts/000_drop_schemas.sql
@scripts/010_drop_profiles.sql

--create
@scripts/100_create_profiles.sql
@scripts/110_create_schemas.sql
@scripts/120_create_tables.sql
@scripts/121_create_h_tables.sql
@scripts/130_grant_references.sql
@scripts/140_create_references.sql
@scripts/150_grant_permissions_to_meowhub.sql
@scripts/160_create_indexes.sql

--plsql objects
@scripts/300_set_session_attributes.pls
@scripts/310_clear_session_attributes.pls
@scripts/320_get_user_id.pls
@scripts/321_grant_execute_on_get_user_id.sql

--triggers
@scripts/400_create_audit_triggers.sql
@scripts/401_create_h_tables_triggers.sql

--insert
@scripts/500_insert_dictionaries.sql
8 changes: 8 additions & 0 deletions database/scripts/000_drop_schemas.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
DROP USER mh_meowhub CASCADE;
DROP USER mh_posts CASCADE;
DROP USER mh_profiles CASCADE;
DROP USER mh_matching CASCADE;
DROP USER mh_groups CASCADE;
DROP USER mh_users CASCADE;
DROP USER mh_user_relations CASCADE;
DROP USER mh_chats CASCADE;
1 change: 1 addition & 0 deletions database/scripts/010_drop_profiles.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DROP PROFILE mh_profile;
7 changes: 7 additions & 0 deletions database/scripts/100_create_profiles.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CREATE PROFILE mh_profile LIMIT
PASSWORD_LIFE_TIME UNLIMITED
PASSWORD_VERIFY_FUNCTION NULL
SESSIONS_PER_USER UNLIMITED
CPU_PER_SESSION 300
CONNECT_TIME 60
IDLE_TIME 5;
23 changes: 23 additions & 0 deletions database/scripts/110_create_schemas.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
CREATE USER mh_meowhub IDENTIFIED BY "Mwhb2024!" PROFILE mh_profile;
GRANT CONNECT, RESOURCE TO mh_meowhub;

CREATE USER mh_chats IDENTIFIED BY "Mwhb2024!mwhb" ACCOUNT LOCK;
ALTER USER mh_chats QUOTA 200M ON DATA;

CREATE USER mh_groups IDENTIFIED BY "Mwhb2024!mwhb" ACCOUNT LOCK;
ALTER USER mh_groups QUOTA 50M ON DATA;

CREATE USER mh_users IDENTIFIED BY "Mwhb2024!mwhb" ACCOUNT LOCK;
ALTER USER mh_users QUOTA 100M ON DATA;

CREATE USER mh_matching IDENTIFIED BY "Mwhb2024!mwhb" ACCOUNT LOCK;
ALTER USER mh_matching QUOTA 100M ON DATA;

CREATE USER mh_posts IDENTIFIED BY "Mwhb2024!mwhb" ACCOUNT LOCK;
ALTER USER mh_posts QUOTA 200M ON DATA;

CREATE USER mh_profiles IDENTIFIED BY "Mwhb2024!mwhb" ACCOUNT LOCK;
ALTER USER mh_profiles QUOTA 200M ON DATA;

CREATE USER mh_user_relations IDENTIFIED BY "Mwhb2024!mwhb" ACCOUNT LOCK;
ALTER USER mh_user_relations QUOTA 50M ON DATA;
Loading

0 comments on commit bef37de

Please sign in to comment.