-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlibrary.dbs
135 lines (135 loc) · 6.43 KB
/
library.dbs
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<?xml version="1.0" encoding="UTF-8" ?>
<project name="library" id="Project_158c" database="PostgreSQL" >
<schema name="library" >
<table name="book" prior="library" >
<column name="id" type="serial" jt="4" mandatory="y" />
<column name="title" prior="name" type="varchar" jt="12" mandatory="y" />
<column name="authors" prior="author_id" type="varchar[]" jt="2003" mandatory="y" />
<column name="description" type="text" jt="12" />
<column name="language" prior="lang" type="varchar" length="20" jt="12" />
<column name="published" type="integer" jt="4" >
<comment><![CDATA[Year of published]]></comment>
</column>
<column name="publisher" prior="house_id" type="varchar" jt="12" >
<comment><![CDATA[Publishing house]]></comment>
</column>
<column name="cover" prior="cover_lg" type="text" jt="12" />
<column name="categories" prior="tags" type="varchar[]" jt="2003" />
<column name="created_by" prior="added_by" type="integer" jt="4" mandatory="y" >
<comment><![CDATA[The reader who added the book]]></comment>
</column>
<column name="created_at" prior="added_at" type="date" jt="91" mandatory="y" >
<comment><![CDATA[Date added to library]]></comment>
</column>
<column name="available_date" type="date" jt="91" />
<column name="pagecount" type="integer" jt="4" />
<column name="preview_url" type="varchar" jt="12" />
<column name="status" prior="status_id" type="varchar" length="10" jt="12" mandatory="y" >
<comment><![CDATA[Status of the book (added, ordered, available, rented, deleted)]]></comment>
</column>
<index name="pk_book_id" unique="PRIMARY_KEY" >
<column name="id" />
</index>
</table>
<table name="booking" prior="reading" >
<column name="id" type="serial" jt="4" mandatory="y" />
<column name="member_id" prior="reader_id" type="integer" jt="4" mandatory="y" />
<column name="book_id" type="integer" jt="4" mandatory="y" />
<column name="booking_from" prior="planned_from" type="date" jt="91" />
<column name="booking_until" prior="planned_until" type="date" jt="91" />
<column name="created_at" prior="booking_date" type="date" jt="91" mandatory="y" />
<index name="pk_booking_id" unique="PRIMARY_KEY" >
<column name="id" />
</index>
<fk name="fk_booking_book" to_schema="library" to_table="book" delete_action="cascade" >
<fk_column name="book_id" pk="id" />
</fk>
<fk name="fk_booking_reader" to_schema="library" to_table="member" delete_action="cascade" >
<fk_column name="member_id" pk="id" />
</fk>
</table>
<table name="haveread" prior="wish_0" >
<column name="member_id" type="integer" jt="4" mandatory="y" />
<column name="book_id" type="integer" jt="4" mandatory="y" />
<index name="idx_wish_0" unique="PRIMARY_KEY" >
<column name="member_id" />
<column name="book_id" />
</index>
<fk name="fk_wish_member_0" to_schema="library" to_table="member" delete_action="cascade" >
<fk_column name="member_id" pk="id" />
</fk>
<fk name="fk_wish_book_0" to_schema="library" to_table="book" delete_action="cascade" >
<fk_column name="book_id" pk="id" />
</fk>
</table>
<table name="member" prior="reader" >
<column name="id" type="serial" jt="4" mandatory="y" />
<column name="name" type="varchar" length="100" jt="12" mandatory="y" />
<column name="email" type="varchar" length="100" jt="12" mandatory="y" />
<column name="avatar" type="text" jt="12" />
<index name="pk_reader_id" unique="PRIMARY_KEY" >
<column name="id" />
</index>
</table>
<table name="rating" prior="tbl" >
<column name="id" type="serial" jt="4" mandatory="y" />
<column name="book_id" type="integer" jt="4" mandatory="y" />
<column name="member_id" type="integer" jt="4" mandatory="y" />
<column name="rate" type="integer" jt="4" mandatory="y" />
<column name="created_at" type="date" jt="91" mandatory="y" />
<index name="pk_rating_id" unique="PRIMARY_KEY" >
<column name="id" />
</index>
<fk name="fk_rating_book" to_schema="library" to_table="book" >
<fk_column name="book_id" pk="id" />
</fk>
<fk name="fk_rating_member" to_schema="library" to_table="member" >
<fk_column name="member_id" pk="id" />
</fk>
</table>
<table name="review" prior="tbl" >
<column name="id" type="serial" jt="4" mandatory="y" />
<column name="book_id" type="integer" jt="4" mandatory="y" />
<column name="member_id" prior="reader_id" type="integer" jt="4" mandatory="y" />
<column name="description" prior="detail" type="text" jt="12" mandatory="y" />
<column name="created_at" type="date" jt="91" mandatory="y" />
<index name="pk_review_id" unique="PRIMARY_KEY" >
<column name="id" />
</index>
<fk name="fk_review_book" to_schema="library" to_table="book" delete_action="cascade" >
<fk_column name="book_id" pk="id" />
</fk>
<fk name="fk_review_reader" to_schema="library" to_table="member" delete_action="cascade" >
<fk_column name="member_id" pk="id" />
</fk>
</table>
<table name="wanttoread" prior="wish" >
<column name="member_id" type="integer" jt="4" mandatory="y" />
<column name="book_id" type="integer" jt="4" mandatory="y" />
<index name="idx_wish" unique="PRIMARY_KEY" >
<column name="member_id" />
<column name="book_id" />
</index>
<fk name="fk_wish_member" to_schema="library" to_table="member" delete_action="cascade" >
<fk_column name="member_id" pk="id" />
</fk>
<fk name="fk_wish_book" to_schema="library" to_table="book" delete_action="cascade" >
<fk_column name="book_id" pk="id" />
</fk>
</table>
</schema>
<layout name="Default Layout" id="Layout_1782" show_relation="columns" >
<entity schema="library" name="book" color="C1D8EE" x="144" y="144" />
<entity schema="library" name="booking" color="C1D8EE" x="304" y="272" />
<entity schema="library" name="haveread" color="3986C1" x="304" y="528" />
<entity schema="library" name="member" color="C1D8EE" x="544" y="304" />
<entity schema="library" name="rating" color="C1D8EE" x="304" y="624" />
<entity schema="library" name="review" color="C1D8EE" x="304" y="128" />
<entity schema="library" name="wanttoread" color="C1D8EE" x="304" y="432" />
<callout x="48" y="48" pointer="Round" >
<comment><![CDATA[DbSchema is in offline mode.
New designed tables will be saved to model file and later can be create in any database.
Right-click the layout to create new tables. Drop this callout from its context menu.]]></comment>
</callout>
</layout>
</project>