Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Б
БД 4 семестр проект
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Величко Арсений Александрович
БД 4 семестр проект
Commits
8c18a8d3
Commit
8c18a8d3
authored
Jun 23, 2022
by
Величко Арсений Александрович
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parents
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
289 additions
and
0 deletions
+289
-0
create-tables.sql
create-tables.sql
+289
-0
er-lusidchart.png
er-lusidchart.png
+0
-0
er-mysqlwb.png
er-mysqlwb.png
+0
-0
project-4.mwb
project-4.mwb
+0
-0
No files found.
create-tables.sql
0 → 100644
View file @
8c18a8d3
-- MySQL Script generated by MySQL Workbench
-- Чт 23 июн 2022 18:05:22
-- Model: New Model Version: 1.0
-- MySQL Workbench Forward Engineering
SET
@
OLD_UNIQUE_CHECKS
=@@
UNIQUE_CHECKS
,
UNIQUE_CHECKS
=
0
;
SET
@
OLD_FOREIGN_KEY_CHECKS
=@@
FOREIGN_KEY_CHECKS
,
FOREIGN_KEY_CHECKS
=
0
;
SET
@
OLD_SQL_MODE
=@@
SQL_MODE
,
SQL_MODE
=
'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'
;
-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------
CREATE
SCHEMA
IF
NOT
EXISTS
`mydb`
DEFAULT
CHARACTER
SET
utf8
;
USE
`mydb`
;
-- -----------------------------------------------------
-- Table `mydb`.`subjects`
-- -----------------------------------------------------
CREATE
TABLE
IF
NOT
EXISTS
`mydb`
.
`subjects`
(
`subj_id`
INT
NOT
NULL
AUTO_INCREMENT
,
`subj_name`
VARCHAR
(
50
)
NOT
NULL
,
`subj_description`
TEXT
NULL
,
PRIMARY
KEY
(
`subj_id`
))
ENGINE
=
InnoDB
;
-- -----------------------------------------------------
-- Table `mydb`.`lessons`
-- -----------------------------------------------------
CREATE
TABLE
IF
NOT
EXISTS
`mydb`
.
`lessons`
(
`lesson_id`
INT
NOT
NULL
AUTO_INCREMENT
,
`subj_id`
INT
NOT
NULL
,
`lesson_date`
DATETIME
NOT
NULL
,
`lesson_type`
ENUM
(
'pr'
,
'th'
)
NOT
NULL
,
`space_addr`
VARCHAR
(
150
)
NULL
,
PRIMARY
KEY
(
`lesson_id`
),
INDEX
`subj_id_idx`
(
`subj_id`
ASC
)
VISIBLE
,
CONSTRAINT
`subj_id_fk`
FOREIGN
KEY
(
`subj_id`
)
REFERENCES
`mydb`
.
`subjects`
(
`subj_id`
)
ON
DELETE
NO
ACTION
ON
UPDATE
NO
ACTION
)
ENGINE
=
InnoDB
;
-- -----------------------------------------------------
-- Table `mydb`.`positions`
-- -----------------------------------------------------
CREATE
TABLE
IF
NOT
EXISTS
`mydb`
.
`positions`
(
`pos_id`
INT
NOT
NULL
AUTO_INCREMENT
,
`pos_name`
VARCHAR
(
50
)
NOT
NULL
,
`description`
TEXT
NULL
,
PRIMARY
KEY
(
`pos_id`
))
ENGINE
=
InnoDB
;
-- -----------------------------------------------------
-- Table `mydb`.`personnel`
-- -----------------------------------------------------
CREATE
TABLE
IF
NOT
EXISTS
`mydb`
.
`personnel`
(
`pers_id`
INT
NOT
NULL
AUTO_INCREMENT
,
`fio`
VARCHAR
(
75
)
NOT
NULL
,
`pos_id`
INT
NULL
,
`rank`
VARCHAR
(
50
)
NULL
,
`dob`
DATE
NULL
,
`license_no`
VARCHAR
(
50
)
NULL
,
`password_hash`
VARCHAR
(
50
)
NOT
NULL
,
PRIMARY
KEY
(
`pers_id`
),
INDEX
`pos_id_fk_idx`
(
`pos_id`
ASC
)
VISIBLE
,
CONSTRAINT
`pos_id_fk`
FOREIGN
KEY
(
`pos_id`
)
REFERENCES
`mydb`
.
`positions`
(
`pos_id`
)
ON
DELETE
NO
ACTION
ON
UPDATE
NO
ACTION
)
ENGINE
=
InnoDB
;
-- -----------------------------------------------------
-- Table `mydb`.`lesson_attendance`
-- -----------------------------------------------------
CREATE
TABLE
IF
NOT
EXISTS
`mydb`
.
`lesson_attendance`
(
`attendance_id`
INT
NOT
NULL
AUTO_INCREMENT
,
`lesson_id`
INT
NOT
NULL
,
`pers_id`
INT
NOT
NULL
,
`attended`
TINYINT
NOT
NULL
,
PRIMARY
KEY
(
`attendance_id`
),
INDEX
`lesson_id_fk_idx`
(
`lesson_id`
ASC
)
VISIBLE
,
INDEX
`pers_id_fk_idx`
(
`pers_id`
ASC
)
VISIBLE
,
CONSTRAINT
`lesson_id_fk`
FOREIGN
KEY
(
`lesson_id`
)
REFERENCES
`mydb`
.
`lessons`
(
`lesson_id`
)
ON
DELETE
NO
ACTION
ON
UPDATE
NO
ACTION
,
CONSTRAINT
`pers_id_fk`
FOREIGN
KEY
(
`pers_id`
)
REFERENCES
`mydb`
.
`personnel`
(
`pers_id`
)
ON
DELETE
NO
ACTION
ON
UPDATE
NO
ACTION
)
ENGINE
=
InnoDB
;
-- -----------------------------------------------------
-- Table `mydb`.`access_control`
-- -----------------------------------------------------
CREATE
TABLE
IF
NOT
EXISTS
`mydb`
.
`access_control`
(
`rule_id`
INT
NOT
NULL
AUTO_INCREMENT
,
`pers_id`
INT
NULL
,
`pos_id`
INT
NULL
,
`table_name`
VARCHAR
(
50
)
NOT
NULL
,
`allowed`
TINYINT
NOT
NULL
,
`reason`
TINYTEXT
NULL
,
PRIMARY
KEY
(
`rule_id`
),
INDEX
`pers_id_fk_idx`
(
`pers_id`
ASC
)
VISIBLE
,
INDEX
`pos_id_fk_idx`
(
`pos_id`
ASC
)
VISIBLE
,
CONSTRAINT
`pers_id_fk`
FOREIGN
KEY
(
`pers_id`
)
REFERENCES
`mydb`
.
`personnel`
(
`pers_id`
)
ON
DELETE
NO
ACTION
ON
UPDATE
NO
ACTION
,
CONSTRAINT
`pos_id_fk`
FOREIGN
KEY
(
`pos_id`
)
REFERENCES
`mydb`
.
`positions`
(
`pos_id`
)
ON
DELETE
NO
ACTION
ON
UPDATE
NO
ACTION
)
ENGINE
=
InnoDB
;
-- -----------------------------------------------------
-- Table `mydb`.`operations`
-- -----------------------------------------------------
CREATE
TABLE
IF
NOT
EXISTS
`mydb`
.
`operations`
(
`op_id`
INT
NOT
NULL
AUTO_INCREMENT
,
`started_at`
DATETIME
NOT
NULL
,
`ended_at`
DATETIME
NOT
NULL
,
`rescued_cnt`
INT
NULL
,
`evacuated_cnt`
INT
NULL
,
`dead_cnt`
INT
NULL
,
`op_addr`
VARCHAR
(
150
)
NOT
NULL
,
`op_type`
ENUM
(
'Fire'
,
'Other emergency'
)
NOT
NULL
,
PRIMARY
KEY
(
`op_id`
))
ENGINE
=
InnoDB
;
-- -----------------------------------------------------
-- Table `mydb`.`operation_events`
-- -----------------------------------------------------
CREATE
TABLE
IF
NOT
EXISTS
`mydb`
.
`operation_events`
(
`op_event_id`
INT
NOT
NULL
AUTO_INCREMENT
,
`op_id`
INT
NOT
NULL
,
`pers_id`
INT
NOT
NULL
,
`role`
ENUM
(
'Leader'
,
'Crew'
)
NOT
NULL
,
PRIMARY
KEY
(
`op_event_id`
),
INDEX
`op_id_fk_idx`
(
`op_id`
ASC
)
VISIBLE
,
INDEX
`pers_id_fk_idx`
(
`pers_id`
ASC
)
VISIBLE
,
CONSTRAINT
`op_id_fk`
FOREIGN
KEY
(
`op_id`
)
REFERENCES
`mydb`
.
`operations`
(
`op_id`
)
ON
DELETE
NO
ACTION
ON
UPDATE
NO
ACTION
,
CONSTRAINT
`pers_id_fk`
FOREIGN
KEY
(
`pers_id`
)
REFERENCES
`mydb`
.
`personnel`
(
`pers_id`
)
ON
DELETE
NO
ACTION
ON
UPDATE
NO
ACTION
)
ENGINE
=
InnoDB
;
-- -----------------------------------------------------
-- Table `mydb`.`transport`
-- -----------------------------------------------------
CREATE
TABLE
IF
NOT
EXISTS
`mydb`
.
`transport`
(
`tr_id`
INT
NOT
NULL
AUTO_INCREMENT
,
`license_plate`
VARCHAR
(
15
)
NOT
NULL
,
`tr_type`
ENUM
(
'Fire truck'
,
'Gas truck'
,
'Trailer'
,
'Other'
)
NOT
NULL
,
`manufacturer`
VARCHAR
(
50
)
NOT
NULL
,
`manufactured_date`
DATE
NOT
NULL
,
`comissioned_date`
DATE
NOT
NULL
,
PRIMARY
KEY
(
`tr_id`
))
ENGINE
=
InnoDB
;
-- -----------------------------------------------------
-- Table `mydb`.`transport_usage`
-- -----------------------------------------------------
CREATE
TABLE
IF
NOT
EXISTS
`mydb`
.
`transport_usage`
(
`tr_event_id`
INT
NOT
NULL
AUTO_INCREMENT
,
`tr_id`
INT
NOT
NULL
,
`op_id`
INT
NULL
,
`pers_id`
INT
NOT
NULL
,
`comment`
TINYTEXT
NULL
,
PRIMARY
KEY
(
`tr_event_id`
),
INDEX
`tr_id_fk_idx`
(
`tr_id`
ASC
)
VISIBLE
,
INDEX
`op_id_fk_idx`
(
`op_id`
ASC
)
VISIBLE
,
INDEX
`pers_id_fk_idx`
(
`pers_id`
ASC
)
VISIBLE
,
CONSTRAINT
`tr_id_fk`
FOREIGN
KEY
(
`tr_id`
)
REFERENCES
`mydb`
.
`transport`
(
`tr_id`
)
ON
DELETE
NO
ACTION
ON
UPDATE
NO
ACTION
,
CONSTRAINT
`op_id_fk`
FOREIGN
KEY
(
`op_id`
)
REFERENCES
`mydb`
.
`operations`
(
`op_id`
)
ON
DELETE
NO
ACTION
ON
UPDATE
NO
ACTION
,
CONSTRAINT
`pers_id_fk`
FOREIGN
KEY
(
`pers_id`
)
REFERENCES
`mydb`
.
`personnel`
(
`pers_id`
)
ON
DELETE
NO
ACTION
ON
UPDATE
NO
ACTION
)
ENGINE
=
InnoDB
;
-- -----------------------------------------------------
-- Table `mydb`.`abbreviations`
-- -----------------------------------------------------
CREATE
TABLE
IF
NOT
EXISTS
`mydb`
.
`abbreviations`
(
`abbr_id`
INT
NOT
NULL
AUTO_INCREMENT
,
`abbr`
VARCHAR
(
50
)
NOT
NULL
,
`stands_for`
TINYTEXT
NOT
NULL
,
`additional_info`
TEXT
NULL
,
PRIMARY
KEY
(
`abbr_id`
))
ENGINE
=
InnoDB
;
-- -----------------------------------------------------
-- Table `mydb`.`attestations`
-- -----------------------------------------------------
CREATE
TABLE
IF
NOT
EXISTS
`mydb`
.
`attestations`
(
`att_id`
INT
NOT
NULL
AUTO_INCREMENT
,
`pers_id`
INT
NOT
NULL
,
`examiner_id`
INT
NOT
NULL
,
`passed`
TINYINT
NOT
NULL
,
`att_date`
DATETIME
NOT
NULL
,
`att_type`
ENUM
(
'Exam'
,
'Test'
,
'Simulation'
,
'Traning'
,
'Other'
)
NOT
NULL
,
`failed_reason`
TEXT
NULL
,
PRIMARY
KEY
(
`att_id`
),
INDEX
`pers_id_fk_idx`
(
`pers_id`
ASC
)
VISIBLE
,
INDEX
`exam_id_fk_idx`
(
`examiner_id`
ASC
)
VISIBLE
,
CONSTRAINT
`pers_id_fk`
FOREIGN
KEY
(
`pers_id`
)
REFERENCES
`mydb`
.
`personnel`
(
`pers_id`
)
ON
DELETE
NO
ACTION
ON
UPDATE
NO
ACTION
,
CONSTRAINT
`exam_id_fk`
FOREIGN
KEY
(
`examiner_id`
)
REFERENCES
`mydb`
.
`personnel`
(
`pers_id`
)
ON
DELETE
NO
ACTION
ON
UPDATE
NO
ACTION
)
ENGINE
=
InnoDB
;
-- -----------------------------------------------------
-- Table `mydb`.`lesson_reports`
-- -----------------------------------------------------
CREATE
TABLE
IF
NOT
EXISTS
`mydb`
.
`lesson_reports`
(
`ln_report_id`
INT
NOT
NULL
AUTO_INCREMENT
,
`subj_id`
INT
NOT
NULL
,
`report`
TEXT
NOT
NULL
,
`th_lessons_plan`
INT
NOT
NULL
,
`pr_lessons_plan`
INT
NOT
NULL
,
`th_lessons_fact`
INT
NOT
NULL
,
`pr_lessons_fact`
INT
NOT
NULL
,
`period_start`
DATE
NOT
NULL
,
`period_end`
DATE
NOT
NULL
,
`report_date`
DATE
NOT
NULL
,
`pers_id`
INT
NOT
NULL
,
PRIMARY
KEY
(
`ln_report_id`
),
INDEX
`subj_id_fk_idx`
(
`subj_id`
ASC
)
VISIBLE
,
INDEX
`pers_id_fk_idx`
(
`pers_id`
ASC
)
VISIBLE
,
CONSTRAINT
`subj_id_fk`
FOREIGN
KEY
(
`subj_id`
)
REFERENCES
`mydb`
.
`subjects`
(
`subj_id`
)
ON
DELETE
NO
ACTION
ON
UPDATE
NO
ACTION
,
CONSTRAINT
`pers_id_fk`
FOREIGN
KEY
(
`pers_id`
)
REFERENCES
`mydb`
.
`personnel`
(
`pers_id`
)
ON
DELETE
NO
ACTION
ON
UPDATE
NO
ACTION
)
ENGINE
=
InnoDB
;
SET
SQL_MODE
=@
OLD_SQL_MODE
;
SET
FOREIGN_KEY_CHECKS
=@
OLD_FOREIGN_KEY_CHECKS
;
SET
UNIQUE_CHECKS
=@
OLD_UNIQUE_CHECKS
;
er-lusidchart.png
0 → 100644
View file @
8c18a8d3
509 KB
er-mysqlwb.png
0 → 100644
View file @
8c18a8d3
182 KB
project-4.mwb
0 → 100644
View file @
8c18a8d3
File added
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment