schema.yml 2.79 KB
Newer Older
Игорь's avatar
init    
Игорь committed
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
User:
  actAs: 
    Timestampable: ~
    SoftDelete: ~
  columns:
    username:
      type: string(255)
      notnull: true
      unique: true
    name:
      type: string(255)
      notnull: true
    email:
      type: string(128)
    address:
      type: string(255)
    email_check:
      type: string(255)
    email_change:
      type: string(128)
      notnull: true
    email_change_check:
      type: string(255)
    social:
      type: enum
      values: [vk, fb, google, apple]
    phone:
      type: string(11)
    phone_check:
      type: string(255)
    phone_change:
      type: string(11)
      notnull: true
    salt: string(128)
    password: string(128)
    password_recovery: string(255)
    is_active:
      type: boolean
      default: false
      notnull: true
    is_blocked:
      type: boolean
      default: false
      notnull: true
    is_super_admin:
      type: boolean
      default: false
    last_login:
      type: timestamp
  relations:
    UserPermissions:
      class: Permission
      local: user_id
      foreign: permission_id
      refClass: UserPermissions
      onDelete: CASCADE
    UserGroup:
      onDelete: CASCADE
      class: UserGroup
      local: user_id
      foreign: user_group_id
      refClass: UserGroupUsers
  indexes:
    name_idx:
      fields: [username]
      unique: true

UserGroup:
  actAs:
    Timestampable: ~
  columns:
    title:
      type: string(128)
      notnull: true
      unique: true
  relations:
    UserGroupPermissions:
      onDelete: CASCADE
      class: Permission
      local: user_group_id
      foreign: permission_id
      refClass: UserGroupPermissions

UserGroupUsers:
  columns:
    user_id:
      type: integer
      primary: true
    user_group_id:
      type: integer
      primary: true
  relations:
    User:
      onDelete: CASCADE
      local: user_id
      foreign: id
    UserGroup:
      onDelete: CASCADE
      local: user_group_id
      foreign: id

UserGroupPermissions:
  columns:
    user_group_id:
      type: integer
      primary: true
    permission_id:
      type: integer
      primary: true

UserPermissions:
  columns:
    user_id:
      type: integer
      primary: true
    permission_id:
      type: integer
      primary: true

Permission:
  columns:
    credential:
      type: string(255)
      notnull: true
      unique: true
    description:
      type: string(255)

UserLog:
  actAs:
    Timestampable: ~
  columns:
    user_id:
      type: integer
      notnull: true
    log_type:
      type: string(50)
      notnull: true
    model:
      type: string(50)
      notnull: true
    model_id:
      type: integer
      notnull: true
    log:
      type: string
  relations:
    User:
      onDelete: CASCADE
      local: user_id
      foreign: id
  indexes:
    model_idx:
      fields: [model]
    model_id_idx:
      fields: [model_id]