aboutsummaryrefslogtreecommitdiff
path: root/doc/dbs.tex
blob: 5436ffed20cf1a9e4a9bb066780e74a298a5ca9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
\documentclass[tikz]{standalone}
\usepackage{fontspec}
\setmainfont{Liberation Serif}
\setsansfont{Liberation Sans}
\setmonofont{Iosevka Term Slab}

\newcommand{\dumblang}[2]{{#1}}

\begin{document}
\usetikzlibrary{er}
\usetikzlibrary{calc}
\usetikzlibrary{positioning}
\usetikzlibrary{shapes}
\usetikzlibrary{shapes.multipart}
\tikzset{
  my table/.style={
    draw,
    minimum width=3.5cm,
    %% inner sep=0.2cm,
    execute at begin node=\strut,
    anchor=north west,
    font=\ttfamily,
    rectangle split,
    rectangle split allocate boxes=#1,
    rectangle split parts=#1,
    rectangle split part fill={blue!20,white},
    rectangle split part align={center, left},
    %% font=\itshape,
  }
}

\begin{tikzpicture}
  \node[anchor=south east] at (19,0) {\dumblang{TOTAL}{ИТОГО}: 236592};

  \node[my table=7] at (-1.5,-7) (students) {
    \nodepart{one}   2 - \dumblang{students}{студенты}
    \nodepart{two}   \underline{\dumblang{id}{id}}
    \nodepart{three} \dumblang{last\_name}{фамилия}
    \nodepart{four}  \dumblang{first\_name}{имя}
    \nodepart{five}  \dumblang{middle\_name}{отчество}
    \nodepart{six}   \dumblang{corporate\_email}{корпоративная\_почта}
    \nodepart{seven} \dumblang{group\_id}{группа\_id}
  }; \node[above=0.1cm of students.north west, anchor=south west] {6831};


  \node[my table=6] at (-1.5,0) (students-lab-assignments) {
    \nodepart{one}   4 - \dumblang{students\_lab\_assignments}{студенты\_назначения\_лаб}
    \nodepart{two}   \underline{\dumblang{id}{id}}
    \nodepart{three} \dumblang{student\_id}{студент\_id}
    \nodepart{four}  \dumblang{lab\_assignment\_id}{назначение\_лабы\_id}
    \nodepart{five}  \dumblang{date}{дата}
    \nodepart{six}   \dumblang{mark}{оценка}
  }; \node[above=0.1cm of students-lab-assignments.north west, anchor=south west] {205032};

  \node[my table=3] at (6,-2.66) (groups) {
    \nodepart{one}   1 - \dumblang{groups}{группы}
    \nodepart{two}   \underline{\dumblang{id}{id}}
    \nodepart{three} \dumblang{designator}{обозначение}
  }; \node[above=0.1cm of groups.north west, anchor=south west] {300};

  \node[my table=5] at (12,0) (lab-assignments) {
    \nodepart{one}   3 - \dumblang{lab\_assignments}{назначения\_лаб}
    \nodepart{two}   \underline{\dumblang{id}{id}}
    \nodepart{three} \dumblang{group\_id}{группа\_id}
    \nodepart{four}  \dumblang{lab\_id}{лаба\_id}
    \nodepart{five}  \dumblang{deadline}{срок}
  }; \node[above=0.1cm of lab-assignments.north west, anchor=south west] {5993};

  \node[my table=4] at (12,-4.2) (lab-assignments-teachers) {
    \nodepart{one}   4 - \dumblang{lab\_assignments\_teachers}{назначения\_лаб\_преподаватели}
    \nodepart{two}   \underline{\dumblang{id}{id}}
    \nodepart{three} \dumblang{lab\_assignment\_id}{назначение\_лабы\_id}
    \nodepart{four}  \dumblang{teacher\_id}{преподаватель\_id}
  }; \node[above=0.1cm of lab-assignments-teachers.north west, anchor=south west] {17926};

  \node[my table=4] at (6,-5.85) (labs) {
    \nodepart{one}   2 - \dumblang{labs}{лабы}
    \nodepart{two}   \underline{\dumblang{id}{id}}
    \nodepart{three} \dumblang{name}{название}
    \nodepart{four}  \dumblang{subject\_id}{предмет\_id}
  }; \node[above=0.1cm of labs.north west, anchor=south west] {401};

  \node[my table=3] at (6,-9.66)  (subjects) {
    \nodepart{one}   1 - \dumblang{subjects}{предметы}
    \nodepart{two}   \underline{\dumblang{id}{id}}
    \nodepart{three} \dumblang{name}{название}
  }; \node[above=0.1cm of subjects.north west, anchor=south west] {9};

  \node[my table=6] at (12,-7.66) (teachers) {
    \nodepart{one}   1 - \dumblang{teachers}{преподаватели}
    \nodepart{two}   \underline{\dumblang{id}{id}}
    \nodepart{three} \dumblang{last\_name}{фамилия}
    \nodepart{four}  \dumblang{first\_name}{имя}
    \nodepart{five}  \dumblang{middle\_name}{отчество}
    \nodepart{six}   \dumblang{corporate\_email}{корпоративная\_почта}
  }; \node[above=0.1cm of teachers.north west, anchor=south west] {100};

  \draw (students.seven east) -| node[at start,above right] {$\infty$} node[below, at end, rotate=90] {$15-30$} ($(students.seven east)!.7!(groups.two west)$) |- node[at end,above left] {$1$} (groups.two west);

  \draw (students-lab-assignments.three west) -| node[at start,above left ] {$\infty$} node[below, at end, rotate=90] {$0-3$} ([xshift=-0.75cm]$(students-lab-assignments.three west)!.5!(students.two west)$) |- node[at end,above left] {$1$} (students.two west);
  \draw (students-lab-assignments.four east)  -| node[at start,above right] {$\infty$} ($(students-lab-assignments.four east)!.15!(lab-assignments.two west)$)           |- node[at end,above left] {$1$} (lab-assignments.two west);

  \draw (labs.four east) -| node[at start,above right] {$\infty$} node[below, at end, rotate=90] {$30-100$} ([xshift=.75cm]$(labs.four east)!.5!(subjects.two east)$) |- node[at end,above right] {$1$} (subjects.two east);

  \draw (lab-assignments.three west)  -| node[at start,above left] {$\infty$} node[below, at end, rotate=90] {$15-25$} ($(lab-assignments.three west)!.66!(groups.two east)$)  |- node[at end,above right] {$1$} (groups.two east);
  \draw (lab-assignments.four west)  -| node[at start,above left] {$\infty$} ($(lab-assignments.four west)!.33!(labs.two east)$)  |- node[at end,above right] {$1$} (labs.two east);

  \draw (lab-assignments-teachers.three east) -| node[at start,above right] {$\infty$} ([xshift=0.75cm]$(lab-assignments-teachers.three east)$) |- node[at end,above right] {$1$} (lab-assignments.two east);
  \draw (lab-assignments-teachers.four east)  -| node[at start,above right] {$\infty$} ([xshift=0.75cm]$(lab-assignments-teachers.four east)$) |- node[below, midway, anchor=north west, rotate=90] {$1-5$} node[at end,above right] {$1$} (teachers.two east);
\end{tikzpicture}
\end{document}

%% Local Variables:
%% compile-command: "xelatex dbs.tex"
%% End: