(2.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.8ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.5ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.5ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (275.6ms) DROP DATABASE IF EXISTS "construction_test"  (379.0ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (1.0ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.8ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (12.5ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (7.2ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.7ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.4ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (8.2ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.3ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (6.2ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (6.6ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (2.4ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.4ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.6ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.2ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (6.4ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (7.5ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.6ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.2ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (8.7ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (6.2ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (6.9ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (7.0ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (1.0ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (7.1ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_bundle_discounts" CASCADE  (4.2ms) CREATE TABLE "mks_rate_bundle_discounts" ("id" bigserial primary key, "chargeable_service_id" bigint, "service_bundle_id" bigint, "percent_discount" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "cs_on_bd_indx" ON "mks_rate_bundle_discounts" ("chargeable_service_id")  (3.2ms) CREATE INDEX "sb_on_bd_indx" ON "mks_rate_bundle_discounts" ("service_bundle_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (6.4ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (6.8ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.3ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.8ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.5ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (9.0ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.1ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.3ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (6.4ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.3ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (6.4ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (5.2ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.2ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (6.7ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (9.1ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.3ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.3ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.4ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.1ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.7ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.4ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.3ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (3.1ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.2ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (2.9ms) ALTER TABLE "mks_rate_bundle_discounts" ADD CONSTRAINT "fk_rails_e6bce7b79c" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.5ms) ALTER TABLE "mks_rate_bundle_discounts" ADD CONSTRAINT "fk_rails_72a3777128" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.4ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.4ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (3.0ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.6ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.6ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.7ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.2ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.5ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.9ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (8.3ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.7ms) INSERT INTO "schema_migrations" (version) VALUES (20180308133826)  (1.7ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144), (20180303145739);   (6.2ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.7ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.6ms) BEGIN SQL (1.3ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-03-22 04:35:40.597642"], ["updated_at", "2018-03-22 04:35:40.597642"]]  (1.4ms) COMMIT ActiveRecord::InternalMetadata Load (0.6ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.7ms) BEGIN SQL (0.8ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-03-22 04:35:40.606062"], ["key", "environment"]]  (1.3ms) COMMIT  (1.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.5ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.5ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (124.1ms) DROP DATABASE IF EXISTS "construction_test"  (345.8ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.6ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.7ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (9.4ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (6.7ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.0ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (3.9ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.6ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (6.0ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (6.0ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (1.8ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.0ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.9ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.1ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (7.5ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (2.9ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (6.0ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (2.9ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (9.5ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (11.3ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (6.7ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (6.0ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (6.5ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (6.2ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_bundle_discounts" CASCADE  (4.7ms) CREATE TABLE "mks_rate_bundle_discounts" ("id" bigserial primary key, "chargeable_service_id" bigint, "service_bundle_id" bigint, "percent_discount" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "cs_on_bd_indx" ON "mks_rate_bundle_discounts" ("chargeable_service_id")  (3.2ms) CREATE INDEX "sb_on_bd_indx" ON "mks_rate_bundle_discounts" ("service_bundle_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (7.0ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (6.6ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.4ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.2ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.8ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (6.5ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.2ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.4ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (6.5ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (6.7ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (6.9ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.5ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (6.6ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (6.6ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.2ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.6ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (3.3ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (3.5ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (3.1ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.4ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.2ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.2ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.9ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (3.1ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.3ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.3ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.3ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (2.6ms) ALTER TABLE "mks_rate_bundle_discounts" ADD CONSTRAINT "fk_rails_e6bce7b79c" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.4ms) ALTER TABLE "mks_rate_bundle_discounts" ADD CONSTRAINT "fk_rails_72a3777128" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.6ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.3ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.4ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.5ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (3.1ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.7ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.7ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.3ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (6.5ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.6ms) INSERT INTO "schema_migrations" (version) VALUES (20180308133826)  (1.3ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144), (20180303145739);   (6.3ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.7ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.6ms) BEGIN SQL (1.2ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-03-22 04:38:38.593748"], ["updated_at", "2018-03-22 04:38:38.593748"]]  (1.3ms) COMMIT ActiveRecord::InternalMetadata Load (0.8ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.6ms) BEGIN SQL (0.8ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-03-22 04:38:38.602003"], ["key", "environment"]]  (1.3ms) COMMIT  (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.9ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.7ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (123.6ms) DROP DATABASE IF EXISTS "construction_test"  (335.5ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.7ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.7ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (9.5ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (6.5ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.3ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (4.0ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.1ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (6.1ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (6.2ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (1.8ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.6ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.6ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.2ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (6.3ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (6.9ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.1ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (6.5ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (6.1ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (6.5ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.8ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (6.6ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (6.5ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_bundle_discounts" CASCADE  (4.8ms) CREATE TABLE "mks_rate_bundle_discounts" ("id" bigserial primary key, "chargeable_service_id" bigint, "service_bundle_id" bigint, "percent_discount" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "cs_on_bd_indx" ON "mks_rate_bundle_discounts" ("chargeable_service_id")  (3.1ms) CREATE INDEX "sb_on_bd_indx" ON "mks_rate_bundle_discounts" ("service_bundle_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (6.3ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (6.3ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.5ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.3ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.3ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (6.4ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.2ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.3ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (6.4ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (6.2ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (5.1ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.1ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (6.8ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (8.0ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.3ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.3ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.2ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.4ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.5ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.3ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.2ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.1ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.0ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (2.6ms) ALTER TABLE "mks_rate_bundle_discounts" ADD CONSTRAINT "fk_rails_e6bce7b79c" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.5ms) ALTER TABLE "mks_rate_bundle_discounts" ADD CONSTRAINT "fk_rails_72a3777128" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.3ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.2ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.4ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.8ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.2ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.4ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.0ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (3.3ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.5ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (6.3ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.5ms) INSERT INTO "schema_migrations" (version) VALUES (20180308133826)  (1.5ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144), (20180303145739);   (5.7ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.7ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.6ms) BEGIN SQL (1.1ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-03-22 04:39:13.331763"], ["updated_at", "2018-03-22 04:39:13.331763"]]  (1.2ms) COMMIT ActiveRecord::InternalMetadata Load (0.5ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.5ms) BEGIN SQL (0.8ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-03-22 04:39:13.339303"], ["key", "environment"]]  (1.2ms) COMMIT  (1.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.7ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (1.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.7ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (122.7ms) DROP DATABASE IF EXISTS "construction_test"  (332.0ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.7ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.7ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (9.8ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (7.1ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.4ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (4.1ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.0ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (6.0ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (6.3ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (2.3ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.6ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.7ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.5ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (6.2ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (7.0ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.4ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (6.4ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (6.4ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (6.4ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (6.2ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (7.0ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_rate_bundle_discounts" CASCADE  (4.7ms) CREATE TABLE "mks_rate_bundle_discounts" ("id" bigserial primary key, "chargeable_service_id" bigint, "service_bundle_id" bigint, "percent_discount" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "cs_on_bd_indx" ON "mks_rate_bundle_discounts" ("chargeable_service_id")  (3.2ms) CREATE INDEX "sb_on_bd_indx" ON "mks_rate_bundle_discounts" ("service_bundle_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (8.4ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (6.5ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.7ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.1ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.3ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (7.2ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.4ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.2ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (6.2ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (7.2ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (5.1ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.0ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (7.9ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (6.9ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.4ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.4ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.4ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.3ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.3ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.5ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.2ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.2ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.3ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.2ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (2.7ms) ALTER TABLE "mks_rate_bundle_discounts" ADD CONSTRAINT "fk_rails_e6bce7b79c" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.5ms) ALTER TABLE "mks_rate_bundle_discounts" ADD CONSTRAINT "fk_rails_72a3777128" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.7ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.2ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.4ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.4ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.2ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.4ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (3.3ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.6ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (6.7ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.7ms) INSERT INTO "schema_migrations" (version) VALUES (20180308133826)  (1.3ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144), (20180303145739);   (5.5ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.9ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.8ms) BEGIN SQL (1.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-03-22 04:40:21.548601"], ["updated_at", "2018-03-22 04:40:21.548601"]]  (1.2ms) COMMIT ActiveRecord::InternalMetadata Load (0.6ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.5ms) BEGIN SQL (1.1ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-03-22 04:40:21.555653"], ["key", "environment"]]  (1.3ms) COMMIT  (1.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.5ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.5ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (125.0ms) DROP DATABASE IF EXISTS "construction_test"  (330.5ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.6ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.7ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (11.4ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (8.6ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.4ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (4.0ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.0ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (6.7ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (6.3ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (3.1ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.6ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.6ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.2ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (6.2ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (1.1ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (8.2ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.5ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (6.6ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (6.0ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (8.9ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (6.4ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (6.7ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_bundle_discounts" CASCADE  (4.4ms) CREATE TABLE "mks_rate_bundle_discounts" ("id" bigserial primary key, "chargeable_service_id" bigint, "service_bundle_id" bigint, "percent_discount" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "cs_on_bd_indx" ON "mks_rate_bundle_discounts" ("chargeable_service_id")  (5.4ms) CREATE INDEX "sb_on_bd_indx" ON "mks_rate_bundle_discounts" ("service_bundle_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (6.3ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (8.0ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.5ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.1ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.3ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (6.9ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.0ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.3ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (6.8ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (6.1ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (4.8ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.4ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (6.3ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (9.9ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (6.9ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.3ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.2ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.4ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.2ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.5ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.7ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.1ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (3.1ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (2.9ms) ALTER TABLE "mks_rate_bundle_discounts" ADD CONSTRAINT "fk_rails_e6bce7b79c" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (3.3ms) ALTER TABLE "mks_rate_bundle_discounts" ADD CONSTRAINT "fk_rails_72a3777128" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (4.0ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (3.4ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (3.5ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (3.4ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.7ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.8ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.9ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (4.4ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.8ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (6.6ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.8ms) INSERT INTO "schema_migrations" (version) VALUES (20180308133826)  (1.5ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144), (20180303145739);   (7.0ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.7ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.7ms) BEGIN SQL (0.9ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-03-22 04:41:38.817261"], ["updated_at", "2018-03-22 04:41:38.817261"]]  (1.3ms) COMMIT ActiveRecord::InternalMetadata Load (0.6ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.5ms) BEGIN SQL (1.1ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-03-22 04:41:38.824521"], ["key", "environment"]]  (1.3ms) COMMIT  (1.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.7ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.5ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.5ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (125.5ms) DROP DATABASE IF EXISTS "construction_test"  (327.4ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.6ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.6ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (9.4ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (6.5ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.1ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (4.9ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.3ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (6.3ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (6.1ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (1.7ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.4ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.7ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.2ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (8.5ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.9ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (6.7ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.1ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (6.7ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (7.9ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (6.2ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (6.5ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (6.1ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_rate_bundle_discounts" CASCADE  (4.1ms) CREATE TABLE "mks_rate_bundle_discounts" ("id" bigserial primary key, "chargeable_service_id" bigint, "service_bundle_id" bigint, "percent_discount" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "cs_on_bd_indx" ON "mks_rate_bundle_discounts" ("chargeable_service_id")  (3.2ms) CREATE INDEX "sb_on_bd_indx" ON "mks_rate_bundle_discounts" ("service_bundle_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (6.0ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (6.6ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.4ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.3ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.1ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (6.8ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.9ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.1ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.7ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (6.3ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (6.1ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (4.7ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (5.2ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (5.9ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (5.8ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.4ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.2ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.8ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.2ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.3ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.3ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.1ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.2ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (3.0ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.2ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (3.1ms) ALTER TABLE "mks_rate_bundle_discounts" ADD CONSTRAINT "fk_rails_e6bce7b79c" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.4ms) ALTER TABLE "mks_rate_bundle_discounts" ADD CONSTRAINT "fk_rails_72a3777128" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.5ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.3ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.2ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.3ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.2ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.5ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.1ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.2ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (16.7ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (2.0ms) INSERT INTO "schema_migrations" (version) VALUES (20180308133826)  (1.7ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144), (20180303145739);   (7.4ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.7ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.6ms) BEGIN SQL (0.9ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-03-22 04:43:26.014993"], ["updated_at", "2018-03-22 04:43:26.014993"]]  (1.2ms) COMMIT ActiveRecord::InternalMetadata Load (0.6ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.6ms) BEGIN SQL (1.3ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-03-22 04:43:26.022463"], ["key", "environment"]]  (1.3ms) COMMIT  (1.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.7ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.5ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.5ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.6ms) DROP DATABASE IF EXISTS "construction_test"  (395.4ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (1.0ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.8ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (9.3ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (6.0ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (2.9ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (2.9ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (3.9ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (2.8ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (5.9ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (2.8ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (7.9ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (2.0ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.9ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.9ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.9ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (8.0ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.9ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (8.1ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.4ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (6.6ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (2.9ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.4ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (6.8ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (6.2ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (8.4ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.1ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (8.2ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_bundle_discounts" CASCADE  (5.5ms) CREATE TABLE "mks_rate_bundle_discounts" ("id" bigserial primary key, "chargeable_service_id" bigint, "service_bundle_id" bigint, "percent_discount" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.3ms) CREATE INDEX "cs_on_bd_indx" ON "mks_rate_bundle_discounts" ("chargeable_service_id")  (4.7ms) CREATE INDEX "sb_on_bd_indx" ON "mks_rate_bundle_discounts" ("service_bundle_id")  (0.9ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (5.9ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (6.7ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.1ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (2.9ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.8ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (6.4ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.4ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (4.4ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (8.8ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.5ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (8.6ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (6.2ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.0ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (6.3ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (6.6ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.2ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.3ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.7ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.0ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.3ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.5ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.1ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.2ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (3.3ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (3.6ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.1ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (3.4ms) ALTER TABLE "mks_rate_bundle_discounts" ADD CONSTRAINT "fk_rails_e6bce7b79c" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (3.0ms) ALTER TABLE "mks_rate_bundle_discounts" ADD CONSTRAINT "fk_rails_72a3777128" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (3.1ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (3.1ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (3.0ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (3.2ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (3.1ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (3.4ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (3.3ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (3.2ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.5ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.6ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (5.6ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (0.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.6ms) INSERT INTO "schema_migrations" (version) VALUES (20180308133826)  (1.3ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144);   (6.3ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.6ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.7ms) BEGIN SQL (1.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-04-01 10:01:51.581531"], ["updated_at", "2018-04-01 10:01:51.581531"]]  (1.2ms) COMMIT ActiveRecord::InternalMetadata Load (0.5ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.5ms) BEGIN SQL (0.8ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-04-01 10:01:51.588683"], ["key", "environment"]]  (1.3ms) COMMIT  (2.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.2ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (1.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.4ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (1.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.0ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (122.2ms) DROP DATABASE IF EXISTS "construction_development"  (126.6ms) DROP DATABASE IF EXISTS "construction_test"  (8.2ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (5.7ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) SELECT pg_try_advisory_lock(8683284875916872550)  (0.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC Migrating to CreateMksRateUnitOfCharges (20171212165507)  (0.7ms) BEGIN  (6.1ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) SQL (1.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20171212165507"]]  (2.0ms) COMMIT Migrating to CreateMksRateServiceDeliveryUnits (20171213152154)  (0.7ms) BEGIN  (7.7ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) SQL (0.8ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20171213152154"]]  (1.7ms) COMMIT Migrating to CreateMksRateServiceTypes (20171213152159)  (0.6ms) BEGIN  (10.1ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) SQL (0.8ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20171213152159"]]  (1.6ms) COMMIT Migrating to CreateMksRateChargeableServices (20171214152030)  (0.6ms) BEGIN  (8.9ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (2.7ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (2.5ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (2.6ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (2.9ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.3ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (1.7ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (1.6ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.4ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")  SQL (1.0ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20171214152030"]]  (1.9ms) COMMIT Migrating to CreateMksRateChargeableServiceDiscounts (20171215092528)  (0.7ms) BEGIN  (5.9ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.7ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")  SQL (1.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20171215092528"]]  (1.6ms) COMMIT Migrating to CreateMksRateServiceRates (20180125113530)  (0.5ms) BEGIN  (4.8ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.1ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (2.4ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (3.3ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (1.8ms) ROLLBACK  (1.2ms) SELECT pg_advisory_unlock(8683284875916872550)  (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.5ms) SELECT pg_try_advisory_lock(8683284875916872550)  (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC Migrating to CreateMksRateChargeableServiceDiscounts (20171215092528)  (0.7ms) BEGIN  (2.2ms) ALTER TABLE "mks_rate_chargeable_service_discounts" DROP CONSTRAINT "fk_rails_688682e0b5"  (2.2ms) DROP TABLE "mks_rate_chargeable_service_discounts" SQL (1.3ms) DELETE FROM "schema_migrations" WHERE "schema_migrations"."version" = $1 [["version", "20171215092528"]]  (2.3ms) COMMIT Migrating to CreateMksRateChargeableServices (20171214152030)  (0.7ms) BEGIN  (2.3ms) ALTER TABLE "mks_rate_chargeable_services" DROP CONSTRAINT "fk_rails_4e0ff36276"  (1.7ms) ALTER TABLE "mks_rate_chargeable_services" DROP CONSTRAINT "fk_rails_a4bbde1129"  (1.5ms) ALTER TABLE "mks_rate_chargeable_services" DROP CONSTRAINT "fk_rails_323d899c02"  (1.2ms) ALTER TABLE "mks_rate_chargeable_services" DROP CONSTRAINT "fk_rails_c9195a9eb4"  (1.5ms) DROP TABLE "mks_rate_chargeable_services" SQL (0.8ms) DELETE FROM "schema_migrations" WHERE "schema_migrations"."version" = $1 [["version", "20171214152030"]]  (2.0ms) COMMIT Migrating to CreateMksRateServiceTypes (20171213152159)  (0.6ms) BEGIN  (1.3ms) DROP TABLE "mks_rate_service_types" SQL (0.7ms) DELETE FROM "schema_migrations" WHERE "schema_migrations"."version" = $1 [["version", "20171213152159"]]  (1.6ms) COMMIT Migrating to CreateMksRateServiceDeliveryUnits (20171213152154)  (0.6ms) BEGIN  (1.5ms) DROP TABLE "mks_rate_service_delivery_units" SQL (0.9ms) DELETE FROM "schema_migrations" WHERE "schema_migrations"."version" = $1 [["version", "20171213152154"]]  (2.3ms) COMMIT Migrating to CreateMksRateUnitOfCharges (20171212165507)  (0.5ms) BEGIN  (1.5ms) DROP TABLE "mks_rate_unit_of_charges" SQL (1.0ms) DELETE FROM "schema_migrations" WHERE "schema_migrations"."version" = $1 [["version", "20171212165507"]]  (2.0ms) COMMIT  (0.8ms) SELECT pg_advisory_unlock(8683284875916872550)  (0.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.5ms) SELECT pg_try_advisory_lock(8683284875916872550)  (1.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC Migrating to CreateMksRateUnitOfCharges (20171212165507)  (1.3ms) BEGIN  (15.4ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) SQL (0.9ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20171212165507"]]  (2.6ms) COMMIT Migrating to CreateMksRateServiceDeliveryUnits (20171213152154)  (0.5ms) BEGIN  (9.0ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) SQL (0.8ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20171213152154"]]  (1.4ms) COMMIT Migrating to CreateMksRateServiceTypes (20171213152159)  (0.5ms) BEGIN  (8.6ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) SQL (1.5ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20171213152159"]]  (2.1ms) COMMIT Migrating to CreateMksRateChargeableServices (20171214152030)  (2.1ms) BEGIN  (10.0ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (2.5ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (2.4ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (3.8ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.2ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (1.6ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (1.4ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (1.4ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")  SQL (0.8ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20171214152030"]]  (1.7ms) COMMIT Migrating to CreateMksRateChargeableServiceDiscounts (20171215092528)  (0.5ms) BEGIN  (8.5ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (2.2ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")  SQL (0.7ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20171215092528"]]  (1.3ms) COMMIT Migrating to CreateMksRateServiceRates (20180125113530)  (0.6ms) BEGIN  (5.7ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.5ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.6ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (3.6ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.9ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")  SQL (3.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180125113530"]]  (2.3ms) COMMIT Migrating to CreateMksRateServiceBundles (20180303134144)  (1.1ms) BEGIN  (8.9ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (2.5ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (1.6ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")  SQL (0.7ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180303134144"]]  (2.2ms) COMMIT Migrating to CreateMksRateRateChangeRequests (20180308133826)  (1.1ms) BEGIN  (6.3ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (2.8ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (8.7ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (5.0ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (3.0ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")  SQL (2.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180308133826"]]  (3.0ms) COMMIT ActiveRecord::InternalMetadata Load (1.4ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (1.1ms) BEGIN  (1.4ms) COMMIT  (1.5ms) SELECT pg_advisory_unlock(8683284875916872550)  (0.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (2.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.7ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.7ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (121.9ms) DROP DATABASE IF EXISTS "construction_test"  (323.4ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.6ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.5ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (10.5ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.2ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (8.0ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.3ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.5ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (5.9ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.9ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (9.9ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (7.5ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (1.6ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.0ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.6ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (4.1ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (5.9ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (1.1ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (8.3ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.3ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (8.2ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.4ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.9ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (8.7ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (2.9ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.4ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (7.0ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (6.6ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.2ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (6.1ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (8.2ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (8.9ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.2ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (9.2ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT 'f', "checkout_confirmed" boolean DEFAULT 'f', "checkin_confirmed" boolean DEFAULT 'f', "costs_approved" boolean DEFAULT 'f', "prepared_by_id" integer)  (3.7ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (4.1ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (3.6ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (3.6ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (3.9ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (2.9ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (2.8ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.4ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (7.3ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (6.0ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (3.3ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (10.9ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT 'f', "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (5.6ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (10.4ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (3.2ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (7.6ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (6.4ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.9ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (4.4ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.8ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (3.2ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (16.0ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.8ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (17.6ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.1ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (12.5ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.1ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (4.1ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (4.9ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.1ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (6.4ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.0ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (7.3ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (9.0ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.0ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (13.4ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.0ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (8.9ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (4.1ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (6.5ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (8.1ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.0ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.1ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.2ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.9ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (3.1ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.5ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (3.2ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.6ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (3.8ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (3.6ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.1ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.3ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (4.9ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (3.3ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (3.2ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (5.2ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (4.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (3.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.2ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (4.3ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.2ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (3.7ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.7ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.4ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.5ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (3.0ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (5.2ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (3.1ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (3.2ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (3.9ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (4.4ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (10.9ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (2.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.5ms) INSERT INTO "schema_migrations" (version) VALUES (20180317043420)  (1.2ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144), (20180308133826);   (5.7ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.7ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.7ms) BEGIN SQL (1.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-04-01 10:08:27.782660"], ["updated_at", "2018-04-01 10:08:27.782660"]]  (1.5ms) COMMIT ActiveRecord::InternalMetadata Load (1.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.7ms) BEGIN SQL (1.1ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-04-01 10:08:27.792314"], ["key", "environment"]]  (2.9ms) COMMIT  (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.8ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.8ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.9ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (113.1ms) DROP DATABASE IF EXISTS "construction_test"  (355.7ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.9ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (1.5ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (13.4ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (6.9ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.9ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (4.1ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.3ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (6.9ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (9.4ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (2.0ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (4.8ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.9ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (5.1ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (1.1ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (8.7ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (6.0ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (1.1ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (6.4ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.1ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (6.4ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.2ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (8.8ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.2ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (8.9ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.4ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (8.1ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (5.9ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (7.9ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (7.8ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT 'f', "checkout_confirmed" boolean DEFAULT 'f', "checkin_confirmed" boolean DEFAULT 'f', "costs_approved" boolean DEFAULT 'f', "prepared_by_id" integer)  (3.0ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (3.3ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (6.0ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (3.5ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (4.4ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (4.1ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (6.6ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.9ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (8.6ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (7.3ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (5.4ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (6.6ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT 'f', "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.1ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (3.1ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (3.1ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (4.8ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (7.8ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (10.0ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.0ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (1.8ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (6.7ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.0ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (5.3ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (6.1ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (7.3ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (6.0ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.2ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (4.4ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (5.1ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (1.2ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (14.7ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (8.5ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (5.3ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (6.3ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (7.3ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (8.3ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (4.5ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (9.1ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (9.6ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (1.0ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (15.7ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.1ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (6.4ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (3.4ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.5ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.5ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.1ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.4ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.4ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (3.3ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.2ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.0ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (3.1ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.1ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (3.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (4.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (4.1ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (5.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (5.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (4.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (4.4ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (5.6ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (6.0ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (8.5ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (5.0ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (6.3ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (2.8ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.9ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (5.1ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.3ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.3ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.3ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.8ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (3.1ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.9ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (5.7ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (10.5ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (6.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (3.5ms) INSERT INTO "schema_migrations" (version) VALUES (20180317043420)  (2.4ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144), (20180308133826);   (10.9ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (1.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.8ms) BEGIN SQL (1.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-04-01 10:09:17.077968"], ["updated_at", "2018-04-01 10:09:17.077968"]]  (1.2ms) COMMIT ActiveRecord::InternalMetadata Load (0.6ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.6ms) BEGIN SQL (0.9ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-04-01 10:09:17.085361"], ["key", "environment"]]  (2.0ms) COMMIT  (2.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.5ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.4ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (120.4ms) DROP DATABASE IF EXISTS "construction_test"  (328.3ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.9ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.8ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (11.5ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (6.5ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (2.8ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (3.7ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.0ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (6.0ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (2.8ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (7.1ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (2.1ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.9ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.8ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (2.2ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.7ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (8.6ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (6.3ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (6.7ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.7ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (3.0ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (7.2ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (2.9ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (7.0ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (8.8ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (8.7ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.1ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (8.8ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (7.2ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (6.8ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT 'f', "checkout_confirmed" boolean DEFAULT 'f', "checkin_confirmed" boolean DEFAULT 'f', "costs_approved" boolean DEFAULT 'f', "prepared_by_id" integer)  (2.9ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (3.2ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (3.0ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (3.0ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (3.0ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (2.9ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (4.0ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (8.8ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (8.2ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.0ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (3.9ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (8.1ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT 'f', "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (3.4ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (3.1ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (3.1ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (6.0ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (6.3ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (1.0ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (4.3ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (2.9ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.9ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (3.9ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (8.4ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (8.7ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (8.2ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.6ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.0ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.0ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (6.7ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.0ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.2ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (6.2ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.6ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (9.4ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (5.9ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (4.1ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (8.0ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (6.6ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.0ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.1ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.2ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.5ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.1ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.1ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.2ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.1ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.3ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.3ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.2ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (3.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (3.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (3.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (3.2ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (3.4ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (4.2ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (2.6ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.3ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.4ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.2ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.2ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.4ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.6ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (5.8ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (0.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.5ms) INSERT INTO "schema_migrations" (version) VALUES (20180317043420)  (1.3ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144), (20180308133826);   (5.3ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.6ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.8ms) BEGIN SQL (1.6ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-04-01 10:29:18.291618"], ["updated_at", "2018-04-01 10:29:18.291618"]]  (1.5ms) COMMIT ActiveRecord::InternalMetadata Load (0.7ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.6ms) BEGIN SQL (1.1ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-04-01 10:29:18.301956"], ["key", "environment"]]  (1.5ms) COMMIT  (1.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.9ms) SELECT pg_try_advisory_lock(8683284875916872550)  (1.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC Migrating to CreateMksRateRateChangeRequests (20180308133826)  (1.3ms) BEGIN  (2.0ms) ALTER TABLE "mks_rate_rate_change_requests" DROP CONSTRAINT "fk_rails_1ec309ecbf"  (1.3ms) ALTER TABLE "mks_rate_rate_change_requests" DROP CONSTRAINT "fk_rails_c0525c8963"  (1.0ms) DROP INDEX "index_mks_rate_rate_change_requests_on_reference_number"  (1.8ms) DROP TABLE "mks_rate_rate_change_requests" SQL (1.7ms) DELETE FROM "schema_migrations" WHERE "schema_migrations"."version" = $1 [["version", "20180308133826"]]  (10.3ms) COMMIT Migrating to CreateMksRateServiceBundles (20180303134144)  (0.6ms) BEGIN  (2.8ms) ALTER TABLE "mks_rate_service_bundles" DROP CONSTRAINT "fk_rails_d6c823a60f"  (2.9ms) DROP TABLE "mks_rate_service_bundles" SQL (2.5ms) DELETE FROM "schema_migrations" WHERE "schema_migrations"."version" = $1 [["version", "20180303134144"]]  (3.3ms) COMMIT  (1.6ms) SELECT pg_advisory_unlock(8683284875916872550)  (1.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT pg_try_advisory_lock(8683284875916872550)  (1.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC Migrating to CreateMksRateServiceBundles (20180303134144)  (0.8ms) BEGIN  (8.8ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (3.1ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")  SQL (1.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180303134144"]]  (2.7ms) COMMIT Migrating to CreateMksRateRateChangeRequests (20180308133826)  (0.8ms) BEGIN  (8.7ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (2.3ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (2.4ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (2.8ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (2.0ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (1.7ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")  SQL (0.7ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180308133826"]]  (1.5ms) COMMIT ActiveRecord::InternalMetadata Load (0.7ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.6ms) BEGIN  (0.5ms) COMMIT  (0.6ms) SELECT pg_advisory_unlock(8683284875916872550)  (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.0ms) SELECT pg_try_advisory_lock(8683284875916872550)  (1.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC Migrating to CreateMksRateServiceBundlesChargeableServices (20180401110018)  (0.9ms) SELECT pg_advisory_unlock(8683284875916872550)  (0.5ms) SELECT pg_try_advisory_lock(8683284875916872550)  (1.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC Migrating to CreateMksRateServiceBundlesChargeableServices (20180401110018)  (1.2ms) BEGIN  (2.9ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (2.0ms) ROLLBACK  (0.9ms) SELECT pg_advisory_unlock(8683284875916872550)  (0.5ms) SELECT pg_try_advisory_lock(8683284875916872550)  (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC Migrating to CreateMksRateServiceBundlesChargeableServices (20180401110018)  (0.7ms) BEGIN  (1.5ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (3.5ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (3.8ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.8ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")  SQL (1.7ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version" [["version", "20180401110018"]]  (3.5ms) COMMIT ActiveRecord::InternalMetadata Load (1.4ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.8ms) BEGIN  (0.7ms) COMMIT  (0.7ms) SELECT pg_advisory_unlock(8683284875916872550)  (0.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.5ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.5ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (127.2ms) DROP DATABASE IF EXISTS "construction_test"  (338.1ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.6ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.6ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (9.7ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (8.4ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.9ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (5.2ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (2.7ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (6.1ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (4.2ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (5.9ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (6.2ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (1.4ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.2ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.5ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (2.8ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (5.8ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.8ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (1.2ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (9.0ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.3ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (1.4ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (9.6ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (2.8ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (5.8ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (6.1ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (6.1ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (2.9ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (6.3ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (1.0ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (7.5ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (7.4ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (9.4ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT 'f', "checkout_confirmed" boolean DEFAULT 'f', "checkin_confirmed" boolean DEFAULT 'f', "costs_approved" boolean DEFAULT 'f', "prepared_by_id" integer)  (3.0ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (3.1ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (3.8ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (2.9ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (2.8ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (3.2ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (3.0ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (6.1ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (5.8ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (2.9ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (3.7ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (7.9ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT 'f', "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.0ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (3.7ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (3.7ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (3.6ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (6.4ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (6.4ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (4.1ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (2.9ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (2.9ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (6.3ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (6.0ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (6.8ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.6ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.6ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.6ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (7.9ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.8ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.9ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.9ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (8.4ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (1.8ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (3.0ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (6.0ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (4.2ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.9ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (1.2ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (9.5ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (8.8ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.3ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.8ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (3.1ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (3.3ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (3.1ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (3.1ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.5ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.4ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.2ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (2.2ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (2.1ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.2ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (3.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (3.2ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (3.2ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.8ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (3.2ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (3.3ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (3.3ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (3.8ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (3.8ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (3.4ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.9ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.4ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.4ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.3ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.3ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.5ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.2ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (6.0ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (2.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.5ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.2ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144), (20180308133826);   (5.4ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.6ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.8ms) BEGIN SQL (1.1ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-04-01 11:11:39.065658"], ["updated_at", "2018-04-01 11:11:39.065658"]]  (1.5ms) COMMIT ActiveRecord::InternalMetadata Load (0.8ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.6ms) BEGIN SQL (1.1ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-04-01 11:11:39.075182"], ["key", "environment"]]  (1.5ms) COMMIT  (1.4ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.8ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.9ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (120.3ms) DROP DATABASE IF EXISTS "construction_test"  (329.5ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.8ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.8ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (12.6ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (6.5ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (2.9ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (3.9ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.3ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (6.0ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (6.2ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (2.0ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (4.8ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (2.0ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (4.0ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.8ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (9.0ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.9ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.8ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (8.0ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (6.0ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (2.9ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (6.2ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (2.9ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (6.2ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (6.5ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.3ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (9.1ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (8.4ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (7.9ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (7.2ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT 'f', "checkout_confirmed" boolean DEFAULT 'f', "checkin_confirmed" boolean DEFAULT 'f', "costs_approved" boolean DEFAULT 'f', "prepared_by_id" integer)  (2.9ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (3.6ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (3.0ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (2.9ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (3.1ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (3.1ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (3.1ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (8.0ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (8.0ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (4.2ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (9.4ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT 'f', "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.9ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (3.6ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (3.2ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (3.0ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (6.1ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (6.1ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (4.0ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.1ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (4.8ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (11.6ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (8.8ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (8.7ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.0ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.0ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.3ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (8.9ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.0ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.5ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.9ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (7.4ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.1ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (2.4ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (4.1ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.8ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (8.3ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (6.2ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.0ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (6.4ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (5.9ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.3ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.6ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.7ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.2ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.2ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.8ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.2ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.0ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.4ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (3.4ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (3.2ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.5ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (3.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (3.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (3.2ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.2ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (3.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.2ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.1ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (2.6ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.7ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.6ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.3ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.2ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.5ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.8ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.2ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.5ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.2ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (7.7ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.9ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (2.2ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144), (20180308133826);   (7.3ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (1.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (1.0ms) BEGIN SQL (1.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-04-01 11:18:06.886428"], ["updated_at", "2018-04-01 11:18:06.886428"]]  (1.2ms) COMMIT ActiveRecord::InternalMetadata Load (0.6ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.6ms) BEGIN SQL (0.8ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-04-01 11:18:06.893671"], ["key", "environment"]]  (1.3ms) COMMIT  (0.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.5ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.5ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (131.1ms) DROP DATABASE IF EXISTS "construction_test"  (331.0ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.6ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.7ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (8.7ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (6.6ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (4.3ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (5.2ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (4.0ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (7.8ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (1.0ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (6.2ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (1.7ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.1ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.5ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.1ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (5.9ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (5.8ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (7.4ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.9ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.8ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.8ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (8.2ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.9ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (8.2ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (6.0ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (6.8ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (6.6ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (6.1ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (6.6ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT 'f', "checkout_confirmed" boolean DEFAULT 'f', "checkin_confirmed" boolean DEFAULT 'f', "costs_approved" boolean DEFAULT 'f', "prepared_by_id" integer)  (3.5ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (3.9ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (4.2ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (4.0ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (3.8ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (3.9ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (4.2ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (7.7ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (6.6ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (3.2ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (6.2ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT 'f', "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (3.3ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (3.1ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (3.4ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (8.1ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (8.5ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.9ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (5.8ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.9ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.1ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (3.0ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (6.2ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (6.4ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (5.9ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.1ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.4ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (4.4ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (8.3ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.0ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (4.1ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (4.1ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (8.5ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.4ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (2.4ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (4.1ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.8ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (8.5ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (5.7ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.8ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (8.3ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (8.4ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.3ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (3.1ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (3.3ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (3.1ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (3.0ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (3.2ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (3.3ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (3.1ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (3.5ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (4.2ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (4.2ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (5.1ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (4.8ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (3.3ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (3.2ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.0ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (4.2ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (3.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (3.2ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (4.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (4.4ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (4.2ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (5.4ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (6.8ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (4.2ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (4.6ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (4.1ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (5.1ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (5.1ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (5.3ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (3.2ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (3.4ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.7ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (3.5ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (3.3ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (3.5ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (3.0ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (3.0ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.7ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.3ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (5.5ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (2.3ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.8ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144), (20180308133826);   (6.9ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (1.3ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (1.1ms) BEGIN SQL (1.4ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-04-01 11:19:36.328800"], ["updated_at", "2018-04-01 11:19:36.328800"]]  (2.2ms) COMMIT ActiveRecord::InternalMetadata Load (1.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.8ms) BEGIN SQL (1.3ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-04-01 11:19:36.340821"], ["key", "environment"]]  (1.6ms) COMMIT  (1.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.7ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.9ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (132.9ms) DROP DATABASE IF EXISTS "construction_test"  (326.8ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.9ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.8ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (12.5ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (8.2ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (2.9ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (4.0ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.5ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (5.9ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.8ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (6.3ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (1.7ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (4.3ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (2.2ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (4.1ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.8ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (9.0ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.8ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (8.9ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (6.4ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.3ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (6.6ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (6.7ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (6.4ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.9ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (8.8ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.0ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (9.3ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (8.7ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (6.5ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT 'f', "checkout_confirmed" boolean DEFAULT 'f', "checkin_confirmed" boolean DEFAULT 'f', "costs_approved" boolean DEFAULT 'f', "prepared_by_id" integer)  (3.0ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (3.7ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (3.1ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (2.9ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (3.0ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (3.1ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (3.1ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (6.7ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (8.8ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.3ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (3.9ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (9.4ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT 'f', "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.9ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (3.1ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (3.0ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (3.0ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (6.5ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (6.1ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (4.0ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.0ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (3.8ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (8.3ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (8.0ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (8.5ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.2ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (4.4ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.1ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.0ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (6.4ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (2.9ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.5ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.2ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (6.2ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (1.8ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (4.0ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.9ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (8.7ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (6.1ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.7ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (8.5ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (6.4ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.2ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.2ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.3ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.1ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.3ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.2ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.3ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.3ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.3ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.2ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (3.2ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (3.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (3.2ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (3.6ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.2ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (3.2ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (2.5ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.7ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.5ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.7ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.9ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.6ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.2ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.3ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.1ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.5ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.2ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (6.9ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.7ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (2.2ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144), (20180308133826);   (7.3ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.9ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.9ms) BEGIN SQL (2.1ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-04-01 11:21:56.143558"], ["updated_at", "2018-04-01 11:21:56.143558"]]  (1.5ms) COMMIT ActiveRecord::InternalMetadata Load (0.8ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.7ms) BEGIN SQL (1.0ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-04-01 11:21:56.154597"], ["key", "environment"]]  (1.5ms) COMMIT  (1.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.0ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (1.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.5ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (126.8ms) DROP DATABASE IF EXISTS "construction_test"  (330.8ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.8ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.6ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (8.7ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (6.4ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.1ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.8ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (4.1ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.1ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (9.5ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.1ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (9.4ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (2.4ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (4.4ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (2.1ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.2ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (6.2ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (5.8ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (6.2ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.4ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (5.8ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.0ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (8.0ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (8.6ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.5ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (8.8ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (6.0ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (5.9ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (6.9ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT 'f', "checkout_confirmed" boolean DEFAULT 'f', "checkin_confirmed" boolean DEFAULT 'f', "costs_approved" boolean DEFAULT 'f', "prepared_by_id" integer)  (3.5ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (3.3ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (3.0ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (3.0ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (4.0ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (4.0ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (3.9ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (8.4ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (6.7ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (3.5ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (6.3ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT 'f', "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (2.9ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (3.0ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (2.9ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (5.9ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (6.3ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (2.9ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (4.5ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.2ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (4.5ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (4.5ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (7.8ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (8.1ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (6.1ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (2.9ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.1ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.2ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.1ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (6.5ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.1ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.3ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.8ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (7.3ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (2.0ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (4.3ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (6.9ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (4.9ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.5ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (6.1ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (6.1ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (2.9ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.1ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.3ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.3ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.1ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.3ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.1ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.2ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.2ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (7.4ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (6.0ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (3.1ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.8ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (3.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (3.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (3.2ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (3.4ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (3.3ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (3.2ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (2.9ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.3ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.4ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.3ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.1ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.4ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.2ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (3.4ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (3.5ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (4.2ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.9ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (7.5ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (2.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (2.1ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.9ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144), (20180308133826);   (7.2ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (1.8ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.6ms) BEGIN SQL (0.9ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-04-01 11:22:36.946598"], ["updated_at", "2018-04-01 11:22:36.946598"]]  (1.3ms) COMMIT ActiveRecord::InternalMetadata Load (0.6ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.5ms) BEGIN SQL (0.8ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-04-01 11:22:36.953974"], ["key", "environment"]]  (1.2ms) COMMIT  (1.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.1ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.4ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.5ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (121.3ms) DROP DATABASE IF EXISTS "construction_test"  (331.1ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.8ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.6ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (8.2ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (6.0ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (2.9ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (2.9ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (3.8ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.0ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (5.8ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.4ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (8.1ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (2.2ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (4.2ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (2.1ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (4.2ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.9ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (7.7ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (5.5ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (5.9ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (2.9ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.2ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (6.1ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (2.8ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (6.9ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (8.4ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.1ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (8.7ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.9ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (7.7ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (5.8ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (6.2ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT 'f', "checkout_confirmed" boolean DEFAULT 'f', "checkin_confirmed" boolean DEFAULT 'f', "costs_approved" boolean DEFAULT 'f', "prepared_by_id" integer)  (3.1ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (2.9ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (3.1ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (2.9ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (3.0ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (2.9ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (3.7ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (8.1ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (8.1ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.0ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (4.2ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (8.4ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT 'f', "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (3.0ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (3.4ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (2.9ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (5.8ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (5.8ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (3.9ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.5ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (4.0ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (7.9ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (8.4ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (7.8ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.3ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (2.9ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.0ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.0ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (5.8ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.0ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.1ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (6.0ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (1.7ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (4.6ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (8.4ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (6.2ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (4.3ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (6.7ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (6.1ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.1ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.1ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.2ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.1ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.8ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.2ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.2ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.2ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.3ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.2ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (3.2ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (3.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (3.2ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (3.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (3.8ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (3.3ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.2ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (2.6ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.2ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.4ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.3ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.3ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.4ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.3ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.1ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.1ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (5.6ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.4ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.2ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144), (20180308133826);   (6.6ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.8ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.8ms) BEGIN SQL (1.1ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-04-01 11:23:28.152357"], ["updated_at", "2018-04-01 11:23:28.152357"]]  (1.4ms) COMMIT ActiveRecord::InternalMetadata Load (0.7ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.6ms) BEGIN SQL (1.1ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-04-01 11:23:28.161736"], ["key", "environment"]]  (1.6ms) COMMIT  (1.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.5ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.5ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (129.5ms) DROP DATABASE IF EXISTS "construction_test"  (323.1ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.6ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.6ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (10.1ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (7.9ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.9ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (5.2ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.7ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.9ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (6.1ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (6.9ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (1.5ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.0ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.4ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.6ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (5.9ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (6.5ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.8ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (8.2ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.6ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (7.6ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.1ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (5.9ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (7.0ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (6.6ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (2.9ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (5.9ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (6.5ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (8.5ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT 'f', "checkout_confirmed" boolean DEFAULT 'f', "checkin_confirmed" boolean DEFAULT 'f', "costs_approved" boolean DEFAULT 'f', "prepared_by_id" integer)  (3.9ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (4.0ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (3.7ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (4.3ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (4.3ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (3.4ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (3.3ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (6.3ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (5.9ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (3.1ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (6.6ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT 'f', "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (2.9ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (4.6ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (3.9ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (8.6ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (8.3ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.0ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (6.5ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.0ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (3.0ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (6.0ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (6.3ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (6.7ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.1ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.3ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (4.2ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (8.6ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.9ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (4.0ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (4.2ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.8ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (8.8ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (1.6ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (3.3ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (5.9ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (4.2ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.0ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (7.0ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (6.6ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.3ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (3.0ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (3.1ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (3.0ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.9ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (3.0ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (3.0ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (3.0ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.7ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (3.1ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (3.4ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.4ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.3ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.0ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (2.2ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.1ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.2ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.2ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.1ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.2ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.0ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.2ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (3.4ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (3.1ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (3.4ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (3.1ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (3.0ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (3.3ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (3.3ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (3.4ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (3.0ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.7ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (3.4ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.6ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (5.8ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.4ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.1ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144), (20180308133826);   (5.5ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.6ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.7ms) BEGIN SQL (1.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-04-01 11:25:46.085613"], ["updated_at", "2018-04-01 11:25:46.085613"]]  (1.6ms) COMMIT ActiveRecord::InternalMetadata Load (0.5ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.5ms) BEGIN SQL (0.8ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-04-01 11:25:46.093454"], ["key", "environment"]]  (1.1ms) COMMIT  (1.4ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (2.5ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.7ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.6ms) DROP DATABASE IF EXISTS "construction_test"  (465.4ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.7ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.8ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (11.5ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (6.5ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (4.2ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (5.5ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (4.6ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.9ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (9.6ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.2ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.8ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (7.4ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (1.7ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.4ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.7ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.4ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (6.9ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (6.2ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (7.5ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.5ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (4.8ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.8ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (9.3ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.1ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (7.2ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (7.4ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (6.7ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (6.4ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (7.1ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (8.5ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT 'f', "checkout_confirmed" boolean DEFAULT 'f', "checkin_confirmed" boolean DEFAULT 'f', "costs_approved" boolean DEFAULT 'f', "prepared_by_id" integer)  (4.1ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (4.5ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (4.9ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (4.5ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (3.3ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (3.2ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (3.1ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (6.6ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (6.5ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (3.2ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (6.8ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT 'f', "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (3.7ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (4.5ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (4.1ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (9.0ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (8.9ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (4.2ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.1ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (3.0ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (6.5ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (6.8ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (6.4ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (4.2ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (4.2ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (4.4ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.8ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (8.8ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (4.0ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.8ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (6.3ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (2.0ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (3.3ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (6.5ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (4.5ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (5.2ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (9.5ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (9.1ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.2ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (3.8ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (3.3ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (3.0ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.1ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.3ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.2ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.0ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.8ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.0ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.2ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (2.2ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (2.2ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.2ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (3.3ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (3.2ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (3.3ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.4ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (3.2ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (3.8ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (3.3ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (4.4ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (3.8ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.7ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.5ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.3ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.8ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.3ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.0ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.3ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (6.0ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.6ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.6ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144), (20180308133826);   (6.3ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.7ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.6ms) BEGIN SQL (1.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-04-06 07:58:04.296009"], ["updated_at", "2018-04-06 07:58:04.296009"]]  (1.4ms) COMMIT ActiveRecord::InternalMetadata Load (0.8ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.7ms) BEGIN SQL (1.2ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-04-06 07:58:04.305538"], ["key", "environment"]]  (1.7ms) COMMIT  (0.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.5ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (135.9ms) DROP DATABASE IF EXISTS "construction_test"  (317.5ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.6ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.6ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (10.5ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (8.8ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.3ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.1ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (3.9ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.1ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.8ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (8.8ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.0ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (6.3ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (1.5ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.1ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.5ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.1ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (6.0ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (5.9ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.5ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (8.2ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.6ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (6.7ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (1.1ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (8.8ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (6.4ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (6.4ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (5.9ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (5.8ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (10.0ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT 'f', "checkout_confirmed" boolean DEFAULT 'f', "checkin_confirmed" boolean DEFAULT 'f', "costs_approved" boolean DEFAULT 'f', "prepared_by_id" integer)  (4.5ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (4.3ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (3.0ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (3.9ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (5.5ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (3.0ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (3.0ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (6.3ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (5.9ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (3.2ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (6.1ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT 'f', "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.9ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (4.9ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (5.6ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (4.6ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (8.3ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (10.8ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (10.1ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (4.0ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (2.9ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.5ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (3.1ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (5.9ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (7.7ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.0ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (9.2ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.1ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.5ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.1ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.5ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.9ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (9.4ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.2ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.1ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (6.1ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (1.6ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (3.1ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (5.8ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (6.7ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.8ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (4.5ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (1.6ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (8.2ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (9.9ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.5ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.2ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.2ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.3ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.0ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.2ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.2ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.1ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (3.9ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.3ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.3ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.3ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.3ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (2.1ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (3.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (3.2ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (3.3ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.2ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (4.5ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (3.3ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.2ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.3ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.4ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.6ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.7ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.2ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.2ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.1ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.6ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.3ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (5.8ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.5ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.9ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144), (20180308133826);   (5.3ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.7ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.8ms) BEGIN SQL (1.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-04-06 07:58:53.918530"], ["updated_at", "2018-04-06 07:58:53.918530"]]  (1.4ms) COMMIT ActiveRecord::InternalMetadata Load (0.9ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.7ms) BEGIN SQL (0.9ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-04-06 07:58:53.928340"], ["key", "environment"]]  (1.5ms) COMMIT  (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.4ms) SELECT pg_try_advisory_lock(8683284875916872550)  (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.5ms) SELECT pg_advisory_unlock(8683284875916872550)  (1.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.7ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.5ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.7ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (5115.6ms) DROP DATABASE IF EXISTS "construction_development"  (1.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.4ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.4ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (134.1ms) DROP DATABASE IF EXISTS "construction_test"  (324.0ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.7ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.7ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (9.6ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (7.3ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.4ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (4.8ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (4.7ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.2ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (5.9ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (6.9ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (1.7ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.2ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.5ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.5ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (6.1ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (6.1ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (7.5ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.4ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (4.5ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.8ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (6.1ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (6.9ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (6.3ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (7.3ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (6.4ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (7.0ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (7.6ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT 'f', "checkout_confirmed" boolean DEFAULT 'f', "checkin_confirmed" boolean DEFAULT 'f', "costs_approved" boolean DEFAULT 'f', "prepared_by_id" integer)  (4.4ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (4.2ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (4.1ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (3.2ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (3.2ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (3.3ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (3.2ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (6.2ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (6.3ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (3.0ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (6.5ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT 'f', "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (3.1ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (3.2ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (3.0ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (9.2ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.0ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (9.1ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (4.2ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.8ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (3.8ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (7.1ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (6.5ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (6.9ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.5ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.4ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.7ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (9.5ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.4ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (4.1ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.8ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (7.5ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (2.2ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (3.7ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (6.5ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (4.4ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.3ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (6.7ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (8.0ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.0ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (8.3ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (7.3ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (3.0ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (3.1ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.2ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.2ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.6ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.2ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.3ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.2ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.4ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.9ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.8ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.2ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (3.4ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (3.3ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (3.3ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.4ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (3.3ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (2.5ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.7ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.7ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.7ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.3ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (3.0ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (3.4ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.6ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.5ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.5ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.5ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (6.4ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.5ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.4ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144), (20180308133826);   (6.1ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.7ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.6ms) BEGIN SQL (0.9ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-04-06 11:07:52.627415"], ["updated_at", "2018-04-06 11:07:52.627415"]]  (1.3ms) COMMIT ActiveRecord::InternalMetadata Load (1.4ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.8ms) BEGIN SQL (1.1ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-04-06 11:07:52.637527"], ["key", "environment"]]  (1.7ms) COMMIT  (1.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.0ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.4ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.5ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (125.4ms) DROP DATABASE IF EXISTS "construction_test"  (340.1ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.6ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.6ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (9.5ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (6.7ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.1ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (4.1ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.1ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (6.8ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (6.3ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (2.5ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (5.6ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.8ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (2.3ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.9ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (6.2ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (6.5ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (6.5ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.1ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (6.0ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (6.2ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (6.3ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (9.6ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.1ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (7.1ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (6.1ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (6.8ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT 'f', "checkout_confirmed" boolean DEFAULT 'f', "checkin_confirmed" boolean DEFAULT 'f', "costs_approved" boolean DEFAULT 'f', "prepared_by_id" integer)  (3.1ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (3.1ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (3.1ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (3.0ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (3.2ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (3.0ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (3.5ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (6.7ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (6.9ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.5ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (4.3ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (8.1ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT 'f', "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (3.3ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (3.2ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (3.1ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (6.8ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (6.0ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (4.3ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.0ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (3.3ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (6.9ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (9.9ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (7.5ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.2ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.5ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.1ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (6.4ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.2ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.4ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (7.0ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (1.8ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (3.2ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (6.3ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (6.6ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.5ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.2ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (6.0ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (7.0ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (6.1ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (6.8ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (3.1ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (3.2ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.2ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.2ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.3ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.2ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.3ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.2ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.0ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.3ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.3ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (3.9ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (3.6ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.1ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (4.2ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (3.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.2ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (2.2ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.2ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.2ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (2.5ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.7ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (3.1ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.3ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.3ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.7ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.2ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.2ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.3ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.2ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.4ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (6.1ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.6ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.4ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144), (20180308133826);   (6.3ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.9ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.8ms) BEGIN SQL (1.3ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-04-06 11:10:09.974958"], ["updated_at", "2018-04-06 11:10:09.974958"]]  (1.3ms) COMMIT ActiveRecord::InternalMetadata Load (0.6ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.6ms) BEGIN SQL (1.0ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-04-06 11:10:09.983464"], ["key", "environment"]]  (1.4ms) COMMIT  (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.9ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.5ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (121.4ms) DROP DATABASE IF EXISTS "construction_test"  (322.0ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.8ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.7ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (10.9ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (9.9ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.2ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.5ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (4.4ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.8ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (7.2ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (6.6ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (2.0ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (4.4ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.8ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.5ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (6.3ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.8ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (9.9ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.7ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (7.5ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.4ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (6.5ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.8ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (7.6ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (6.9ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (6.5ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (6.1ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (9.4ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (8.9ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT 'f', "checkout_confirmed" boolean DEFAULT 'f', "checkin_confirmed" boolean DEFAULT 'f', "costs_approved" boolean DEFAULT 'f', "prepared_by_id" integer)  (3.3ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (3.1ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (3.0ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (3.3ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (3.4ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (3.3ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (3.1ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (6.1ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (6.1ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (3.1ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (6.7ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT 'f', "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.2ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (4.1ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (4.2ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (3.2ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (6.3ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (6.1ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (4.3ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.2ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (3.2ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (6.2ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (6.0ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (6.9ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (4.3ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (4.3ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (4.4ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (6.3ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.2ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.6ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (8.0ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (1.9ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (3.3ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (6.4ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (5.3ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.2ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (7.9ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (9.8ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (7.1ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (6.4ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (3.2ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (3.3ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.1ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.2ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.3ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.2ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.4ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.5ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.2ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (3.0ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.3ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.3ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.3ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (3.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (3.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (3.8ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.2ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.2ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.2ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (2.7ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.6ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.6ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.3ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.2ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.5ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.3ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.2ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.3ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.2ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.4ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (6.5ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.6ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.3ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144), (20180308133826);   (5.8ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.7ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.7ms) BEGIN SQL (1.4ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-04-06 11:10:25.313959"], ["updated_at", "2018-04-06 11:10:25.313959"]]  (1.9ms) COMMIT ActiveRecord::InternalMetadata Load (1.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.8ms) BEGIN SQL (1.0ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-04-06 11:10:25.325764"], ["key", "environment"]]  (1.7ms) COMMIT  (1.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.2ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.5ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.2ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (117.1ms) DROP DATABASE IF EXISTS "construction_test"  (334.4ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (1.2ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (1.0ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (9.6ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (7.9ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.8ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (4.7ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (4.2ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.9ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (7.0ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.9ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (1.3ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (9.3ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.1ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (3.8ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (4.9ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (1.1ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (2.8ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.2ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (6.7ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (7.0ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.7ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (7.4ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.9ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (1.2ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (7.9ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.8ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (1.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (9.6ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.1ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (8.1ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (1.0ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (6.8ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.9ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (7.1ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (7.1ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.0ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (8.0ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT 'f', "checkout_confirmed" boolean DEFAULT 'f', "checkin_confirmed" boolean DEFAULT 'f', "costs_approved" boolean DEFAULT 'f', "prepared_by_id" integer)  (4.4ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (3.4ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (6.2ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (5.7ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (4.5ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (4.0ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (3.7ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (6.9ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (7.5ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (3.9ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (6.7ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT 'f', "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (3.4ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (4.7ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (5.0ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (2.9ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (10.6ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (6.9ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (4.6ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.4ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.7ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (3.5ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (6.9ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (7.3ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.1ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (6.6ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.5ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (5.8ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (6.6ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (4.8ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.8ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (7.4ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.1ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.6ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.9ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (1.5ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (7.8ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (2.3ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (3.7ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (1.0ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (7.1ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (7.3ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.8ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (5.6ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (1.0ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (11.7ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (7.3ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (6.6ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (8.4ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (3.6ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (4.6ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.5ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.5ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (3.5ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.9ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (5.2ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (12.2ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (4.3ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (5.6ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (3.3ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (3.0ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.8ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.9ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.9ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (3.4ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (3.2ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (3.7ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (5.5ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (4.6ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (3.3ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (4.1ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (4.0ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.6ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.5ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.6ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.4ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.7ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (6.2ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (2.4ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.6ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144), (20180308133826);   (6.3ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.7ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.7ms) BEGIN SQL (1.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-04-06 13:48:04.856889"], ["updated_at", "2018-04-06 13:48:04.856889"]]  (1.4ms) COMMIT ActiveRecord::InternalMetadata Load (0.7ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.8ms) BEGIN SQL (1.3ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-04-06 13:48:04.866012"], ["key", "environment"]]  (1.5ms) COMMIT  (1.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.9ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.8ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.9ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (118.9ms) DROP DATABASE IF EXISTS "construction_test"  (347.3ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.6ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.6ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (9.7ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (6.0ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.0ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (4.1ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.1ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (6.8ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.2ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.8ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (8.9ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (2.6ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.9ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.5ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.3ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (6.8ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (6.1ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (6.5ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.1ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (6.1ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (10.1ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (8.9ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (6.7ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (5.9ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (6.6ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (7.1ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT 'f', "checkout_confirmed" boolean DEFAULT 'f', "checkin_confirmed" boolean DEFAULT 'f', "costs_approved" boolean DEFAULT 'f', "prepared_by_id" integer)  (3.2ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (3.2ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (3.2ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (3.2ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (3.1ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (3.7ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (5.0ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (9.2ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (7.0ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (3.4ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (6.2ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT 'f', "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (3.2ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (3.0ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (3.1ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (6.0ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (5.9ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (4.0ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.0ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (4.3ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (5.2ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (8.0ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (7.1ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (6.0ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.1ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.1ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.4ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (6.3ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.3ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.3ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (6.1ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.1ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (2.7ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (4.3ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (9.3ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (4.9ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.2ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (7.2ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (6.4ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (6.0ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (6.4ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (3.1ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (3.2ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.0ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.2ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.6ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (3.3ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (3.5ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (3.7ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (3.4ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (3.0ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (3.5ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (3.4ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.8ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.8ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.1ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (2.2ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.1ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.1ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.2ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.2ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (2.6ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.4ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.7ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.3ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.1ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.9ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (3.6ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (3.9ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (3.6ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (3.5ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (3.7ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.2ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.6ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (5.7ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.6ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.3ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144), (20180308133826);   (5.8ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.7ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.9ms) BEGIN SQL (1.1ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-04-06 13:50:06.627667"], ["updated_at", "2018-04-06 13:50:06.627667"]]  (1.3ms) COMMIT ActiveRecord::InternalMetadata Load (0.6ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.6ms) BEGIN SQL (0.8ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-04-06 13:50:06.635714"], ["key", "environment"]]  (1.3ms) COMMIT  (1.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.1ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.7ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (1.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.7ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (127.6ms) DROP DATABASE IF EXISTS "construction_test"  (333.6ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.7ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.7ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (10.8ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (6.7ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.6ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (4.1ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.5ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (7.1ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (7.2ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.0ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (3.3ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (4.9ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (1.0ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (2.5ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (4.3ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (6.8ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (6.9ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (6.8ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.6ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (6.7ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (9.0ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.0ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (10.3ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.7ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.9ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (7.1ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (7.5ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (6.8ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (8.0ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT 'f', "checkout_confirmed" boolean DEFAULT 'f', "checkin_confirmed" boolean DEFAULT 'f', "costs_approved" boolean DEFAULT 'f', "prepared_by_id" integer)  (3.9ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (3.5ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (3.7ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (3.3ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (5.0ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (4.9ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (5.3ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.9ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (8.1ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (6.9ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.1ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (4.9ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (7.3ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT 'f', "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.3ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (4.0ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (4.0ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (3.5ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (8.6ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.0ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (9.8ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.3ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.9ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (5.0ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.6ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (3.6ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (7.6ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (6.6ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (7.0ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.3ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.5ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.6ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.9ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (9.7ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.5ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.9ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.9ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.8ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (6.8ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (1.8ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (3.5ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (1.0ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (7.1ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (5.2ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.4ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (7.2ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (8.7ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (8.5ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.0ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (9.6ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (3.5ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (3.4ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.3ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (3.1ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (3.1ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (3.0ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.5ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.6ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.8ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.2ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (3.0ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.8ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (3.3ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (4.1ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (4.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (3.9ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (4.1ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (3.8ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (3.0ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.7ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.9ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.6ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.8ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (3.2ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (3.0ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.8ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.3ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.6ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (3.0ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (6.6ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.7ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (2.0ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144), (20180308133826);   (10.5ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (1.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.9ms) BEGIN SQL (1.7ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-04-06 15:51:54.398819"], ["updated_at", "2018-04-06 15:51:54.398819"]]  (1.9ms) COMMIT ActiveRecord::InternalMetadata Load (0.8ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.6ms) BEGIN SQL (1.0ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-04-06 15:51:54.410091"], ["key", "environment"]]  (1.5ms) COMMIT  (1.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.8ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.7ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (125.6ms) DROP DATABASE IF EXISTS "construction_test"  (337.4ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.8ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.8ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (10.0ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (7.2ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.9ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (1.0ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (6.9ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (5.4ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.9ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (10.2ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (6.5ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (2.0ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.6ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.7ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.5ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (6.7ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.9ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (7.3ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (7.0ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.9ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (4.6ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (6.5ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (6.1ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (7.5ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (8.2ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (6.7ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (6.6ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.2ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (10.6ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT 'f', "checkout_confirmed" boolean DEFAULT 'f', "checkin_confirmed" boolean DEFAULT 'f', "costs_approved" boolean DEFAULT 'f', "prepared_by_id" integer)  (4.9ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (3.5ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (3.4ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (3.3ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (3.7ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (3.5ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (3.6ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (7.3ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (6.8ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.0ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (3.3ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (9.4ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT 'f', "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.9ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (4.6ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (3.6ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (3.5ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (7.9ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (7.0ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (5.8ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.5ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (3.8ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (7.2ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (9.9ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (9.7ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.6ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (4.7ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.4ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.3ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (6.8ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.7ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.5ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (7.4ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (2.0ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (4.3ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.8ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (10.0ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.2ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (7.4ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.3ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (7.1ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.2ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (6.6ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (6.3ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (7.0ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (3.7ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (3.5ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.8ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.7ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.5ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.4ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (3.0ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (3.5ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (3.6ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (4.6ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (3.8ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (4.0ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (4.1ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.9ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.9ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (3.0ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (4.2ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.9ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (4.0ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (3.2ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (4.2ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (4.3ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (3.6ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (4.1ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (3.5ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (5.1ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.7ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.3ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.7ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.3ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.7ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (6.8ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.5ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.5ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144), (20180308133826);   (6.3ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.8ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.8ms) BEGIN SQL (1.1ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-04-06 15:52:36.271244"], ["updated_at", "2018-04-06 15:52:36.271244"]]  (1.4ms) COMMIT ActiveRecord::InternalMetadata Load (0.7ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.6ms) BEGIN SQL (0.9ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-04-06 15:52:36.279753"], ["key", "environment"]]  (1.4ms) COMMIT  (1.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.7ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.7ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.5ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (124.9ms) DROP DATABASE IF EXISTS "construction_test"  (341.5ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.7ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.7ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (9.9ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.1ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (6.5ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (5.2ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (2.0ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (6.5ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (4.8ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.8ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (7.7ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (6.9ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (2.0ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (4.1ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (2.1ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (4.3ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (8.5ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.0ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (7.6ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.0ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.9ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (10.6ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.8ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (4.7ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (6.4ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (8.1ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (6.2ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (6.9ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (6.2ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (6.3ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (11.2ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT 'f', "checkout_confirmed" boolean DEFAULT 'f', "checkin_confirmed" boolean DEFAULT 'f', "costs_approved" boolean DEFAULT 'f', "prepared_by_id" integer)  (4.5ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (3.4ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (4.2ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (3.5ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (3.3ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (4.4ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (3.8ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (8.4ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (6.9ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.9ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (3.3ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (7.6ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT 'f', "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.4ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (4.1ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (4.9ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (4.2ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (6.4ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (6.7ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (4.6ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.5ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (3.5ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (6.8ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (6.8ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (7.0ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.4ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (5.0ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (5.5ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (5.1ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (7.3ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.3ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.7ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (6.7ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (1.0ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (2.1ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (3.3ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (6.8ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (5.0ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.8ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (5.7ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.9ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (9.6ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (7.4ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (7.0ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (7.2ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (3.5ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (3.3ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.2ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.8ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.5ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.9ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.5ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (3.3ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.3ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (4.1ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (4.3ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (4.2ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (4.0ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (3.8ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.3ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (3.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (2.7ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.6ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.5ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.9ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.8ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (3.1ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.8ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (3.4ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (3.9ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (5.2ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (3.8ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (8.2ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (2.3ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.7ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144), (20180308133826);   (6.0ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.7ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.8ms) BEGIN SQL (1.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-04-06 15:53:08.829835"], ["updated_at", "2018-04-06 15:53:08.829835"]]  (1.5ms) COMMIT ActiveRecord::InternalMetadata Load (0.6ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.5ms) BEGIN SQL (0.9ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-04-06 15:53:08.838426"], ["key", "environment"]]  (1.6ms) COMMIT  (2.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.8ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (1.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (124.8ms) DROP DATABASE IF EXISTS "construction_test"  (354.8ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.6ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.7ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (10.5ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (7.7ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.3ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (4.2ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (1.7ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (6.4ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (4.4ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.8ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (6.5ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (6.9ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (2.1ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (4.1ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.8ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.4ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (6.5ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (9.4ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.7ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (1.0ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (10.0ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.5ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (6.5ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.8ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (7.5ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (8.1ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.9ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.8ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (8.3ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.7ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.9ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (9.1ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (9.6ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (9.9ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT 'f', "checkout_confirmed" boolean DEFAULT 'f', "checkin_confirmed" boolean DEFAULT 'f', "costs_approved" boolean DEFAULT 'f', "prepared_by_id" integer)  (3.8ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (3.9ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (3.7ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (3.4ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (3.6ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (3.5ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (4.1ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (7.3ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (6.9ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (6.6ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (4.5ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (9.2ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT 'f', "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (3.4ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (3.4ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (3.6ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (7.5ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (6.5ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (4.8ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.9ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.7ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (4.9ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.9ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (9.4ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.3ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (7.9ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (6.7ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.4ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.6ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.4ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (7.0ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.6ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.9ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (1.0ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (6.7ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (8.3ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (1.1ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (3.3ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (4.7ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (1.4ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (6.9ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (4.7ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.3ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (6.8ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (6.7ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (6.4ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (6.8ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (4.0ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (7.7ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (4.3ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (4.6ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (4.3ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (3.5ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.6ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.7ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (3.1ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.9ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.8ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.2ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.8ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.3ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.2ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (3.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (3.9ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (3.9ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (4.0ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (4.8ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (4.0ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (3.7ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.8ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.5ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.7ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.6ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.6ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.7ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (6.8ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.8ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (2.0ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144), (20180308133826);   (6.3ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.8ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.7ms) BEGIN SQL (1.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-04-06 16:23:37.778287"], ["updated_at", "2018-04-06 16:23:37.778287"]]  (1.4ms) COMMIT ActiveRecord::InternalMetadata Load (0.7ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.7ms) BEGIN SQL (1.0ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-04-06 16:23:37.786788"], ["key", "environment"]]  (1.4ms) COMMIT  (1.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.2ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.7ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.1ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (122.4ms) DROP DATABASE IF EXISTS "construction_test"  (338.9ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.6ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.7ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (10.5ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (7.1ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.7ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (4.4ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (4.2ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (10.4ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.9ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.9ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (10.5ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (2.0ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.7ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.5ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.7ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (6.9ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (7.3ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (6.9ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.8ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.8ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (10.0ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (6.2ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.8ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (8.5ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (6.4ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.9ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (6.9ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (6.6ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.1ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (7.2ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.2ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (9.3ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT 'f', "checkout_confirmed" boolean DEFAULT 'f', "checkin_confirmed" boolean DEFAULT 'f', "costs_approved" boolean DEFAULT 'f', "prepared_by_id" integer)  (3.3ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (4.4ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (5.9ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (4.3ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (3.6ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (3.4ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (3.6ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (6.7ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (6.9ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (3.5ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (7.2ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT 'f', "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (3.6ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (3.2ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (4.4ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (8.9ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (10.2ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.1ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (4.3ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.4ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (4.1ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (7.3ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (6.6ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (6.2ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.0ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (4.0ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (5.2ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (7.8ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (1.3ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (10.6ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.3ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.5ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (6.7ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (1.9ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (3.2ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (7.7ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (4.7ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.5ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.8ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (9.8ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (8.5ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.1ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (9.5ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (7.5ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (3.6ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (3.4ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.3ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.6ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.4ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.5ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.4ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.6ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.3ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.8ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.9ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (6.1ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (3.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (4.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (6.9ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (4.2ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (2.7ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.7ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.6ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.5ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.3ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (3.0ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (3.0ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.3ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.6ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.2ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.6ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (10.5ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (2.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (4.0ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (4.3ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144), (20180308133826);   (6.9ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.8ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.7ms) BEGIN SQL (1.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-04-06 16:27:18.105373"], ["updated_at", "2018-04-06 16:27:18.105373"]]  (1.3ms) COMMIT ActiveRecord::InternalMetadata Load (0.9ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.8ms) BEGIN SQL (0.9ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-04-06 16:27:18.114422"], ["key", "environment"]]  (1.3ms) COMMIT  (2.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.8ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.7ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (122.7ms) DROP DATABASE IF EXISTS "construction_test"  (357.1ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (1.0ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (1.2ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (13.8ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.7ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (12.9ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (6.5ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (5.4ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.9ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (7.3ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.8ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (7.1ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (7.6ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (2.1ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.7ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.7ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.5ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (6.4ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.8ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (11.8ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (7.8ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (1.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (9.7ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.1ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (5.3ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (8.9ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.8ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (8.2ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.0ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (8.1ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.2ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.8ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (9.8ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.1ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (1.0ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (8.8ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (6.9ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (10.1ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT 'f', "checkout_confirmed" boolean DEFAULT 'f', "checkin_confirmed" boolean DEFAULT 'f', "costs_approved" boolean DEFAULT 'f', "prepared_by_id" integer)  (4.1ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (4.1ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (4.2ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (4.0ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (3.9ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (3.8ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (8.9ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (1.4ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (11.2ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.0ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (22.1ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.0ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (16.1ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (2.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (11.7ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT 'f', "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (10.9ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (8.6ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (4.4ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (4.6ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (1.0ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (6.9ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (6.9ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (4.4ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.0ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.3ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (3.9ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (1.0ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (9.1ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.0ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (11.8ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.1ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (8.8ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (4.1ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (4.0ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.4ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (6.9ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.8ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.5ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (6.8ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.8ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.9ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (2.8ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (5.0ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (1.0ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (8.8ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (6.0ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.7ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (7.1ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.2ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (8.0ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.1ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (7.4ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (9.2ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.6ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (4.7ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (5.1ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (6.9ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (3.4ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (3.2ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (6.3ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (3.6ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (3.7ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (3.1ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (4.3ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (4.1ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (3.4ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.6ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.8ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (5.5ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (5.8ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (5.8ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (5.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (5.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (6.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (5.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (5.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (6.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (6.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (4.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (5.4ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (5.5ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (4.2ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (4.2ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (3.8ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (3.8ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (5.2ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (3.8ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (5.4ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (4.1ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (7.5ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (5.5ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (5.0ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (4.8ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (6.4ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (4.9ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (4.9ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (4.3ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (4.1ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (4.2ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (5.0ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (9.2ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (2.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (2.4ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (2.1ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144), (20180308133826);   (10.5ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (1.4ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (1.2ms) BEGIN SQL (2.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-04-06 16:27:38.234998"], ["updated_at", "2018-04-06 16:27:38.234998"]]  (1.8ms) COMMIT ActiveRecord::InternalMetadata Load (1.3ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (4.2ms) BEGIN SQL (16.2ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-04-06 16:27:38.251378"], ["key", "environment"]]  (14.0ms) COMMIT  (1.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.0ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.4ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.0ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (122.9ms) DROP DATABASE IF EXISTS "construction_test"  (336.7ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (1.6ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (1.6ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (11.1ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.0ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (11.3ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.1ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.8ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (5.8ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.5ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (6.7ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.8ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (9.5ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.0ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (3.0ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (5.3ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.8ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (2.7ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (4.5ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (6.6ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (7.0ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (7.1ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.7ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (6.9ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.0ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (1.1ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (9.4ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (11.0ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (7.3ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.3ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (6.8ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (7.0ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (7.3ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT 'f', "checkout_confirmed" boolean DEFAULT 'f', "checkin_confirmed" boolean DEFAULT 'f', "costs_approved" boolean DEFAULT 'f', "prepared_by_id" integer)  (3.4ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (3.6ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (3.5ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (4.8ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (4.8ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (4.8ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (4.4ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (7.7ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (6.8ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (3.5ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (8.1ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT 'f', "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (3.4ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (3.6ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (3.9ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (9.6ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (10.8ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.1ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (4.7ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.5ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (3.9ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (7.6ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (6.8ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (7.7ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.5ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.5ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (4.7ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (1.2ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (11.8ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.4ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.6ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.6ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (6.8ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (2.1ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (3.8ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (1.0ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (6.7ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (5.0ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.7ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.9ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (9.9ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (10.0ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.1ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (8.3ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (6.8ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (4.0ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (3.6ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.7ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.4ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.4ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.2ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.5ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.5ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.1ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.9ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.3ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.8ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (5.1ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (3.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (3.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (3.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (4.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (4.1ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (4.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (3.6ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (2.7ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.4ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.9ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (3.0ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.7ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.8ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.7ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.5ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.9ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (9.0ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (2.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (2.0ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (2.0ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144), (20180308133826);   (7.6ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (1.8ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.8ms) BEGIN SQL (1.1ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-04-06 16:28:05.625603"], ["updated_at", "2018-04-06 16:28:05.625603"]]  (1.3ms) COMMIT ActiveRecord::InternalMetadata Load (0.7ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.7ms) BEGIN SQL (0.9ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-04-06 16:28:05.634205"], ["key", "environment"]]  (1.4ms) COMMIT  (1.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.9ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (126.9ms) DROP DATABASE IF EXISTS "construction_test"  (346.2ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.8ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.9ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (10.4ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (7.6ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (4.6ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.9ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (6.8ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (5.3ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (1.0ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (7.6ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (7.2ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (2.1ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.6ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (2.0ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.6ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (6.4ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (6.8ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (9.4ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.1ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (4.8ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (1.0ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (9.4ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (8.4ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (6.9ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (7.1ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (6.7ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (8.4ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.4ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (16.8ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT 'f', "checkout_confirmed" boolean DEFAULT 'f', "checkin_confirmed" boolean DEFAULT 'f', "costs_approved" boolean DEFAULT 'f', "prepared_by_id" integer)  (5.8ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (3.5ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (3.5ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (4.0ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (3.5ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (3.9ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (3.7ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (7.8ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (6.3ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.3ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (4.4ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.9ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (10.5ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT 'f', "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (3.6ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (3.6ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (3.8ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (6.8ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (7.4ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (5.4ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.7ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (4.8ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (1.1ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (10.1ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.1ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (9.9ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (6.8ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.9ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.6ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (4.0ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (1.2ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (6.8ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.4ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (4.0ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (7.5ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.9ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.9ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (2.8ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (4.7ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.8ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (8.6ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (4.9ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.6ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (7.2ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (7.0ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (6.8ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (7.2ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.2ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (4.6ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (5.6ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (3.5ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (3.6ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (3.5ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (4.3ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (3.9ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.8ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (3.4ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.4ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (3.0ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.9ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.9ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.9ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (4.0ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (5.1ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (4.4ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (4.4ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (4.1ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (4.5ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (3.2ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.5ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (3.2ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (3.3ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.6ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (3.4ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.1ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.8ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (6.4ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.8ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.4ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144), (20180308133826);   (6.5ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (1.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.7ms) BEGIN SQL (1.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-04-06 16:30:10.326328"], ["updated_at", "2018-04-06 16:30:10.326328"]]  (1.3ms) COMMIT ActiveRecord::InternalMetadata Load (0.6ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.6ms) BEGIN SQL (1.3ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-04-06 16:30:10.334439"], ["key", "environment"]]  (1.8ms) COMMIT  (1.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.9ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.7ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (204.3ms) DROP DATABASE IF EXISTS "construction_test"  (366.7ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (1.0ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.9ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (17.3ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.1ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (10.7ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.9ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.4ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (5.5ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.5ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (6.3ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (7.4ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (2.6ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.7ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.7ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.5ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (6.7ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.7ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (1.3ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (10.1ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.0ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.8ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (7.5ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.4ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (7.3ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (7.2ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (7.0ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.9ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (7.3ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.4ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.8ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (9.6ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (9.2ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (7.9ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT 'f', "checkout_confirmed" boolean DEFAULT 'f', "checkin_confirmed" boolean DEFAULT 'f', "costs_approved" boolean DEFAULT 'f', "prepared_by_id" integer)  (3.3ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (3.6ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (3.6ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (3.4ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (4.0ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (3.6ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (3.8ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (7.2ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (8.2ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.4ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (3.9ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.9ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (9.6ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT 'f', "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.3ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (3.7ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (3.5ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (3.4ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (7.7ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (6.8ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (4.8ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.8ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (4.4ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (8.8ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.0ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (8.3ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (8.8ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.4ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.2ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.3ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.9ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (7.3ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.2ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.6ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (6.8ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.2ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (3.0ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (5.1ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.8ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (10.3ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.1ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (5.5ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.3ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (6.8ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (7.2ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (7.1ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (7.0ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (3.5ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (3.9ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (4.5ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (4.3ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (4.9ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (4.0ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (4.2ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (3.7ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.3ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (3.2ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.2ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.5ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.2ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (3.7ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (5.2ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (3.8ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (3.4ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (4.3ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (3.9ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.3ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.6ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (3.1ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (6.3ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.8ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.4ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144), (20180308133826);   (6.5ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.8ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.6ms) BEGIN SQL (1.3ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-04-07 03:59:11.109781"], ["updated_at", "2018-04-07 03:59:11.109781"]]  (1.3ms) COMMIT ActiveRecord::InternalMetadata Load (0.7ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.5ms) BEGIN SQL (0.9ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-04-07 03:59:11.118223"], ["key", "environment"]]  (1.3ms) COMMIT  (1.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.9ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.8ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.8ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (121.5ms) DROP DATABASE IF EXISTS "construction_test"  (362.1ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.7ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.7ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (11.2ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (6.9ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.3ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (5.1ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.4ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (7.0ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.7ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.9ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (10.3ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.0ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (2.8ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.8ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.6ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.5ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (6.2ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (7.8ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.3ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (8.6ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.0ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.5ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.8ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (9.2ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.1ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.8ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (9.7ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (7.1ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (6.9ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (6.5ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (6.6ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (8.2ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT 'f', "checkout_confirmed" boolean DEFAULT 'f', "checkin_confirmed" boolean DEFAULT 'f', "costs_approved" boolean DEFAULT 'f', "prepared_by_id" integer)  (3.4ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (3.5ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (3.8ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (5.3ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (4.5ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (4.6ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (3.8ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (6.5ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.0ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (6.8ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (3.4ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (7.0ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT 'f', "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (3.7ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (3.3ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (3.5ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (7.1ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (11.2ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.2ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (5.9ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.3ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (3.5ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (6.6ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (6.9ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (6.5ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.4ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.9ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.4ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (9.6ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.8ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (4.3ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.4ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (6.9ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (2.0ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (3.5ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (7.0ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (5.1ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.3ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (6.4ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (7.3ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.4ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (10.1ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (10.4ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (3.5ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (3.4ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.2ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.5ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.3ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.5ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.5ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.4ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.1ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (3.1ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (4.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (3.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (4.7ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (3.6ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (3.6ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.6ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (3.0ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.6ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (3.3ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.5ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.3ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.6ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.7ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.5ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.6ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.3ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.5ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (6.3ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.5ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.5ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20180125113530), (20180303134144), (20180308133826);   (6.0ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.8ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.8ms) BEGIN SQL (1.5ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-04-07 03:59:24.132500"], ["updated_at", "2018-04-07 03:59:24.132500"]]  (2.2ms) COMMIT ActiveRecord::InternalMetadata Load (0.9ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.7ms) BEGIN SQL (1.0ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-04-07 03:59:24.144200"], ["key", "environment"]]  (1.7ms) COMMIT  (1.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.8ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.5ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (121.0ms) DROP DATABASE IF EXISTS "construction_test"  (316.4ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.7ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.7ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (10.0ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (11.3ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.4ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (4.2ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (5.0ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (11.6ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.9ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (10.3ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT 't' NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (1.7ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.6ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (3.2ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.5ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (9.4ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.9ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (7.8ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.3ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.8ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (9.8ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.8ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.2ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (8.4ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.9ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (9.9ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (13.2ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT 't', "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (11.6ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (7.8ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (10.9ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (16.1ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT 'f', "checkout_confirmed" boolean DEFAULT 'f', "checkin_confirmed" boolean DEFAULT 'f', "costs_approved" boolean DEFAULT 'f', "prepared_by_id" integer)  (3.7ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (3.8ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (3.2ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (5.0ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (3.7ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (5.2ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (3.7ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (9.1ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (14.2ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (4.9ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (6.9ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT 'f', "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (3.8ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (3.7ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (6.6ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (10.5ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (8.2ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.8ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (5.9ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.4ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (4.9ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (11.5ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (7.9ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.2ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (11.7ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.0ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (5.0ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (4.8ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.2ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (8.8ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (6.6ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.8ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (6.8ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (1.9ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (3.6ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (9.1ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (6.5ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.8ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.3ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (6.9ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (6.8ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (13.2ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (14.0ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (3.6ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (3.3ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.2ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.4ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.4ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.1ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.6ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (3.4ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.2ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.3ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.9ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (5.5ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (2.8ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.4ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.4ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.5ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.5ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.7ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (3.0ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.6ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.7ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (8.7ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.7ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.6ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20171218113530), (20171219134144), (20171220133826), (20171221110018);   (7.2ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (1.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.9ms) BEGIN SQL (1.1ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-09-05 05:11:28.651356"], ["updated_at", "2018-09-05 05:11:28.651356"]]  (1.4ms) COMMIT ActiveRecord::InternalMetadata Load (0.8ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.7ms) BEGIN SQL (0.9ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-09-05 05:11:28.659888"], ["key", "environment"]]  (1.3ms) COMMIT  (3.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (4.1ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (1.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.2ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (3.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (3.5ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (136.3ms) DROP DATABASE IF EXISTS "construction_test"  (396.1ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (1.8ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (2.4ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (24.5ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (2.8ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (20.9ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (12.2ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (10.4ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (3.5ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (10.9ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (8.8ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (2.0ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (15.7ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.1ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (1.0ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (10.3ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT TRUE NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.6ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (2.6ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (5.5ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (1.1ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (2.9ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (6.2ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (1.1ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (16.0ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.1ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (1.4ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (13.1ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (12.9ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (2.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (11.0ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (7.4ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (4.5ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (1.4ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (10.1ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (8.5ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (1.0ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (14.7ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.3ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (10.9ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT TRUE, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (6.4ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (1.3ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (21.7ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (13.3ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (1.1ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (13.9ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.1ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (11.8ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.2ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (13.9ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT FALSE, "checkout_confirmed" boolean DEFAULT FALSE, "checkin_confirmed" boolean DEFAULT FALSE, "costs_approved" boolean DEFAULT FALSE, "prepared_by_id" integer)  (8.9ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (7.2ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (5.9ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (7.4ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (4.9ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (11.2ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (9.3ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (1.0ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (14.5ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.2ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (9.6ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.3ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (6.1ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (1.1ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (13.9ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT FALSE, "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (8.1ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (4.6ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (4.4ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (4.6ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (1.1ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (9.3ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.1ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (11.4ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (6.1ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (1.5ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (8.5ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (6.1ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (10.1ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (4.5ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (1.1ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (12.3ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (12.9ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.3ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (12.7ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (6.5ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (6.4ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (4.7ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (5.8ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (1.2ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (11.5ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (6.4ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (4.4ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (8.6ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (1.3ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (10.8ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.3ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.9ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (2.8ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (7.5ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (1.5ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (14.8ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.2ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (9.7ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.6ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (4.7ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (1.3ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (14.3ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.0ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (14.7ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (7.2ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (12.5ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (2.0ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (18.1ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (9.2ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (20.7ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (9.1ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (4.8ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (8.2ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (8.4ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (11.2ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (11.9ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (12.1ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (11.1ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (10.0ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (28.9ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (5.7ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (4.7ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (5.0ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (11.8ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (6.9ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (8.3ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (7.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (8.2ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (4.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (5.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.9ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (5.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (6.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (4.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (5.1ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (4.7ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (7.5ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (6.1ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (5.4ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (4.6ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (5.8ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (3.7ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (5.8ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (5.1ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (4.5ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (5.0ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (7.0ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (4.9ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (7.3ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (5.5ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (5.1ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (4.8ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (4.5ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (5.0ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (5.4ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (14.1ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (2.4ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (3.1ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (2.6ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20171218113530), (20171219134144), (20171220133826), (20171221110018);   (13.9ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (2.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (1.3ms) BEGIN ActiveRecord::InternalMetadata Create (2.7ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-09-05 05:36:07.940159"], ["updated_at", "2018-09-05 05:36:07.940159"]]  (2.0ms) COMMIT ActiveRecord::InternalMetadata Load (1.6ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (1.3ms) BEGIN ActiveRecord::InternalMetadata Update (2.1ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-09-05 05:36:07.955075"], ["key", "environment"]]  (2.0ms) COMMIT  (1.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.8ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.1ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (1.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.7ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (127.9ms) DROP DATABASE IF EXISTS "construction_test"  (348.1ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (1.4ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.9ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (9.9ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (8.2ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.4ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.1ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (4.2ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (4.6ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (6.2ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.3ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (10.6ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT TRUE NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (2.0ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (2.6ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.4ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.7ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (4.5ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (8.0ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.8ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (8.0ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.0ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (1.0ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (8.8ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (6.7ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (7.7ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.7ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.8ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (8.1ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.0ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (14.1ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT TRUE, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.9ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (7.2ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.0ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.9ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (6.9ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.8ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (6.6ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (11.9ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT FALSE, "checkout_confirmed" boolean DEFAULT FALSE, "checkin_confirmed" boolean DEFAULT FALSE, "costs_approved" boolean DEFAULT FALSE, "prepared_by_id" integer)  (3.6ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (5.4ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (3.3ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (6.8ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (3.4ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (5.4ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (4.3ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (10.9ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (7.7ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (3.3ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (1.3ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (8.4ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT FALSE, "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.1ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (5.4ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (3.8ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (4.7ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (9.0ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (10.0ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.1ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (4.7ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (5.2ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (5.6ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (10.5ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (7.3ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (9.6ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (4.3ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.5ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (4.8ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (9.6ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.0ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (4.8ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.7ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (1.1ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (8.6ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (1.0ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (2.6ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (3.3ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (10.4ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (4.9ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.8ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.7ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (9.5ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (8.9ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.0ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (11.0ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (9.5ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (6.6ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (5.2ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (3.2ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (3.2ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (3.0ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.6ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.9ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.4ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (4.0ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.8ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (3.0ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.9ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.1ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.0ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (3.1ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (4.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (4.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.2ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (5.7ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (3.0ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.9ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (7.4ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.9ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.5ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.9ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.8ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (3.2ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.8ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (3.1ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.0ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (4.6ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (6.2ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (2.8ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (2.4ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20171218113530), (20171219134144), (20171220133826), (20171221110018);   (5.8ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.7ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.9ms) BEGIN ActiveRecord::InternalMetadata Create (1.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-09-05 05:37:52.607725"], ["updated_at", "2018-09-05 05:37:52.607725"]]  (1.3ms) COMMIT ActiveRecord::InternalMetadata Load (0.6ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.5ms) BEGIN ActiveRecord::InternalMetadata Update (0.9ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-09-05 05:37:52.615644"], ["key", "environment"]]  (1.6ms) COMMIT  (2.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (1.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.1ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (1.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.2ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (127.4ms) DROP DATABASE IF EXISTS "construction_test"  (364.7ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (1.0ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.8ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (22.6ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (14.2ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.5ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.3ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (7.7ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.4ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (11.1ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.0ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.9ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (6.7ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT TRUE NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (1.8ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.8ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.8ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (2.4ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (7.7ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (1.2ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (9.5ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.8ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.9ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (11.4ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (1.0ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (10.0ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (6.2ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (6.2ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.8ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (11.7ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (6.5ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (1.0ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (10.6ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (2.3ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (8.9ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT TRUE, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (6.6ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.9ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (14.7ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (8.3ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.9ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (7.9ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.0ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (10.0ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (13.8ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT FALSE, "checkout_confirmed" boolean DEFAULT FALSE, "checkin_confirmed" boolean DEFAULT FALSE, "costs_approved" boolean DEFAULT FALSE, "prepared_by_id" integer)  (7.0ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (3.7ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (6.5ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (6.8ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (4.1ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (4.0ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (5.8ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (8.3ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.1ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (10.7ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (8.4ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (9.6ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (1.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (11.6ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT FALSE, "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (6.8ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (4.7ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (6.7ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (7.1ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (1.0ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (10.7ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (11.0ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (4.7ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (6.2ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (5.2ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (1.3ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (19.3ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.2ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (8.2ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (14.0ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (4.9ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (6.5ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (4.8ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.8ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (13.2ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.6ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (4.5ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (10.2ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.5ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.8ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (2.9ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (15.9ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (2.2ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (16.3ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.4ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (10.2ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.5ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (11.3ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (1.1ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (17.2ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (9.9ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (2.1ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (7.1ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (9.1ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (8.9ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (3.2ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.4ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (3.0ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (4.0ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (3.6ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (3.6ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (3.0ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.8ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.4ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.8ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.0ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (4.7ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.9ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (5.6ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.3ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (3.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (3.6ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.4ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (3.7ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (3.2ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.5ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.9ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (3.9ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.6ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.8ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (3.0ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (4.2ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (3.0ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (3.0ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.5ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (5.2ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (10.0ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (2.2ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.5ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20171218113530), (20171219134144), (20171220133826), (20171221110018);   (7.1ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (1.3ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.9ms) BEGIN ActiveRecord::InternalMetadata Create (1.9ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-09-05 05:38:18.555642"], ["updated_at", "2018-09-05 05:38:18.555642"]]  (2.0ms) COMMIT ActiveRecord::InternalMetadata Load (0.9ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.9ms) BEGIN ActiveRecord::InternalMetadata Update (1.4ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-09-05 05:38:18.567051"], ["key", "environment"]]  (1.5ms) COMMIT  (2.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.7ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.5ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (122.2ms) DROP DATABASE IF EXISTS "construction_test"  (342.9ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.7ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.8ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (12.9ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (11.9ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.7ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (4.1ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (4.9ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (5.7ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (10.3ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.9ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (9.0ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT TRUE NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (1.7ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.2ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.6ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (5.1ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (12.6ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (11.3ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (8.6ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (9.0ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.1ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.9ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (12.4ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.7ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (6.2ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (8.8ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT TRUE, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.8ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (15.5ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.9ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (7.7ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.4ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (9.0ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.0ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (7.4ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT FALSE, "checkout_confirmed" boolean DEFAULT FALSE, "checkin_confirmed" boolean DEFAULT FALSE, "costs_approved" boolean DEFAULT FALSE, "prepared_by_id" integer)  (5.1ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (9.6ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (4.6ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (5.1ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (3.2ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (3.6ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (3.6ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (11.6ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (2.0ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (11.9ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (5.4ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (10.2ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT FALSE, "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (8.5ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (5.9ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (5.1ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (5.4ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (8.4ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (9.3ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.8ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (6.3ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.2ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.3ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (3.1ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (11.2ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (7.1ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (7.0ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.3ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.5ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (8.7ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (5.9ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.9ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (12.9ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.7ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (6.1ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (4.8ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.9ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (13.5ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.9ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.8ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (2.7ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (8.9ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (1.0ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (10.6ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.1ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (4.4ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.5ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (4.9ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (1.4ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (8.1ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (6.0ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (7.9ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (7.8ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (3.4ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (3.0ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.6ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.8ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.5ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.1ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.5ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.7ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.9ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.8ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.8ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (4.8ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.8ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (3.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (4.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (4.0ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (3.0ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.6ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.9ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.6ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.9ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (3.6ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (3.0ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.7ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (3.3ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.7ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.7ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.9ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (11.0ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.6ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.3ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20171218113530), (20171219134144), (20171220133826), (20171221110018);   (6.9ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.8ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.8ms) BEGIN ActiveRecord::InternalMetadata Create (2.5ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-09-05 05:39:47.096220"], ["updated_at", "2018-09-05 05:39:47.096220"]]  (1.3ms) COMMIT ActiveRecord::InternalMetadata Load (0.6ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.7ms) BEGIN ActiveRecord::InternalMetadata Update (0.9ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-09-05 05:39:47.106294"], ["key", "environment"]]  (1.3ms) COMMIT  (2.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.1ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (1.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (124.0ms) DROP DATABASE IF EXISTS "construction_test"  (321.7ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.7ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (1.0ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (12.3ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (10.1ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.3ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (4.4ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (5.0ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.8ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (9.9ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.1ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (7.0ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT TRUE NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (2.1ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.6ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.7ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (4.8ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (11.2ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.0ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (8.8ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (8.7ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (5.1ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (7.5ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (10.5ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (10.8ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT TRUE, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.1ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (8.4ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (12.4ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (8.1ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (10.2ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT FALSE, "checkout_confirmed" boolean DEFAULT FALSE, "checkin_confirmed" boolean DEFAULT FALSE, "costs_approved" boolean DEFAULT FALSE, "prepared_by_id" integer)  (6.4ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (6.4ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (4.1ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (7.7ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (5.3ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (4.6ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (5.7ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (8.0ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (6.5ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.2ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (5.4ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (11.0ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT FALSE, "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.4ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (3.2ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (3.4ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (5.4ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (12.6ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (9.6ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.9ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (4.6ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.6ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.2ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (4.9ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (8.3ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (6.4ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (10.3ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.4ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (5.3ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.3ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.4ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (6.9ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.2ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (4.4ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (5.0ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (12.5ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.4ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (1.9ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (2.9ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (5.0ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (1.5ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (12.7ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.1ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (7.8ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (7.0ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (7.9ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (1.4ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (8.9ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (20.8ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.4ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (8.4ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (11.2ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (5.5ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (3.6ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.4ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (3.7ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (3.1ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.6ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.5ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.9ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.8ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.9ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.9ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.3ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (3.6ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.8ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (3.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (3.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.2ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (3.4ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (3.4ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (3.2ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (3.3ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (3.1ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.5ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (3.9ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.9ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.5ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (4.8ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.6ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.6ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (8.9ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.8ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.5ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20171218113530), (20171219134144), (20171220133826), (20171221110018);   (11.2ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (1.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (1.0ms) BEGIN ActiveRecord::InternalMetadata Create (1.8ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-09-05 05:41:34.125460"], ["updated_at", "2018-09-05 05:41:34.125460"]]  (1.5ms) COMMIT ActiveRecord::InternalMetadata Load (0.7ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.6ms) BEGIN ActiveRecord::InternalMetadata Update (0.8ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-09-05 05:41:34.134794"], ["key", "environment"]]  (1.4ms) COMMIT  (1.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.3ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (2.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.1ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.7ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (123.2ms) DROP DATABASE IF EXISTS "construction_test"  (331.0ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.8ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.6ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (11.4ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (9.2ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.7ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.8ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (5.7ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.4ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (8.5ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.8ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (10.1ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT TRUE NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (1.8ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (4.3ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (1.0ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (2.1ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.2ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (8.8ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.8ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (9.8ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (9.5ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (4.3ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (9.9ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (6.1ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (10.9ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT TRUE, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (6.4ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (11.6ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (8.5ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.4ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (8.0ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (7.9ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT FALSE, "checkout_confirmed" boolean DEFAULT FALSE, "checkin_confirmed" boolean DEFAULT FALSE, "costs_approved" boolean DEFAULT FALSE, "prepared_by_id" integer)  (3.7ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (4.9ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (3.2ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (4.7ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (3.6ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (3.6ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (7.0ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (6.5ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (10.9ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (5.4ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (7.0ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT FALSE, "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.7ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (6.3ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (3.5ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (3.3ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (8.8ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (9.7ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.4ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (4.6ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.1ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.2ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (4.6ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (8.7ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (8.2ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (6.7ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.3ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.8ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.4ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.3ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (6.5ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.1ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (4.7ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (8.8ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.5ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (1.9ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (3.2ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.8ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (9.2ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (6.5ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.1ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (4.9ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (1.4ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (6.8ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (8.0ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (10.4ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.0ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (9.8ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (6.3ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (5.0ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (3.1ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.8ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (3.0ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.5ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.4ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.5ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.5ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (3.4ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.7ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.8ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.9ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (3.4ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (5.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (4.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (4.6ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.5ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.7ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.5ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.6ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (3.0ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.9ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.3ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (3.1ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.1ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.7ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (7.9ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.4ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.6ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.4ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20171218113530), (20171219134144), (20171220133826), (20171221110018);   (6.0ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (1.5ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.9ms) BEGIN ActiveRecord::InternalMetadata Create (1.1ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-09-05 05:45:14.443474"], ["updated_at", "2018-09-05 05:45:14.443474"]]  (1.3ms) COMMIT ActiveRecord::InternalMetadata Load (1.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.8ms) BEGIN ActiveRecord::InternalMetadata Update (0.9ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-09-05 05:45:14.453659"], ["key", "environment"]]  (1.3ms) COMMIT  (1.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.7ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.1ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (123.7ms) DROP DATABASE IF EXISTS "construction_test"  (327.6ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (1.1ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.8ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (11.0ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.2ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (8.4ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (7.5ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (4.8ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (5.0ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.7ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (10.0ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.8ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (9.9ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT TRUE NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (1.6ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (5.4ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.8ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (2.4ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.3ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (10.4ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.9ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (8.8ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.9ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (11.7ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (6.6ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (5.2ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (9.5ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (8.8ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (8.4ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT TRUE, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.4ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (12.3ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (11.1ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (12.1ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (10.2ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT FALSE, "checkout_confirmed" boolean DEFAULT FALSE, "checkin_confirmed" boolean DEFAULT FALSE, "costs_approved" boolean DEFAULT FALSE, "prepared_by_id" integer)  (3.5ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (3.8ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (5.1ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (5.3ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (3.3ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (3.2ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (3.9ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (10.1ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (10.4ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (3.6ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (9.7ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT FALSE, "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (6.1ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (3.4ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (3.9ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.9ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (7.1ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (9.7ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (5.3ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.1ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.3ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (5.8ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (11.6ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (2.0ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (7.0ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (8.8ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.0ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (5.4ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (4.8ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.7ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (1.0ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (8.6ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.2ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (5.0ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (5.3ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.9ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (6.9ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (1.1ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (2.0ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (3.6ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (11.8ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (6.4ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.5ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (5.6ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (1.7ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (7.0ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (11.6ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (6.5ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (8.9ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (3.3ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (3.4ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.5ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.5ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (3.2ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.7ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.4ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.9ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (3.3ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (3.8ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.1ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.0ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (3.5ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (3.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (3.9ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (4.2ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (2.9ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (3.7ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.7ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.7ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.3ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (3.3ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (3.3ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.3ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.3ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.3ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (4.0ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.9ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (8.6ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.8ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.6ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20171218113530), (20171219134144), (20171220133826), (20171221110018);   (6.1ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (1.2ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.8ms) BEGIN ActiveRecord::InternalMetadata Create (1.1ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-09-05 05:45:32.467172"], ["updated_at", "2018-09-05 05:45:32.467172"]]  (1.4ms) COMMIT ActiveRecord::InternalMetadata Load (0.8ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.9ms) BEGIN ActiveRecord::InternalMetadata Update (0.9ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-09-05 05:45:32.476745"], ["key", "environment"]]  (1.3ms) COMMIT  (1.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.8ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.9ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (1.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.9ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (125.0ms) DROP DATABASE IF EXISTS "construction_test"  (342.6ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.8ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (1.2ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (15.4ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.1ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (8.5ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.0ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.6ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (6.5ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.5ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.9ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (6.7ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.5ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (9.1ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT TRUE NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (1.9ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.7ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (2.0ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.3ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.9ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (6.4ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.2ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (11.7ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (7.4ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.2ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.8ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (10.5ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.0ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (1.4ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (6.7ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (8.0ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT TRUE, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.8ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (13.4ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.8ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (9.3ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (9.4ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (15.2ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT FALSE, "checkout_confirmed" boolean DEFAULT FALSE, "checkin_confirmed" boolean DEFAULT FALSE, "costs_approved" boolean DEFAULT FALSE, "prepared_by_id" integer)  (5.2ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (5.6ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (3.3ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (5.5ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (5.4ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (5.8ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (3.5ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (8.8ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (10.1ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (3.6ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (8.9ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT FALSE, "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (3.5ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (6.8ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (5.7ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (8.9ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (7.4ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.2ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (4.3ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.8ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (3.3ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (9.2ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (7.9ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (11.4ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (6.8ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (4.1ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (4.4ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (5.2ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (10.6ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.0ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.4ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (5.2ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (7.5ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (1.9ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (5.6ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (9.0ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (6.4ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.1ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (5.1ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (10.5ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (6.8ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (7.7ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (7.0ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (3.8ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (3.5ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.5ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.6ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (3.0ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.5ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.7ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (4.3ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.3ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (3.0ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (5.0ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.8ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.8ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (4.1ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (3.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (4.1ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (3.1ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.5ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.4ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (3.5ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.9ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.9ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (3.0ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (3.1ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (3.7ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (3.4ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.6ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (3.0ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (7.0ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (2.0ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.8ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20171218113530), (20171219134144), (20171220133826), (20171221110018);   (6.4ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.8ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (1.3ms) BEGIN ActiveRecord::InternalMetadata Create (3.1ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-09-05 05:46:58.306107"], ["updated_at", "2018-09-05 05:46:58.306107"]]  (1.5ms) COMMIT ActiveRecord::InternalMetadata Load (0.6ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.6ms) BEGIN ActiveRecord::InternalMetadata Update (1.0ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-09-05 05:46:58.316571"], ["key", "environment"]]  (1.8ms) COMMIT  (1.7ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.7ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (123.5ms) DROP DATABASE IF EXISTS "construction_test"  (318.3ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.7ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.7ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (13.2ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (9.9ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (5.1ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (4.4ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.9ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.8ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (7.2ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (8.5ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT TRUE NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (2.1ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (4.3ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.6ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.7ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (1.0ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (9.3ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (8.6ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.1ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (1.1ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (6.6ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.4ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (1.0ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (8.8ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (6.5ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (11.6ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT TRUE, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.9ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (6.9ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.2ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (9.0ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (7.7ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (8.1ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT FALSE, "checkout_confirmed" boolean DEFAULT FALSE, "checkin_confirmed" boolean DEFAULT FALSE, "costs_approved" boolean DEFAULT FALSE, "prepared_by_id" integer)  (3.5ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (4.0ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (5.2ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (4.1ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (4.0ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (3.4ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (4.5ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (18.5ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (13.5ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.9ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (3.9ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (10.6ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT FALSE, "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.7ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (3.9ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (3.8ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (3.4ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (11.8ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (16.1ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (4.9ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.3ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.9ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (3.5ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (7.7ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (14.1ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (16.2ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.7ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.8ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (5.6ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.9ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (8.6ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.7ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (6.0ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (4.5ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (7.1ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.1ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (2.0ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (5.9ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (10.2ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.1ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (5.2ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.7ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.7ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (10.4ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (7.5ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.0ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (8.5ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (7.7ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.9ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (4.1ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (3.9ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.7ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (4.1ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.8ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.7ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (3.1ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.8ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.2ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.9ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.1ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.8ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (3.2ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (4.0ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (3.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (3.1ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.7ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.4ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.9ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.8ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.9ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.9ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.8ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.8ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.8ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.3ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.7ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (7.7ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.6ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.8ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20171218113530), (20171219134144), (20171220133826), (20171221110018);   (6.7ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (1.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.7ms) BEGIN ActiveRecord::InternalMetadata Create (1.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-09-05 05:58:21.090800"], ["updated_at", "2018-09-05 05:58:21.090800"]]  (1.5ms) COMMIT ActiveRecord::InternalMetadata Load (0.7ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.6ms) BEGIN ActiveRecord::InternalMetadata Update (1.2ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-09-05 05:58:21.099291"], ["key", "environment"]]  (1.7ms) COMMIT  (1.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.8ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.7ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.7ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (121.9ms) DROP DATABASE IF EXISTS "construction_test"  (328.1ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.8ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.7ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (13.7ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.2ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (9.9ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.2ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (4.3ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (4.3ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (8.2ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.8ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (8.4ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT TRUE NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (1.7ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.5ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.8ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (5.2ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (6.7ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.4ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (8.7ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (7.0ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (1.1ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (10.8ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.7ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (8.4ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.9ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (6.9ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (8.9ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT TRUE, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (8.7ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.9ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (8.8ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (6.8ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (9.1ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT FALSE, "checkout_confirmed" boolean DEFAULT FALSE, "checkin_confirmed" boolean DEFAULT FALSE, "costs_approved" boolean DEFAULT FALSE, "prepared_by_id" integer)  (3.9ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (3.3ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (3.5ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (3.4ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (3.4ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (3.4ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (5.3ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (10.3ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (6.9ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (5.2ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (9.5ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT FALSE, "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.2ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (3.5ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (5.2ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (3.8ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (10.3ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (8.1ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (4.7ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (4.9ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (4.9ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (10.9ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (6.7ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (8.2ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (5.5ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.2ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (5.2ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (6.9ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.8ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (4.0ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.8ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (7.5ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.5ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (2.2ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (3.8ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (7.4ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (6.6ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (5.0ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (8.7ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (8.8ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (6.4ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (8.2ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (5.2ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (4.2ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (3.6ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.7ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.7ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.9ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.4ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (3.2ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (3.2ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.6ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.8ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (4.7ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.3ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (3.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (7.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (6.1ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (4.9ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (10.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (5.4ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (4.9ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (3.9ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.6ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (3.2ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (3.2ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (3.6ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.6ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.4ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.4ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.7ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (3.3ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.9ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.6ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.8ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.5ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.6ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (8.3ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.8ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.4ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20171218113530), (20171219134144), (20171220133826), (20171221110018);   (6.3ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.9ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.7ms) BEGIN ActiveRecord::InternalMetadata Create (1.3ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-09-05 05:59:15.534114"], ["updated_at", "2018-09-05 05:59:15.534114"]]  (1.5ms) COMMIT ActiveRecord::InternalMetadata Load (0.7ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.6ms) BEGIN ActiveRecord::InternalMetadata Update (0.8ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-09-05 05:59:15.543303"], ["key", "environment"]]  (1.4ms) COMMIT  (2.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.8ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.8ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (123.4ms) DROP DATABASE IF EXISTS "construction_test"  (341.7ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.9ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.8ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (14.8ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (8.8ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.3ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (5.8ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.7ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (7.1ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.9ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (7.6ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT TRUE NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (1.8ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.4ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.9ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (5.5ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (7.0ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (10.8ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (10.2ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.5ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.7ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (7.0ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.9ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (1.1ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (22.2ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.1ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (11.3ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT TRUE, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (8.0ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (6.9ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (12.5ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (6.6ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT FALSE, "checkout_confirmed" boolean DEFAULT FALSE, "checkin_confirmed" boolean DEFAULT FALSE, "costs_approved" boolean DEFAULT FALSE, "prepared_by_id" integer)  (5.3ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (5.5ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (3.4ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (3.3ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (4.0ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (3.5ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (5.3ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (8.7ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (7.4ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.1ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (3.8ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (1.1ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (7.2ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT FALSE, "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.1ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (5.3ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (3.5ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (3.6ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (12.0ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (8.1ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.9ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (7.6ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.5ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (5.3ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (1.2ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (7.1ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.1ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (8.4ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (9.1ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (4.8ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (5.2ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (4.0ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.9ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (7.2ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.1ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (4.8ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.7ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (1.2ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (7.2ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.4ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (1.9ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (8.4ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (8.7ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (8.0ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.1ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (6.3ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (7.1ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.5ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (6.4ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (7.7ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (6.9ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.7ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (4.9ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (3.5ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.6ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.8ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.7ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.3ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (3.0ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.6ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.3ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.8ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.8ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.9ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.8ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (3.0ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.9ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.2ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (3.7ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (3.3ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.8ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.7ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (3.0ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.4ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.9ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (3.1ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (3.0ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.7ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (3.0ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (6.5ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.7ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.6ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20171218113530), (20171219134144), (20171220133826), (20171221110018);   (6.0ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (1.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.7ms) BEGIN ActiveRecord::InternalMetadata Create (0.9ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-09-05 06:00:14.713395"], ["updated_at", "2018-09-05 06:00:14.713395"]]  (1.3ms) COMMIT ActiveRecord::InternalMetadata Load (0.7ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.7ms) BEGIN ActiveRecord::InternalMetadata Update (0.9ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-09-05 06:00:14.721636"], ["key", "environment"]]  (1.7ms) COMMIT  (2.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.0ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (1.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.7ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (122.0ms) DROP DATABASE IF EXISTS "construction_test"  (328.2ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.8ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.7ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (11.3ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.0ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (7.9ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (4.3ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.9ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (4.9ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (4.8ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (1.0ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (8.0ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.6ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (6.7ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (8.2ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT TRUE NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.0ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (2.3ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (4.2ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (1.3ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (2.3ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (28.8ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (1.0ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (42.0ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.1ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (1.0ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (8.7ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (6.3ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.0ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.1ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (6.0ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.1ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (6.3ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (6.7ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT TRUE, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (6.9ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (8.0ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (6.3ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (7.0ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT FALSE, "checkout_confirmed" boolean DEFAULT FALSE, "checkin_confirmed" boolean DEFAULT FALSE, "costs_approved" boolean DEFAULT FALSE, "prepared_by_id" integer)  (3.5ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (4.2ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (3.9ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (3.6ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (3.9ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (4.9ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (4.0ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (8.2ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.2ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (8.5ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.4ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (4.7ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (1.1ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (9.8ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT FALSE, "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.3ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (4.4ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (5.7ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (4.4ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (1.3ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (10.5ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.2ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (15.7ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.1ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (4.3ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.2ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (3.4ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (6.3ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (6.0ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (6.6ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.1ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.5ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.1ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.8ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (6.4ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.9ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.4ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.4ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (6.2ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (1.8ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (3.7ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (6.3ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (5.1ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.6ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.8ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (6.3ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (6.6ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (7.0ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (6.4ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (3.2ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (3.3ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.4ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.6ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.4ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.3ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.4ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.5ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.7ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (3.3ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (3.2ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.2ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (4.2ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (2.7ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.6ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.6ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.9ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.6ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.7ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.8ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.8ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.5ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.6ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (6.7ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.6ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.4ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20171218113530), (20171219134144), (20171220133826), (20171221110018);   (7.4ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.8ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.7ms) BEGIN ActiveRecord::InternalMetadata Create (1.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-09-05 06:04:04.226059"], ["updated_at", "2018-09-05 06:04:04.226059"]]  (1.5ms) COMMIT ActiveRecord::InternalMetadata Load (0.6ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.7ms) BEGIN ActiveRecord::InternalMetadata Update (1.1ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-09-05 06:04:04.234630"], ["key", "environment"]]  (1.5ms) COMMIT  (1.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.9ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (122.0ms) DROP DATABASE IF EXISTS "construction_test"  (321.8ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (1.2ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (1.1ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (9.9ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (6.6ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.0ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (4.3ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.5ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (6.3ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (6.9ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT TRUE NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (1.6ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.6ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.9ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (2.2ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.6ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (1.1ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (7.6ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (6.4ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (7.0ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.1ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (6.7ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (7.4ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (7.4ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT TRUE, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (7.6ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.5ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (1.0ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (7.6ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (6.5ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (7.0ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT FALSE, "checkout_confirmed" boolean DEFAULT FALSE, "checkin_confirmed" boolean DEFAULT FALSE, "costs_approved" boolean DEFAULT FALSE, "prepared_by_id" integer)  (3.5ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (3.3ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (3.8ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (3.3ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (3.3ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (3.9ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (3.8ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (7.4ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (7.4ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.0ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (3.7ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (8.8ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT FALSE, "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (3.7ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (3.8ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (4.2ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (1.5ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (7.6ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (6.8ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (4.4ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.8ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (4.4ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.9ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (6.9ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (6.5ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.0ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (8.3ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.6ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.3ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (4.2ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (6.6ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.4ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.5ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (6.7ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.1ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (1.0ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (2.7ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (3.6ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (6.9ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (4.8ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.6ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (7.0ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (6.5ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (6.6ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (7.1ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (3.2ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (3.4ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.4ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.6ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.8ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (3.0ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.5ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (3.2ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.8ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.7ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (3.0ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.2ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (2.7ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.9ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.8ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.5ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.4ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.7ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (3.0ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.6ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.3ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (4.4ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.0ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.8ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (6.6ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.8ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.6ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20171218113530), (20171219134144), (20171220133826), (20171221110018);   (6.1ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.8ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.8ms) BEGIN ActiveRecord::InternalMetadata Create (1.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-09-05 06:04:38.980754"], ["updated_at", "2018-09-05 06:04:38.980754"]]  (1.3ms) COMMIT ActiveRecord::InternalMetadata Load (0.6ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.5ms) BEGIN ActiveRecord::InternalMetadata Update (0.9ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-09-05 06:04:38.988325"], ["key", "environment"]]  (1.3ms) COMMIT  (1.4ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.8ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (122.1ms) DROP DATABASE IF EXISTS "construction_test"  (327.3ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.7ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.7ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (9.6ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (6.9ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.9ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.8ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (6.4ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.4ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (6.8ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (6.7ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT TRUE NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (1.8ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.6ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.5ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.3ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.9ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (6.8ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (6.5ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (6.9ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.3ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (6.7ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (6.8ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (7.5ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT TRUE, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (7.0ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (6.4ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (6.4ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (7.5ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT FALSE, "checkout_confirmed" boolean DEFAULT FALSE, "checkin_confirmed" boolean DEFAULT FALSE, "costs_approved" boolean DEFAULT FALSE, "prepared_by_id" integer)  (3.4ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (3.7ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (3.4ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (3.5ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (3.7ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (3.4ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (3.7ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (7.0ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (6.6ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (3.4ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (8.1ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT FALSE, "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (3.4ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (3.2ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (3.4ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (7.0ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (7.2ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (4.3ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.9ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (3.2ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (6.7ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (6.4ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (6.4ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.2ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.3ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (4.4ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (6.7ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (4.0ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (4.0ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (6.6ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.0ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.8ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (1.9ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (3.5ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (7.6ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.1ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (6.0ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.2ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (9.3ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (6.4ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (6.3ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (6.7ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.0ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (3.3ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (3.2ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.2ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.4ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.6ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.5ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (3.1ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.6ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.9ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (4.2ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (4.0ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.9ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (3.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (3.8ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (3.4ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (3.4ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.8ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.6ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.5ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (3.1ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.5ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (3.1ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.9ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.7ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (3.3ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (6.7ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.7ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.4ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20171218113530), (20171219134144), (20171220133826), (20171221110018);   (6.4ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.8ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.7ms) BEGIN ActiveRecord::InternalMetadata Create (1.1ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-09-05 06:10:08.626971"], ["updated_at", "2018-09-05 06:10:08.626971"]]  (1.4ms) COMMIT ActiveRecord::InternalMetadata Load (0.7ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.7ms) BEGIN ActiveRecord::InternalMetadata Update (1.0ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-09-05 06:10:08.635710"], ["key", "environment"]]  (1.4ms) COMMIT  (1.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.1ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (1.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (1.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.7ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (122.0ms) DROP DATABASE IF EXISTS "construction_test"  (317.5ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.7ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.8ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (10.9ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (6.8ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.6ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (4.4ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.7ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (6.3ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (6.6ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT TRUE NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (1.6ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.4ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.6ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.7ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (7.0ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (6.5ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (8.1ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.2ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.2ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (6.9ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (6.3ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (6.7ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT TRUE, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (7.0ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (1.1ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (6.4ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (6.4ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (7.3ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT FALSE, "checkout_confirmed" boolean DEFAULT FALSE, "checkin_confirmed" boolean DEFAULT FALSE, "costs_approved" boolean DEFAULT FALSE, "prepared_by_id" integer)  (3.6ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (3.6ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (4.3ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (3.7ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (3.3ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (3.4ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (4.0ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (6.9ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (6.5ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (3.6ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (7.1ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT FALSE, "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (3.4ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (3.3ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (3.4ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (6.9ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (6.8ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.9ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (4.8ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.2ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (3.7ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (6.7ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (6.8ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.0ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (6.6ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.3ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.3ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.4ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (1.0ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (6.5ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.4ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.7ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (8.1ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (2.0ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (4.0ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (6.6ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (4.8ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.1ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (7.1ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (7.0ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (6.9ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (6.3ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (3.2ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (3.1ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.5ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.8ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.8ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.3ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.3ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.6ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (3.1ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.5ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (3.2ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (3.3ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (2.8ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.6ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.7ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.8ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.7ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (3.2ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (3.1ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.8ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.5ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (6.5ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.6ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.3ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20171218113530), (20171219134144), (20171220133826), (20171221110018);   (6.3ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.8ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.8ms) BEGIN ActiveRecord::InternalMetadata Create (1.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-09-05 06:10:59.066442"], ["updated_at", "2018-09-05 06:10:59.066442"]]  (1.2ms) COMMIT ActiveRecord::InternalMetadata Load (1.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.7ms) BEGIN ActiveRecord::InternalMetadata Update (1.0ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-09-05 06:10:59.075351"], ["key", "environment"]]  (1.4ms) COMMIT  (1.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.7ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (122.2ms) DROP DATABASE IF EXISTS "construction_test"  (308.2ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.8ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (1.0ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (10.4ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (7.3ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.3ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.8ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (4.2ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.4ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (6.2ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.6ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (6.8ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT TRUE NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (1.8ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.6ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.8ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.6ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (6.6ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (1.0ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (7.1ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (7.4ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.1ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.5ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (6.4ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (6.2ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (7.2ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT TRUE, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (7.3ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (6.3ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (6.7ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (7.1ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT FALSE, "checkout_confirmed" boolean DEFAULT FALSE, "checkin_confirmed" boolean DEFAULT FALSE, "costs_approved" boolean DEFAULT FALSE, "prepared_by_id" integer)  (3.3ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (3.8ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (3.4ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (3.3ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (3.2ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (3.3ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (3.3ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (7.1ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (6.1ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (3.6ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (7.2ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT FALSE, "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (3.2ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (3.4ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (3.3ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (6.7ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (7.4ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (4.3ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.3ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (3.2ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (7.5ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (6.8ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (6.5ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.5ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.3ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.6ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (7.3ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (8.1ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (4.1ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (6.3ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (1.9ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (3.7ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.9ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (7.8ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (4.5ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.4ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (1.5ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (6.8ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (6.9ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (6.6ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (6.7ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.9ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (4.1ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (3.2ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.2ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.3ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.5ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.2ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.7ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.4ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.4ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.9ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.4ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (3.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (3.3ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (3.1ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.7ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (3.1ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.8ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.3ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (3.3ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.8ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.9ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (3.2ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (6.4ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.9ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.5ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20171218113530), (20171219134144), (20171220133826), (20171221110018);   (6.1ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.8ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.7ms) BEGIN ActiveRecord::InternalMetadata Create (1.1ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-09-05 06:15:44.428905"], ["updated_at", "2018-09-05 06:15:44.428905"]]  (1.2ms) COMMIT ActiveRecord::InternalMetadata Load (0.7ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.6ms) BEGIN ActiveRecord::InternalMetadata Update (0.8ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-09-05 06:15:44.436847"], ["key", "environment"]]  (1.3ms) COMMIT  (1.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.8ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.7ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (126.8ms) DROP DATABASE IF EXISTS "construction_test"  (376.2ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.7ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.7ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (10.7ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (7.0ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.3ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (10.3ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.4ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (7.3ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (8.4ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT TRUE NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (2.0ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (4.3ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.9ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.6ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (7.0ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (6.5ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (1.0ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (7.3ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.5ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (8.9ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (6.6ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (7.5ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT TRUE, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.5ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (6.9ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (8.1ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (6.7ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (7.0ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (7.6ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT FALSE, "checkout_confirmed" boolean DEFAULT FALSE, "checkin_confirmed" boolean DEFAULT FALSE, "costs_approved" boolean DEFAULT FALSE, "prepared_by_id" integer)  (3.5ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (3.7ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (4.1ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (13.8ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (3.4ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (4.8ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (3.3ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (7.3ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (6.8ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (3.6ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (10.5ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT FALSE, "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (3.3ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (3.9ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (3.5ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (7.0ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (10.0ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.2ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (5.2ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.4ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (3.6ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (6.6ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (6.5ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (14.1ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.6ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.2ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.4ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.8ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (7.2ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.6ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.8ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (4.4ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.8ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (11.8ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (1.9ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (3.5ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (6.7ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (4.9ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.3ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (11.4ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (7.1ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (6.7ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (8.3ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (3.4ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (3.6ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.5ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.4ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.5ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.5ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (3.6ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.6ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (3.6ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.7ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.8ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.9ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (3.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (3.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (4.3ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (3.3ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.6ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.9ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.8ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.4ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.7ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.6ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.8ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.5ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.8ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (9.0ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.8ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.6ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20171218113530), (20171219134144), (20171220133826), (20171221110018);   (6.7ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.8ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.6ms) BEGIN ActiveRecord::InternalMetadata Create (1.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-09-05 06:17:50.370292"], ["updated_at", "2018-09-05 06:17:50.370292"]]  (1.3ms) COMMIT ActiveRecord::InternalMetadata Load (1.4ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.8ms) BEGIN ActiveRecord::InternalMetadata Update (1.5ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-09-05 06:17:50.380615"], ["key", "environment"]]  (1.6ms) COMMIT  (1.5ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.8ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.6ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (125.1ms) DROP DATABASE IF EXISTS "construction_test"  (327.7ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (0.7ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (0.9ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (9.2ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (8.0ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.2ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (4.4ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (3.4ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (7.3ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (10.2ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT TRUE NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (1.7ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (3.5ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (1.7ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.6ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (6.7ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (6.6ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.8ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (9.2ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (3.1ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (6.5ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (7.0ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (6.9ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT TRUE, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (7.6ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.4ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (7.0ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (6.3ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (12.7ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT FALSE, "checkout_confirmed" boolean DEFAULT FALSE, "checkin_confirmed" boolean DEFAULT FALSE, "costs_approved" boolean DEFAULT FALSE, "prepared_by_id" integer)  (3.3ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (3.4ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (3.2ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (3.2ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (3.7ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (3.4ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (4.3ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (6.7ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (11.5ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (3.9ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (6.5ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT FALSE, "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (3.2ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (3.8ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (3.3ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (7.4ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (6.7ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.6ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (6.1ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (7.9ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.6ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (3.2ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.5ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (15.3ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (7.6ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (6.3ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (4.7ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.1ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.4ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.9ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (14.2ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.3ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.4ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (3.9ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.8ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (6.3ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (1.8ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (3.3ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (10.9ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (5.0ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.9ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.9ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (1.1ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (7.1ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (12.1ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.6ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (6.2ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.8ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (15.3ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (4.2ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (3.3ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.3ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (2.6ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.5ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (3.0ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.7ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.6ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.6ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (4.4ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (3.5ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (3.2ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.8ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (3.7ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.3ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.8ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (5.9ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (3.0ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.6ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.9ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (2.5ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.2ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.7ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.3ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.5ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.6ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.8ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.4ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.5ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (8.3ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.4ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.6ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.4ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20171218113530), (20171219134144), (20171220133826), (20171221110018);   (6.3ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.7ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.6ms) BEGIN ActiveRecord::InternalMetadata Create (1.0ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-09-05 06:20:59.573153"], ["updated_at", "2018-09-05 06:20:59.573153"]]  (1.3ms) COMMIT ActiveRecord::InternalMetadata Load (0.7ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.7ms) BEGIN ActiveRecord::InternalMetadata Update (1.0ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-09-05 06:20:59.581579"], ["key", "environment"]]  (1.2ms) COMMIT  (1.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.9ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (0.9ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (1.4ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (0.8ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 [["key", "environment"]]  (122.7ms) DROP DATABASE IF EXISTS "construction_test"  (349.6ms) CREATE DATABASE "construction_test" ENCODING = 'utf8' SQL (1.1ms) CREATE EXTENSION IF NOT EXISTS "plpgsql"  (2.1ms) DROP TABLE IF EXISTS "mks_auth_application_modules" CASCADE  (17.1ms) CREATE TABLE "mks_auth_application_modules" ("id" serial NOT NULL PRIMARY KEY, "code" character varying NOT NULL, "name" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.2ms) DROP TABLE IF EXISTS "mks_auth_menus" CASCADE  (11.6ms) CREATE TABLE "mks_auth_menus" ("id" serial NOT NULL PRIMARY KEY, "text" character varying NOT NULL, "icon_cls" character varying, "class_name" character varying, "location" character varying, "parent_id" integer, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.2ms) CREATE INDEX "index_mks_auth_menus_on_application_module_id" ON "mks_auth_menus" ("application_module_id")  (3.5ms) CREATE INDEX "index_mks_auth_menus_on_parent_id" ON "mks_auth_menus" ("parent_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_menus_user_roles" CASCADE  (5.4ms) CREATE TABLE "mks_auth_menus_user_roles" ("id" serial NOT NULL PRIMARY KEY, "menu_id" integer, "user_role_id" integer)  (4.3ms) CREATE INDEX "index_mks_auth_menus_user_roles_on_menu_id_and_user_role_id" ON "mks_auth_menus_user_roles" ("menu_id", "user_role_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_user_roles" CASCADE  (8.1ms) CREATE TABLE "mks_auth_user_roles" ("id" serial NOT NULL PRIMARY KEY, "name" character varying NOT NULL, "application_module_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.6ms) CREATE INDEX "index_mks_auth_user_roles_on_application_module_id" ON "mks_auth_user_roles" ("application_module_id")  (0.6ms) DROP TABLE IF EXISTS "mks_auth_users" CASCADE  (8.3ms) CREATE TABLE "mks_auth_users" ("id" serial NOT NULL PRIMARY KEY, "first_name" character varying NOT NULL, "last_name" character varying NOT NULL, "email" character varying NOT NULL, "active" boolean DEFAULT TRUE NOT NULL, "password_digest" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.5ms) DROP TABLE IF EXISTS "mks_auth_users_application_modules" CASCADE  (2.1ms) CREATE TABLE "mks_auth_users_application_modules" ("user_id" bigint, "application_module_id" bigint)  (4.0ms) CREATE INDEX "am_on_users_indx" ON "mks_auth_users_application_modules" ("user_id", "application_module_id")  (0.7ms) DROP TABLE IF EXISTS "mks_auth_users_user_roles" CASCADE  (2.2ms) CREATE TABLE "mks_auth_users_user_roles" ("user_id" integer, "user_role_id" integer)  (3.8ms) CREATE INDEX "index_mks_auth_users_user_roles_on_user_id_and_user_role_id" ON "mks_auth_users_user_roles" ("user_id", "user_role_id")  (0.8ms) DROP TABLE IF EXISTS "mks_edm_equipment_categories" CASCADE  (7.7ms) CREATE TABLE "mks_edm_equipment_categories" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "equipment_type_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.7ms) CREATE INDEX "ec_on_et_indx" ON "mks_edm_equipment_categories" ("equipment_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_components" CASCADE  (7.5ms) CREATE TABLE "mks_edm_equipment_components" ("id" bigserial primary key, "serial_no" character varying, "name" character varying NOT NULL, "equipment_item_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (6.7ms) CREATE INDEX "ei_on_ec_indx" ON "mks_edm_equipment_components" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_items" CASCADE  (8.7ms) CREATE TABLE "mks_edm_equipment_items" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "status" character varying DEFAULT 'READY', "serial_number" character varying, "brand" character varying, "item_model" character varying, "purchase_price" float NOT NULL, "purchase_date" date NOT NULL, "license_fee" float, "tax" float, "equipment_id" bigint, "current_location_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (7.6ms) CREATE INDEX "equipment_on_el_indx" ON "mks_edm_equipment_items" ("current_location_id")  (4.2ms) CREATE INDEX "equipment_on_ei_indx" ON "mks_edm_equipment_items" ("equipment_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipment_locations" CASCADE  (8.9ms) CREATE TABLE "mks_edm_equipment_locations" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "location_type_id" bigint, "description" character varying, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.4ms) CREATE INDEX "lt_on_el_indx" ON "mks_edm_equipment_locations" ("location_type_id")  (0.6ms) DROP TABLE IF EXISTS "mks_edm_equipment_types" CASCADE  (12.2ms) CREATE TABLE "mks_edm_equipment_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.5ms) DROP TABLE IF EXISTS "mks_edm_equipment_valuations" CASCADE  (10.0ms) CREATE TABLE "mks_edm_equipment_valuations" ("id" bigserial primary key, "equipment_item_id" bigint, "initial_cost" float NOT NULL, "residual_value" float NOT NULL, "work_hrs_per_yr" float NOT NULL, "life_year" float NOT NULL, "insurance_premium" float NOT NULL, "fuel_cost_per_hr" float, "oil_rate" float, "repair_rate" float, "rate_of_return" float, "dep_method" character varying, "is_current" boolean DEFAULT TRUE, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.1ms) CREATE INDEX "ev_on_ei_indx" ON "mks_edm_equipment_valuations" ("equipment_item_id")  (0.7ms) DROP TABLE IF EXISTS "mks_edm_equipments" CASCADE  (10.1ms) CREATE TABLE "mks_edm_equipments" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "minimum_acquisition_time" float DEFAULT 0.0 NOT NULL, "equipment_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (4.8ms) CREATE INDEX "equipment_on_ec_indx" ON "mks_edm_equipments" ("equipment_category_id")  (2.7ms) DROP TABLE IF EXISTS "mks_edm_location_types" CASCADE  (8.5ms) CREATE TABLE "mks_edm_location_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (1.5ms) DROP TABLE IF EXISTS "mks_maintenance_cost_types" CASCADE  (10.9ms) CREATE TABLE "mks_maintenance_cost_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "fields" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_maintenance_job_cards" CASCADE  (8.8ms) CREATE TABLE "mks_maintenance_job_cards" ("id" bigserial primary key, "maintenance_service_order_id" bigint, "code" character varying, "start_date" date, "due_date" date, "service_provider_id" bigint, "checkout_date" date, "checkout_by_id" bigint, "checkout_to_id" bigint, "maintenance_status_id" bigint, "checkin_date" date, "checkin_by_id" bigint, "checkin_to_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "approved" boolean DEFAULT FALSE, "checkout_confirmed" boolean DEFAULT FALSE, "checkin_confirmed" boolean DEFAULT FALSE, "costs_approved" boolean DEFAULT FALSE, "prepared_by_id" integer)  (5.8ms) CREATE INDEX "chb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_by_id")  (5.3ms) CREATE INDEX "cht_on_jc_indx" ON "mks_maintenance_job_cards" ("checkin_to_id")  (4.9ms) CREATE INDEX "cb_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_by_id")  (4.5ms) CREATE INDEX "ct_on_jc_indx" ON "mks_maintenance_job_cards" ("checkout_to_id")  (4.0ms) CREATE INDEX "mso_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_service_order_id")  (4.8ms) CREATE INDEX "ms_on_jc_indx" ON "mks_maintenance_job_cards" ("maintenance_status_id")  (9.9ms) CREATE INDEX "sp_on_jc_indx" ON "mks_maintenance_job_cards" ("service_provider_id")  (0.9ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_categories" CASCADE  (19.2ms) CREATE TABLE "mks_maintenance_maintenance_categories" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.2ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_costs" CASCADE  (12.3ms) CREATE TABLE "mks_maintenance_maintenance_costs" ("id" bigserial primary key, "job_card_id" bigint, "cost_type_id" bigint, "cost_detail" json NOT NULL, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (8.8ms) CREATE INDEX "ct_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("cost_type_id")  (4.9ms) CREATE INDEX "jc_on_mc_indx" ON "mks_maintenance_maintenance_costs" ("job_card_id")  (1.2ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_service_orders" CASCADE  (11.2ms) CREATE TABLE "mks_maintenance_maintenance_service_orders" ("id" bigserial primary key, "title" character varying NOT NULL, "description" character varying, "equipment_item_id" bigint, "maintenance_type_id" bigint, "start_date" date, "end_date" date, "prepared_by_id" bigint, "approved" boolean DEFAULT FALSE, "status" character varying DEFAULT 'draft', "approved_by_id" bigint, "remark" character varying, "current_reading" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (6.2ms) CREATE INDEX "ab_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("approved_by_id")  (5.0ms) CREATE INDEX "ei_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("equipment_item_id")  (6.8ms) CREATE INDEX "mt_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("maintenance_type_id")  (4.9ms) CREATE INDEX "pb_on_mso_indx" ON "mks_maintenance_maintenance_service_orders" ("prepared_by_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_statuses" CASCADE  (28.9ms) CREATE TABLE "mks_maintenance_maintenance_statuses" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_maintenance_types" CASCADE  (7.9ms) CREATE TABLE "mks_maintenance_maintenance_types" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "maintenance_category_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.4ms) CREATE INDEX "mt_on_mc_indx" ON "mks_maintenance_maintenance_types" ("maintenance_category_id")  (0.7ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_settings" CASCADE  (4.8ms) CREATE TABLE "mks_maintenance_schedule_settings" ("id" bigserial primary key, "equipment_id" bigint, "maintenance_type_id" bigint, "schedule_unit_id" bigint, "value" float NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.4ms) CREATE INDEX "equipment_on_ss_indx" ON "mks_maintenance_schedule_settings" ("equipment_id")  (3.7ms) CREATE INDEX "mt_on_ss_indx" ON "mks_maintenance_schedule_settings" ("maintenance_type_id")  (3.7ms) CREATE INDEX "su_on_ss_indx" ON "mks_maintenance_schedule_settings" ("schedule_unit_id")  (0.8ms) DROP TABLE IF EXISTS "mks_maintenance_schedule_units" CASCADE  (6.5ms) CREATE TABLE "mks_maintenance_schedule_units" ("id" bigserial primary key, "code" character varying, "name" character varying, "description" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_chargeable_service_discounts" CASCADE  (7.0ms) CREATE TABLE "mks_rate_chargeable_service_discounts" ("id" bigserial primary key, "unit_variable" character varying NOT NULL, "from" float NOT NULL, "to" float NOT NULL, "value" float NOT NULL, "chargeable_service_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_rate_chargeable_services" CASCADE  (7.2ms) CREATE TABLE "mks_rate_chargeable_services" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "service_type_id" integer, "base_unit_id" integer, "utilization_unit_id" integer, "service_delivery_unit_id" integer, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (6.0ms) CREATE INDEX "bu_on_cs_indx" ON "mks_rate_chargeable_services" ("base_unit_id")  (3.7ms) CREATE INDEX "sdu_on_cs_indx" ON "mks_rate_chargeable_services" ("service_delivery_unit_id")  (3.3ms) CREATE INDEX "st_on_cs_indx" ON "mks_rate_chargeable_services" ("service_type_id")  (3.2ms) CREATE INDEX "uu_on_cs_indx" ON "mks_rate_chargeable_services" ("utilization_unit_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_rate_change_requests" CASCADE  (7.7ms) CREATE TABLE "mks_rate_rate_change_requests" ("id" bigserial primary key, "reference_number" character varying, "authorized_by" character varying NOT NULL, "effective_on" date NOT NULL, "authorized_on" date NOT NULL, "rates" json NOT NULL, "status" character varying DEFAULT 'SUBMITTED' NOT NULL, "created_by_id" bigint, "approved_by_id" bigint, "remark" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (5.2ms) CREATE INDEX "ab_on_rcr_indx" ON "mks_rate_rate_change_requests" ("approved_by_id")  (3.4ms) CREATE INDEX "cb_on_rcr_indx" ON "mks_rate_rate_change_requests" ("created_by_id")  (4.1ms) CREATE UNIQUE INDEX "index_mks_rate_rate_change_requests_on_reference_number" ON "mks_rate_rate_change_requests" ("reference_number")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_bundles" CASCADE  (10.8ms) CREATE TABLE "mks_rate_service_bundles" ("id" bigserial primary key, "code" character varying, "name" character varying NOT NULL, "description" character varying, "percent_discount" float DEFAULT 0.0 NOT NULL, "service_delivery_unit_id" bigint, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "sdu_on_sb_indx" ON "mks_rate_service_bundles" ("service_delivery_unit_id")  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_bundles_chargeable_services" CASCADE  (2.1ms) CREATE TABLE "mks_rate_service_bundles_chargeable_services" ("service_bundle_id" bigint, "chargeable_service_id" bigint)  (3.5ms) CREATE INDEX "sb_on_cs_indx" ON "mks_rate_service_bundles_chargeable_services" ("service_bundle_id", "chargeable_service_id")  (0.8ms) DROP TABLE IF EXISTS "mks_rate_service_delivery_units" CASCADE  (8.4ms) CREATE TABLE "mks_rate_service_delivery_units" ("id" bigserial primary key, "code" character varying NOT NULL, "name" character varying NOT NULL, "address" character varying NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rate_service_rates" CASCADE  (5.2ms) CREATE TABLE "mks_rate_service_rates" ("id" bigserial primary key, "chargeable_service_id" bigint, "equipment_item_id" bigint, "base_rate" float DEFAULT 0.0, "utilization_rate" float DEFAULT 0.0, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.5ms) CREATE INDEX "cs_on_sr_indx" ON "mks_rate_service_rates" ("chargeable_service_id")  (3.2ms) CREATE INDEX "cs_on_ei_indx" ON "mks_rate_service_rates" ("equipment_item_id")  (0.6ms) DROP TABLE IF EXISTS "mks_rate_service_types" CASCADE  (7.7ms) CREATE TABLE "mks_rate_service_types" ("id" bigserial primary key, "code" character varying, "name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_rate_unit_of_charges" CASCADE  (6.8ms) CREATE TABLE "mks_rate_unit_of_charges" ("id" bigserial primary key, "name" character varying NOT NULL, "unit_variables" json NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.9ms) DROP TABLE IF EXISTS "mks_rent_clients" CASCADE  (6.6ms) CREATE TABLE "mks_rent_clients" ("id" bigserial primary key, "name" character varying NOT NULL, "address" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (0.7ms) DROP TABLE IF EXISTS "mks_rent_offer_requests" CASCADE  (7.9ms) CREATE TABLE "mks_rent_offer_requests" ("id" bigserial primary key, "client_id" bigint, "description" character varying, "destination" character varying, "prepared_by_id" bigint, "status" character varying DEFAULT 'DRAFT' NOT NULL, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL)  (3.9ms) CREATE INDEX "client_on_er_indx" ON "mks_rent_offer_requests" ("client_id")  (3.9ms) CREATE INDEX "equipment_on_rb_indx" ON "mks_rent_offer_requests" ("prepared_by_id")  (3.6ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_e5dd25fcb5" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.7ms) ALTER TABLE "mks_auth_menus" ADD CONSTRAINT "fk_rails_826b2757bc" FOREIGN KEY ("parent_id") REFERENCES "mks_auth_menus" ("id")   (3.0ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_1807c05e36" FOREIGN KEY ("menu_id") REFERENCES "mks_auth_menus" ("id")   (2.7ms) ALTER TABLE "mks_auth_menus_user_roles" ADD CONSTRAINT "fk_rails_c24fca59c0" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (2.6ms) ALTER TABLE "mks_auth_user_roles" ADD CONSTRAINT "fk_rails_b0b293e4e2" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (2.8ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_b100f8542c" FOREIGN KEY ("application_module_id") REFERENCES "mks_auth_application_modules" ("id")   (3.4ms) ALTER TABLE "mks_auth_users_application_modules" ADD CONSTRAINT "fk_rails_1010e0182a" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_3dae904cd8" FOREIGN KEY ("user_role_id") REFERENCES "mks_auth_user_roles" ("id")   (3.3ms) ALTER TABLE "mks_auth_users_user_roles" ADD CONSTRAINT "fk_rails_7cc19890aa" FOREIGN KEY ("user_id") REFERENCES "mks_auth_users" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipment_categories" ADD CONSTRAINT "fk_rails_37d48f9db9" FOREIGN KEY ("equipment_type_id") REFERENCES "mks_edm_equipment_types" ("id")   (3.0ms) ALTER TABLE "mks_edm_equipment_components" ADD CONSTRAINT "fk_rails_df30d7c6f8" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.9ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_c0b56e395b" FOREIGN KEY ("current_location_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.7ms) ALTER TABLE "mks_edm_equipment_items" ADD CONSTRAINT "fk_rails_9c44a32cfe" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (3.2ms) ALTER TABLE "mks_edm_equipment_locations" ADD CONSTRAINT "fk_rails_4117320862" FOREIGN KEY ("location_type_id") REFERENCES "mks_edm_location_types" ("id")   (2.5ms) ALTER TABLE "mks_edm_equipment_valuations" ADD CONSTRAINT "fk_rails_b09a0ab3c3" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.6ms) ALTER TABLE "mks_edm_equipments" ADD CONSTRAINT "fk_rails_59110db010" FOREIGN KEY ("equipment_category_id") REFERENCES "mks_edm_equipment_categories" ("id")   (3.2ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_71608df4d7" FOREIGN KEY ("checkin_by_id") REFERENCES "mks_auth_users" ("id")   (2.4ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_2d751894b3" FOREIGN KEY ("checkout_by_id") REFERENCES "mks_auth_users" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_b1bfab76fa" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_4b617666f2" FOREIGN KEY ("checkin_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.5ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_da85f112f1" FOREIGN KEY ("checkout_to_id") REFERENCES "mks_edm_equipment_locations" ("id")   (2.9ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_432c5d16fa" FOREIGN KEY ("service_provider_id") REFERENCES "mks_edm_equipment_locations" ("id")   (3.2ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_d5dda430d5" FOREIGN KEY ("maintenance_service_order_id") REFERENCES "mks_maintenance_maintenance_service_orders" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_job_cards" ADD CONSTRAINT "fk_rails_14cf824cbc" FOREIGN KEY ("maintenance_status_id") REFERENCES "mks_maintenance_maintenance_statuses" ("id")   (2.3ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e7f1fb2bae" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (3.3ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_e104595312" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_3f3405378e" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.6ms) ALTER TABLE "mks_maintenance_maintenance_service_orders" ADD CONSTRAINT "fk_rails_744b2022f5" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (3.1ms) ALTER TABLE "mks_maintenance_maintenance_types" ADD CONSTRAINT "fk_rails_40e7db53d5" FOREIGN KEY ("maintenance_category_id") REFERENCES "mks_maintenance_maintenance_categories" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_6b4df17776" FOREIGN KEY ("equipment_id") REFERENCES "mks_edm_equipments" ("id")   (2.7ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_eed98d8173" FOREIGN KEY ("maintenance_type_id") REFERENCES "mks_maintenance_maintenance_types" ("id")   (3.0ms) ALTER TABLE "mks_maintenance_schedule_settings" ADD CONSTRAINT "fk_rails_07f79b50c2" FOREIGN KEY ("schedule_unit_id") REFERENCES "mks_maintenance_schedule_units" ("id")   (2.9ms) ALTER TABLE "mks_rate_chargeable_service_discounts" ADD CONSTRAINT "fk_rails_688682e0b5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (3.0ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_4e0ff36276" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (2.5ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_c9195a9eb4" FOREIGN KEY ("service_type_id") REFERENCES "mks_rate_service_types" ("id")   (3.9ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_323d899c02" FOREIGN KEY ("base_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (2.8ms) ALTER TABLE "mks_rate_chargeable_services" ADD CONSTRAINT "fk_rails_a4bbde1129" FOREIGN KEY ("utilization_unit_id") REFERENCES "mks_rate_unit_of_charges" ("id")   (3.3ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_1ec309ecbf" FOREIGN KEY ("approved_by_id") REFERENCES "mks_auth_users" ("id")   (2.6ms) ALTER TABLE "mks_rate_rate_change_requests" ADD CONSTRAINT "fk_rails_c0525c8963" FOREIGN KEY ("created_by_id") REFERENCES "mks_auth_users" ("id")   (3.3ms) ALTER TABLE "mks_rate_service_bundles" ADD CONSTRAINT "fk_rails_d6c823a60f" FOREIGN KEY ("service_delivery_unit_id") REFERENCES "mks_rate_service_delivery_units" ("id")   (3.1ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_520a0a95a5" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (2.8ms) ALTER TABLE "mks_rate_service_bundles_chargeable_services" ADD CONSTRAINT "fk_rails_cde2572db6" FOREIGN KEY ("service_bundle_id") REFERENCES "mks_rate_service_bundles" ("id")   (2.8ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_8f0c330d29" FOREIGN KEY ("equipment_item_id") REFERENCES "mks_edm_equipment_items" ("id")   (2.6ms) ALTER TABLE "mks_rate_service_rates" ADD CONSTRAINT "fk_rails_a39cc6503a" FOREIGN KEY ("chargeable_service_id") REFERENCES "mks_rate_chargeable_services" ("id")   (3.9ms) ALTER TABLE "mks_rent_offer_requests" ADD CONSTRAINT "fk_rails_eb6ab13de0" FOREIGN KEY ("prepared_by_id") REFERENCES "mks_auth_users" ("id")   (9.6ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL PRIMARY KEY)  (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC  (2.1ms) INSERT INTO "schema_migrations" (version) VALUES (20180401110018)  (1.5ms) INSERT INTO "schema_migrations" (version) VALUES (20171212165507), (20171213152154), (20171213152159), (20171214152030), (20171215092528), (20171218113530), (20171219134144), (20171220133826), (20171221110018);   (6.0ms) CREATE TABLE "ar_internal_metadata" ("key" character varying NOT NULL PRIMARY KEY, "value" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) ActiveRecord::InternalMetadata Load (0.8ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (2.2ms) BEGIN ActiveRecord::InternalMetadata Create (1.3ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key" [["key", "environment"], ["value", "development"], ["created_at", "2018-09-05 06:21:36.188633"], ["updated_at", "2018-09-05 06:21:36.188633"]]  (1.6ms) COMMIT ActiveRecord::InternalMetadata Load (0.9ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", "environment"], ["LIMIT", 1]]  (0.6ms) BEGIN ActiveRecord::InternalMetadata Update (1.0ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "test"], ["updated_at", "2018-09-05 06:21:36.198402"], ["key", "environment"]]  (1.5ms) COMMIT