mks_auth 1.0.14 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +17 -3
- data/app/assets/config/mks_auth_manifest.js +2 -0
- data/app/assets/javascripts/mks_auth/application.js +13 -0
- data/app/assets/stylesheets/mks_auth/application.css +15 -0
- data/app/controllers/mks/auth/access_controller.rb +51 -0
- data/app/controllers/mks/auth/application_controller.rb +13 -39
- data/app/controllers/mks/auth/application_modules_controller.rb +2 -0
- data/app/controllers/mks/auth/user_roles_controller.rb +32 -40
- data/app/controllers/mks/auth/users_controller.rb +29 -47
- data/app/helpers/mks/auth/access_helper.rb +47 -0
- data/app/helpers/mks/auth/application_helper.rb +10 -0
- data/app/jobs/mks_auth/application_job.rb +4 -0
- data/app/mailers/mks_auth/application_mailer.rb +6 -0
- data/app/models/mks/auth/application_module.rb +3 -3
- data/app/models/mks/auth/menu.rb +5 -5
- data/app/models/mks/auth/user.rb +9 -35
- data/app/models/mks/auth/user_role.rb +5 -10
- data/config/routes.rb +20 -16
- data/db/migrate/20161029065810_create_mks_auth_application_modules.rb +1 -1
- data/db/migrate/20161029065959_create_mks_auth_users.rb +4 -1
- data/db/migrate/20161029070807_create_mks_auth_user_roles.rb +2 -3
- data/db/migrate/20161029071047_create_mks_users_user_roles.rb +4 -4
- data/db/migrate/20161029072256_create_mks_auth_menus.rb +3 -3
- data/db/migrate/20161029074023_create_mks_menus_user_roles.rb +3 -3
- data/lib/mks/auth/engine.rb +12 -5
- data/lib/mks/auth/version.rb +1 -1
- data/lib/mks_auth.rb +0 -1
- data/spec/controllers/mks/auth/users_controller_spec.rb +2 -91
- data/spec/dummy/config/application.rb +0 -2
- data/spec/dummy/config/database.yml +3 -5
- data/spec/dummy/config/initializers/new_framework_defaults.rb +1 -1
- data/spec/dummy/db/schema.rb +35 -442
- data/spec/factories/application_modules.rb +1 -1
- data/spec/factories/menus.rb +2 -2
- data/spec/factories/user_roles.rb +1 -2
- data/spec/factories/users.rb +3 -2
- data/spec/models/mks/auth/application_module_spec.rb +1 -2
- data/spec/models/mks/auth/user_role_spec.rb +0 -6
- data/spec/models/mks/auth/user_spec.rb +0 -33
- data/spec/rails_helper.rb +0 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/support/factory_girl.rb +2 -2
- metadata +95 -140
- data/app/controllers/mks/auth/menus_controller.rb +0 -29
- data/db/migrate/20180201104912_create_mks_users_application_modules.rb +0 -12
- data/lib/mks/auth/token_auth.rb +0 -19
- data/spec/controllers/mks/auth/menus_controller_spec.rb +0 -53
- data/spec/controllers/mks/auth/user_roles_controller_spec.rb +0 -129
- data/spec/dummy/log/development.log +0 -16526
- data/spec/dummy/log/test.log +0 -49665
@@ -18,7 +18,7 @@ ActiveSupport.to_time_preserves_timezone = true
|
|
18
18
|
Rails.application.config.active_record.belongs_to_required_by_default = true
|
19
19
|
|
20
20
|
# Do not halt callback chains when a callback returns false. Previous versions had true.
|
21
|
-
|
21
|
+
ActiveSupport.halt_callback_chains_on_return_false = false
|
22
22
|
|
23
23
|
# Configure SSL options to enable HSTS with subdomains. Previous versions had false.
|
24
24
|
Rails.application.config.ssl_options = { hsts: { subdomains: true } }
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -2,481 +2,74 @@
|
|
2
2
|
# of editing this file, please use the migrations feature of Active Record to
|
3
3
|
# incrementally modify your database, and then regenerate this schema definition.
|
4
4
|
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
5
|
+
# Note that this schema.rb definition is the authoritative source for your
|
6
|
+
# database schema. If you need to create the application database on another
|
7
|
+
# system, you should be using db:schema:load, not running all the migrations
|
8
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
9
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
10
10
|
#
|
11
11
|
# It's strongly recommended that you check this file into your version control system.
|
12
12
|
|
13
|
-
ActiveRecord::Schema.define(version:
|
13
|
+
ActiveRecord::Schema.define(version: 20161029074023) do
|
14
14
|
|
15
15
|
# These are extensions that must be enabled in order to support this database
|
16
16
|
enable_extension "plpgsql"
|
17
17
|
|
18
18
|
create_table "mks_auth_application_modules", force: :cascade do |t|
|
19
|
-
t.string
|
20
|
-
t.string
|
19
|
+
t.string "code", null: false
|
20
|
+
t.string "name", null: false
|
21
21
|
t.datetime "created_at", null: false
|
22
22
|
t.datetime "updated_at", null: false
|
23
23
|
end
|
24
24
|
|
25
25
|
create_table "mks_auth_menus", force: :cascade do |t|
|
26
|
-
t.string
|
27
|
-
t.string
|
28
|
-
t.string
|
29
|
-
t.string
|
30
|
-
t.integer
|
31
|
-
t.
|
32
|
-
t.datetime "created_at",
|
33
|
-
t.datetime "updated_at",
|
34
|
-
t.index ["application_module_id"], name: "index_mks_auth_menus_on_application_module_id"
|
35
|
-
t.index ["parent_id"], name: "index_mks_auth_menus_on_parent_id"
|
26
|
+
t.string "text", null: false
|
27
|
+
t.string "icon_cls"
|
28
|
+
t.string "class_name"
|
29
|
+
t.string "location"
|
30
|
+
t.integer "parent_id"
|
31
|
+
t.integer "application_module_id"
|
32
|
+
t.datetime "created_at", null: false
|
33
|
+
t.datetime "updated_at", null: false
|
34
|
+
t.index ["application_module_id"], name: "index_mks_auth_menus_on_application_module_id", using: :btree
|
35
|
+
t.index ["parent_id"], name: "index_mks_auth_menus_on_parent_id", using: :btree
|
36
36
|
end
|
37
37
|
|
38
38
|
create_table "mks_auth_menus_user_roles", force: :cascade do |t|
|
39
|
-
t.
|
40
|
-
t.
|
41
|
-
t.index ["menu_id", "user_role_id"], name: "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id"
|
39
|
+
t.integer "menu_id"
|
40
|
+
t.integer "user_role_id"
|
41
|
+
t.index ["menu_id", "user_role_id"], name: "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id", using: :btree
|
42
42
|
end
|
43
43
|
|
44
44
|
create_table "mks_auth_user_roles", force: :cascade do |t|
|
45
|
-
t.string
|
46
|
-
t.bigint "application_module_id"
|
45
|
+
t.string "name", null: false
|
47
46
|
t.datetime "created_at", null: false
|
48
47
|
t.datetime "updated_at", null: false
|
49
|
-
t.index ["application_module_id"], name: "index_mks_auth_user_roles_on_application_module_id"
|
50
48
|
end
|
51
49
|
|
52
50
|
create_table "mks_auth_users", force: :cascade do |t|
|
53
|
-
t.string
|
54
|
-
t.string
|
55
|
-
t.string
|
56
|
-
t.boolean
|
57
|
-
t.
|
58
|
-
t.
|
59
|
-
t.datetime "
|
60
|
-
|
61
|
-
|
62
|
-
create_table "mks_auth_users_application_modules", id: false, force: :cascade do |t|
|
63
|
-
t.bigint "user_id"
|
64
|
-
t.bigint "application_module_id"
|
65
|
-
t.index ["user_id", "application_module_id"], name: "am_on_users_indx"
|
51
|
+
t.string "first_name", null: false
|
52
|
+
t.string "last_name", null: false
|
53
|
+
t.string "email", null: false
|
54
|
+
t.boolean "active", default: true, null: false
|
55
|
+
t.integer "application_module_id"
|
56
|
+
t.string "password_digest"
|
57
|
+
t.datetime "created_at", null: false
|
58
|
+
t.datetime "updated_at", null: false
|
59
|
+
t.index ["application_module_id"], name: "index_mks_auth_users_on_application_module_id", using: :btree
|
66
60
|
end
|
67
61
|
|
68
62
|
create_table "mks_auth_users_user_roles", id: false, force: :cascade do |t|
|
69
|
-
t.
|
70
|
-
t.
|
71
|
-
t.index ["user_id", "user_role_id"], name: "index_mks_auth_users_user_roles_on_user_id_and_user_role_id"
|
72
|
-
end
|
73
|
-
|
74
|
-
create_table "mks_edm_equipment_categories", force: :cascade do |t|
|
75
|
-
t.string "code"
|
76
|
-
t.string "name", null: false
|
77
|
-
t.string "description"
|
78
|
-
t.bigint "equipment_type_id"
|
79
|
-
t.datetime "created_at", null: false
|
80
|
-
t.datetime "updated_at", null: false
|
81
|
-
t.index ["equipment_type_id"], name: "ec_on_et_indx"
|
82
|
-
end
|
83
|
-
|
84
|
-
create_table "mks_edm_equipment_components", force: :cascade do |t|
|
85
|
-
t.string "serial_no"
|
86
|
-
t.string "name", null: false
|
87
|
-
t.bigint "equipment_item_id"
|
88
|
-
t.datetime "created_at", null: false
|
89
|
-
t.datetime "updated_at", null: false
|
90
|
-
t.index ["equipment_item_id"], name: "ei_on_ec_indx"
|
91
|
-
end
|
92
|
-
|
93
|
-
create_table "mks_edm_equipment_items", force: :cascade do |t|
|
94
|
-
t.string "code"
|
95
|
-
t.string "name", null: false
|
96
|
-
t.string "description"
|
97
|
-
t.string "status", default: "READY"
|
98
|
-
t.string "serial_number"
|
99
|
-
t.string "brand"
|
100
|
-
t.string "item_model"
|
101
|
-
t.float "purchase_price", null: false
|
102
|
-
t.date "purchase_date", null: false
|
103
|
-
t.float "license_fee"
|
104
|
-
t.float "tax"
|
105
|
-
t.bigint "equipment_id"
|
106
|
-
t.bigint "current_location_id"
|
107
|
-
t.datetime "created_at", null: false
|
108
|
-
t.datetime "updated_at", null: false
|
109
|
-
t.index ["current_location_id"], name: "equipment_on_el_indx"
|
110
|
-
t.index ["equipment_id"], name: "equipment_on_ei_indx"
|
111
|
-
end
|
112
|
-
|
113
|
-
create_table "mks_edm_equipment_locations", force: :cascade do |t|
|
114
|
-
t.string "code"
|
115
|
-
t.string "name", null: false
|
116
|
-
t.bigint "location_type_id"
|
117
|
-
t.string "description"
|
118
|
-
t.string "address"
|
119
|
-
t.datetime "created_at", null: false
|
120
|
-
t.datetime "updated_at", null: false
|
121
|
-
t.index ["location_type_id"], name: "lt_on_el_indx"
|
122
|
-
end
|
123
|
-
|
124
|
-
create_table "mks_edm_equipment_types", force: :cascade do |t|
|
125
|
-
t.string "code"
|
126
|
-
t.string "name", null: false
|
127
|
-
t.string "description"
|
128
|
-
t.datetime "created_at", null: false
|
129
|
-
t.datetime "updated_at", null: false
|
130
|
-
end
|
131
|
-
|
132
|
-
create_table "mks_edm_equipment_valuations", force: :cascade do |t|
|
133
|
-
t.bigint "equipment_item_id"
|
134
|
-
t.float "initial_cost", null: false
|
135
|
-
t.float "residual_value", null: false
|
136
|
-
t.float "work_hrs_per_yr", null: false
|
137
|
-
t.float "life_year", null: false
|
138
|
-
t.float "insurance_premium", null: false
|
139
|
-
t.float "fuel_cost_per_hr"
|
140
|
-
t.float "oil_rate"
|
141
|
-
t.float "repair_rate"
|
142
|
-
t.float "rate_of_return"
|
143
|
-
t.string "dep_method"
|
144
|
-
t.boolean "is_current", default: true
|
145
|
-
t.datetime "created_at", null: false
|
146
|
-
t.datetime "updated_at", null: false
|
147
|
-
t.index ["equipment_item_id"], name: "ev_on_ei_indx"
|
148
|
-
end
|
149
|
-
|
150
|
-
create_table "mks_edm_equipments", force: :cascade do |t|
|
151
|
-
t.string "code"
|
152
|
-
t.string "name", null: false
|
153
|
-
t.string "description"
|
154
|
-
t.float "minimum_acquisition_time", default: 0.0, null: false
|
155
|
-
t.bigint "equipment_category_id"
|
156
|
-
t.datetime "created_at", null: false
|
157
|
-
t.datetime "updated_at", null: false
|
158
|
-
t.index ["equipment_category_id"], name: "equipment_on_ec_indx"
|
159
|
-
end
|
160
|
-
|
161
|
-
create_table "mks_edm_location_types", force: :cascade do |t|
|
162
|
-
t.string "code"
|
163
|
-
t.string "name"
|
164
|
-
t.string "description"
|
165
|
-
t.datetime "created_at", null: false
|
166
|
-
t.datetime "updated_at", null: false
|
167
|
-
end
|
168
|
-
|
169
|
-
create_table "mks_maintenance_cost_types", force: :cascade do |t|
|
170
|
-
t.string "code"
|
171
|
-
t.string "name"
|
172
|
-
t.json "fields", null: false
|
173
|
-
t.datetime "created_at", null: false
|
174
|
-
t.datetime "updated_at", null: false
|
175
|
-
end
|
176
|
-
|
177
|
-
create_table "mks_maintenance_job_cards", force: :cascade do |t|
|
178
|
-
t.bigint "maintenance_service_order_id"
|
179
|
-
t.string "code"
|
180
|
-
t.date "start_date"
|
181
|
-
t.date "due_date"
|
182
|
-
t.bigint "service_provider_id"
|
183
|
-
t.date "checkout_date"
|
184
|
-
t.bigint "checkout_by_id"
|
185
|
-
t.bigint "checkout_to_id"
|
186
|
-
t.bigint "maintenance_status_id"
|
187
|
-
t.date "checkin_date"
|
188
|
-
t.bigint "checkin_by_id"
|
189
|
-
t.bigint "checkin_to_id"
|
190
|
-
t.datetime "created_at", null: false
|
191
|
-
t.datetime "updated_at", null: false
|
192
|
-
t.boolean "approved", default: false
|
193
|
-
t.boolean "checkout_confirmed", default: false
|
194
|
-
t.boolean "checkin_confirmed", default: false
|
195
|
-
t.boolean "costs_approved", default: false
|
196
|
-
t.integer "prepared_by_id"
|
197
|
-
t.index ["checkin_by_id"], name: "chb_on_jc_indx"
|
198
|
-
t.index ["checkin_to_id"], name: "cht_on_jc_indx"
|
199
|
-
t.index ["checkout_by_id"], name: "cb_on_jc_indx"
|
200
|
-
t.index ["checkout_to_id"], name: "ct_on_jc_indx"
|
201
|
-
t.index ["maintenance_service_order_id"], name: "mso_on_jc_indx"
|
202
|
-
t.index ["maintenance_status_id"], name: "ms_on_jc_indx"
|
203
|
-
t.index ["service_provider_id"], name: "sp_on_jc_indx"
|
204
|
-
end
|
205
|
-
|
206
|
-
create_table "mks_maintenance_maintenance_categories", force: :cascade do |t|
|
207
|
-
t.string "code"
|
208
|
-
t.string "name"
|
209
|
-
t.string "description"
|
210
|
-
t.datetime "created_at", null: false
|
211
|
-
t.datetime "updated_at", null: false
|
212
|
-
end
|
213
|
-
|
214
|
-
create_table "mks_maintenance_maintenance_costs", force: :cascade do |t|
|
215
|
-
t.bigint "job_card_id"
|
216
|
-
t.bigint "cost_type_id"
|
217
|
-
t.json "cost_detail", null: false
|
218
|
-
t.string "remark"
|
219
|
-
t.datetime "created_at", null: false
|
220
|
-
t.datetime "updated_at", null: false
|
221
|
-
t.index ["cost_type_id"], name: "ct_on_mc_indx"
|
222
|
-
t.index ["job_card_id"], name: "jc_on_mc_indx"
|
223
|
-
end
|
224
|
-
|
225
|
-
create_table "mks_maintenance_maintenance_service_orders", force: :cascade do |t|
|
226
|
-
t.string "title", null: false
|
227
|
-
t.string "description"
|
228
|
-
t.bigint "equipment_item_id"
|
229
|
-
t.bigint "maintenance_type_id"
|
230
|
-
t.date "start_date"
|
231
|
-
t.date "end_date"
|
232
|
-
t.bigint "prepared_by_id"
|
233
|
-
t.boolean "approved", default: false
|
234
|
-
t.string "status", default: "draft"
|
235
|
-
t.bigint "approved_by_id"
|
236
|
-
t.string "remark"
|
237
|
-
t.float "current_reading", null: false
|
238
|
-
t.datetime "created_at", null: false
|
239
|
-
t.datetime "updated_at", null: false
|
240
|
-
t.index ["approved_by_id"], name: "ab_on_mso_indx"
|
241
|
-
t.index ["equipment_item_id"], name: "ei_on_mso_indx"
|
242
|
-
t.index ["maintenance_type_id"], name: "mt_on_mso_indx"
|
243
|
-
t.index ["prepared_by_id"], name: "pb_on_mso_indx"
|
244
|
-
end
|
245
|
-
|
246
|
-
create_table "mks_maintenance_maintenance_statuses", force: :cascade do |t|
|
247
|
-
t.string "code"
|
248
|
-
t.string "name"
|
249
|
-
t.string "description"
|
250
|
-
t.datetime "created_at", null: false
|
251
|
-
t.datetime "updated_at", null: false
|
252
|
-
end
|
253
|
-
|
254
|
-
create_table "mks_maintenance_maintenance_types", force: :cascade do |t|
|
255
|
-
t.string "code"
|
256
|
-
t.string "name", null: false
|
257
|
-
t.string "description"
|
258
|
-
t.bigint "maintenance_category_id"
|
259
|
-
t.datetime "created_at", null: false
|
260
|
-
t.datetime "updated_at", null: false
|
261
|
-
t.index ["maintenance_category_id"], name: "mt_on_mc_indx"
|
262
|
-
end
|
263
|
-
|
264
|
-
create_table "mks_maintenance_schedule_settings", force: :cascade do |t|
|
265
|
-
t.bigint "equipment_id"
|
266
|
-
t.bigint "maintenance_type_id"
|
267
|
-
t.bigint "schedule_unit_id"
|
268
|
-
t.float "value", null: false
|
269
|
-
t.datetime "created_at", null: false
|
270
|
-
t.datetime "updated_at", null: false
|
271
|
-
t.index ["equipment_id"], name: "equipment_on_ss_indx"
|
272
|
-
t.index ["maintenance_type_id"], name: "mt_on_ss_indx"
|
273
|
-
t.index ["schedule_unit_id"], name: "su_on_ss_indx"
|
274
|
-
end
|
275
|
-
|
276
|
-
create_table "mks_maintenance_schedule_units", force: :cascade do |t|
|
277
|
-
t.string "code"
|
278
|
-
t.string "name"
|
279
|
-
t.string "description"
|
280
|
-
t.datetime "created_at", null: false
|
281
|
-
t.datetime "updated_at", null: false
|
282
|
-
end
|
283
|
-
|
284
|
-
create_table "mks_rate_chargeable_service_discounts", force: :cascade do |t|
|
285
|
-
t.string "unit_variable", null: false
|
286
|
-
t.float "from", null: false
|
287
|
-
t.float "to", null: false
|
288
|
-
t.float "value", null: false
|
289
|
-
t.integer "chargeable_service_id"
|
290
|
-
t.datetime "created_at", null: false
|
291
|
-
t.datetime "updated_at", null: false
|
292
|
-
end
|
293
|
-
|
294
|
-
create_table "mks_rate_chargeable_services", force: :cascade do |t|
|
295
|
-
t.string "code", null: false
|
296
|
-
t.string "name", null: false
|
297
|
-
t.integer "service_type_id"
|
298
|
-
t.integer "base_unit_id"
|
299
|
-
t.integer "utilization_unit_id"
|
300
|
-
t.integer "service_delivery_unit_id"
|
301
|
-
t.datetime "created_at", null: false
|
302
|
-
t.datetime "updated_at", null: false
|
303
|
-
t.index ["base_unit_id"], name: "bu_on_cs_indx"
|
304
|
-
t.index ["service_delivery_unit_id"], name: "sdu_on_cs_indx"
|
305
|
-
t.index ["service_type_id"], name: "st_on_cs_indx"
|
306
|
-
t.index ["utilization_unit_id"], name: "uu_on_cs_indx"
|
307
|
-
end
|
308
|
-
|
309
|
-
create_table "mks_rate_rate_change_requests", force: :cascade do |t|
|
310
|
-
t.string "reference_number"
|
311
|
-
t.string "authorized_by", null: false
|
312
|
-
t.date "effective_on", null: false
|
313
|
-
t.date "authorized_on", null: false
|
314
|
-
t.json "rates", null: false
|
315
|
-
t.string "status", default: "SUBMITTED", null: false
|
316
|
-
t.bigint "created_by_id"
|
317
|
-
t.bigint "approved_by_id"
|
318
|
-
t.string "remark"
|
319
|
-
t.datetime "created_at", null: false
|
320
|
-
t.datetime "updated_at", null: false
|
321
|
-
t.index ["approved_by_id"], name: "ab_on_rcr_indx"
|
322
|
-
t.index ["created_by_id"], name: "cb_on_rcr_indx"
|
323
|
-
t.index ["reference_number"], name: "index_mks_rate_rate_change_requests_on_reference_number", unique: true
|
324
|
-
end
|
325
|
-
|
326
|
-
create_table "mks_rate_service_bundles", force: :cascade do |t|
|
327
|
-
t.string "code"
|
328
|
-
t.string "name", null: false
|
329
|
-
t.string "description"
|
330
|
-
t.float "percent_discount", default: 0.0, null: false
|
331
|
-
t.bigint "service_delivery_unit_id"
|
332
|
-
t.datetime "created_at", null: false
|
333
|
-
t.datetime "updated_at", null: false
|
334
|
-
t.index ["service_delivery_unit_id"], name: "sdu_on_sb_indx"
|
335
|
-
end
|
336
|
-
|
337
|
-
create_table "mks_rate_service_bundles_chargeable_services", id: false, force: :cascade do |t|
|
338
|
-
t.bigint "service_bundle_id"
|
339
|
-
t.bigint "chargeable_service_id"
|
340
|
-
t.index ["service_bundle_id", "chargeable_service_id"], name: "sb_on_cs_indx"
|
341
|
-
end
|
342
|
-
|
343
|
-
create_table "mks_rate_service_delivery_units", force: :cascade do |t|
|
344
|
-
t.string "code", null: false
|
345
|
-
t.string "name", null: false
|
346
|
-
t.string "address", null: false
|
347
|
-
t.datetime "created_at", null: false
|
348
|
-
t.datetime "updated_at", null: false
|
349
|
-
end
|
350
|
-
|
351
|
-
create_table "mks_rate_service_rates", force: :cascade do |t|
|
352
|
-
t.bigint "chargeable_service_id"
|
353
|
-
t.bigint "equipment_item_id"
|
354
|
-
t.float "base_rate", default: 0.0
|
355
|
-
t.float "utilization_rate", default: 0.0
|
356
|
-
t.datetime "created_at", null: false
|
357
|
-
t.datetime "updated_at", null: false
|
358
|
-
t.index ["chargeable_service_id"], name: "cs_on_sr_indx"
|
359
|
-
t.index ["equipment_item_id"], name: "cs_on_ei_indx"
|
360
|
-
end
|
361
|
-
|
362
|
-
create_table "mks_rate_service_types", force: :cascade do |t|
|
363
|
-
t.string "code"
|
364
|
-
t.string "name"
|
365
|
-
t.datetime "created_at", null: false
|
366
|
-
t.datetime "updated_at", null: false
|
367
|
-
end
|
368
|
-
|
369
|
-
create_table "mks_rate_unit_of_charges", force: :cascade do |t|
|
370
|
-
t.string "name", null: false
|
371
|
-
t.json "unit_variables", null: false
|
372
|
-
t.datetime "created_at", null: false
|
373
|
-
t.datetime "updated_at", null: false
|
374
|
-
end
|
375
|
-
|
376
|
-
create_table "mks_rent_clients", force: :cascade do |t|
|
377
|
-
t.string "name", null: false
|
378
|
-
t.string "address"
|
379
|
-
t.datetime "created_at", null: false
|
380
|
-
t.datetime "updated_at", null: false
|
381
|
-
end
|
382
|
-
|
383
|
-
create_table "mks_rent_offer_items", force: :cascade do |t|
|
384
|
-
t.bigint "service_bundle_id"
|
385
|
-
t.date "from", null: false
|
386
|
-
t.date "to", null: false
|
387
|
-
t.float "unit_price", null: false
|
388
|
-
t.bigint "offer_id"
|
389
|
-
t.datetime "created_at", null: false
|
390
|
-
t.datetime "updated_at", null: false
|
391
|
-
t.index ["offer_id"], name: "offer_on_oi_indx"
|
392
|
-
t.index ["service_bundle_id"], name: "sb_on_oi_indx"
|
393
|
-
end
|
394
|
-
|
395
|
-
create_table "mks_rent_offer_requests", force: :cascade do |t|
|
396
|
-
t.bigint "client_id"
|
397
|
-
t.string "description"
|
398
|
-
t.string "destination"
|
399
|
-
t.bigint "prepared_by_id"
|
400
|
-
t.string "status", default: "DRAFT", null: false
|
401
|
-
t.datetime "created_at", null: false
|
402
|
-
t.datetime "updated_at", null: false
|
403
|
-
t.index ["client_id"], name: "client_on_er_indx"
|
404
|
-
t.index ["prepared_by_id"], name: "equipment_on_rb_indx"
|
405
|
-
end
|
406
|
-
|
407
|
-
create_table "mks_rent_offers", force: :cascade do |t|
|
408
|
-
t.bigint "prepared_by_id"
|
409
|
-
t.bigint "offer_request_id"
|
410
|
-
t.boolean "confirmed", default: false, null: false
|
411
|
-
t.boolean "booked", default: false, null: false
|
412
|
-
t.float "total_price"
|
413
|
-
t.datetime "created_at", null: false
|
414
|
-
t.datetime "updated_at", null: false
|
415
|
-
t.index ["offer_request_id"], name: "or_on_offers_indx"
|
416
|
-
t.index ["prepared_by_id"], name: "pb_on_offers_indx"
|
417
|
-
end
|
418
|
-
|
419
|
-
create_table "mks_rent_request_items", force: :cascade do |t|
|
420
|
-
t.bigint "service_bundle_id"
|
421
|
-
t.date "from", null: false
|
422
|
-
t.date "to", null: false
|
423
|
-
t.integer "quantity", null: false
|
424
|
-
t.bigint "offer_request_id"
|
425
|
-
t.datetime "created_at", null: false
|
426
|
-
t.datetime "updated_at", null: false
|
427
|
-
t.index ["offer_request_id"], name: "or_on_er_indx"
|
428
|
-
t.index ["service_bundle_id"], name: "sb_on_er_indx"
|
63
|
+
t.integer "user_id"
|
64
|
+
t.integer "user_role_id"
|
65
|
+
t.index ["user_id", "user_role_id"], name: "index_mks_auth_users_user_roles_on_user_id_and_user_role_id", using: :btree
|
429
66
|
end
|
430
67
|
|
431
68
|
add_foreign_key "mks_auth_menus", "mks_auth_application_modules", column: "application_module_id"
|
432
69
|
add_foreign_key "mks_auth_menus", "mks_auth_menus", column: "parent_id"
|
433
70
|
add_foreign_key "mks_auth_menus_user_roles", "mks_auth_menus", column: "menu_id"
|
434
71
|
add_foreign_key "mks_auth_menus_user_roles", "mks_auth_user_roles", column: "user_role_id"
|
435
|
-
add_foreign_key "
|
436
|
-
add_foreign_key "mks_auth_users_application_modules", "mks_auth_application_modules", column: "application_module_id"
|
437
|
-
add_foreign_key "mks_auth_users_application_modules", "mks_auth_users", column: "user_id"
|
72
|
+
add_foreign_key "mks_auth_users", "mks_auth_application_modules", column: "application_module_id"
|
438
73
|
add_foreign_key "mks_auth_users_user_roles", "mks_auth_user_roles", column: "user_role_id"
|
439
74
|
add_foreign_key "mks_auth_users_user_roles", "mks_auth_users", column: "user_id"
|
440
|
-
add_foreign_key "mks_edm_equipment_categories", "mks_edm_equipment_types", column: "equipment_type_id"
|
441
|
-
add_foreign_key "mks_edm_equipment_components", "mks_edm_equipment_items", column: "equipment_item_id"
|
442
|
-
add_foreign_key "mks_edm_equipment_items", "mks_edm_equipment_locations", column: "current_location_id"
|
443
|
-
add_foreign_key "mks_edm_equipment_items", "mks_edm_equipments", column: "equipment_id"
|
444
|
-
add_foreign_key "mks_edm_equipment_locations", "mks_edm_location_types", column: "location_type_id"
|
445
|
-
add_foreign_key "mks_edm_equipment_valuations", "mks_edm_equipment_items", column: "equipment_item_id"
|
446
|
-
add_foreign_key "mks_edm_equipments", "mks_edm_equipment_categories", column: "equipment_category_id"
|
447
|
-
add_foreign_key "mks_maintenance_job_cards", "mks_auth_users", column: "checkin_by_id"
|
448
|
-
add_foreign_key "mks_maintenance_job_cards", "mks_auth_users", column: "checkout_by_id"
|
449
|
-
add_foreign_key "mks_maintenance_job_cards", "mks_auth_users", column: "prepared_by_id"
|
450
|
-
add_foreign_key "mks_maintenance_job_cards", "mks_edm_equipment_locations", column: "checkin_to_id"
|
451
|
-
add_foreign_key "mks_maintenance_job_cards", "mks_edm_equipment_locations", column: "checkout_to_id"
|
452
|
-
add_foreign_key "mks_maintenance_job_cards", "mks_edm_equipment_locations", column: "service_provider_id"
|
453
|
-
add_foreign_key "mks_maintenance_job_cards", "mks_maintenance_maintenance_service_orders", column: "maintenance_service_order_id"
|
454
|
-
add_foreign_key "mks_maintenance_job_cards", "mks_maintenance_maintenance_statuses", column: "maintenance_status_id"
|
455
|
-
add_foreign_key "mks_maintenance_maintenance_service_orders", "mks_auth_users", column: "approved_by_id"
|
456
|
-
add_foreign_key "mks_maintenance_maintenance_service_orders", "mks_auth_users", column: "prepared_by_id"
|
457
|
-
add_foreign_key "mks_maintenance_maintenance_service_orders", "mks_edm_equipment_items", column: "equipment_item_id"
|
458
|
-
add_foreign_key "mks_maintenance_maintenance_service_orders", "mks_maintenance_maintenance_types", column: "maintenance_type_id"
|
459
|
-
add_foreign_key "mks_maintenance_maintenance_types", "mks_maintenance_maintenance_categories", column: "maintenance_category_id"
|
460
|
-
add_foreign_key "mks_maintenance_schedule_settings", "mks_edm_equipments", column: "equipment_id"
|
461
|
-
add_foreign_key "mks_maintenance_schedule_settings", "mks_maintenance_maintenance_types", column: "maintenance_type_id"
|
462
|
-
add_foreign_key "mks_maintenance_schedule_settings", "mks_maintenance_schedule_units", column: "schedule_unit_id"
|
463
|
-
add_foreign_key "mks_rate_chargeable_service_discounts", "mks_rate_chargeable_services", column: "chargeable_service_id"
|
464
|
-
add_foreign_key "mks_rate_chargeable_services", "mks_rate_service_delivery_units", column: "service_delivery_unit_id"
|
465
|
-
add_foreign_key "mks_rate_chargeable_services", "mks_rate_service_types", column: "service_type_id"
|
466
|
-
add_foreign_key "mks_rate_chargeable_services", "mks_rate_unit_of_charges", column: "base_unit_id"
|
467
|
-
add_foreign_key "mks_rate_chargeable_services", "mks_rate_unit_of_charges", column: "utilization_unit_id"
|
468
|
-
add_foreign_key "mks_rate_rate_change_requests", "mks_auth_users", column: "approved_by_id"
|
469
|
-
add_foreign_key "mks_rate_rate_change_requests", "mks_auth_users", column: "created_by_id"
|
470
|
-
add_foreign_key "mks_rate_service_bundles", "mks_rate_service_delivery_units", column: "service_delivery_unit_id"
|
471
|
-
add_foreign_key "mks_rate_service_bundles_chargeable_services", "mks_rate_chargeable_services", column: "chargeable_service_id"
|
472
|
-
add_foreign_key "mks_rate_service_bundles_chargeable_services", "mks_rate_service_bundles", column: "service_bundle_id"
|
473
|
-
add_foreign_key "mks_rate_service_rates", "mks_edm_equipment_items", column: "equipment_item_id"
|
474
|
-
add_foreign_key "mks_rate_service_rates", "mks_rate_chargeable_services", column: "chargeable_service_id"
|
475
|
-
add_foreign_key "mks_rent_offer_items", "mks_rate_service_bundles", column: "service_bundle_id"
|
476
|
-
add_foreign_key "mks_rent_offer_items", "mks_rent_offers", column: "offer_id"
|
477
|
-
add_foreign_key "mks_rent_offer_requests", "mks_auth_users", column: "prepared_by_id"
|
478
|
-
add_foreign_key "mks_rent_offers", "mks_auth_users", column: "prepared_by_id"
|
479
|
-
add_foreign_key "mks_rent_offers", "mks_rent_offer_requests", column: "offer_request_id"
|
480
|
-
add_foreign_key "mks_rent_request_items", "mks_rate_service_bundles", column: "service_bundle_id"
|
481
|
-
add_foreign_key "mks_rent_request_items", "mks_rent_offer_requests", column: "offer_request_id"
|
482
75
|
end
|