cats_core 1.5.19 → 1.5.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/cats/core/commodities_controller.rb +3 -3
- data/app/controllers/cats/core/dispatch_authorizations_controller.rb +4 -4
- data/app/controllers/cats/core/dispatch_plan_items_controller.rb +1 -1
- data/app/controllers/cats/core/dispatch_plans_controller.rb +2 -2
- data/app/controllers/cats/core/dispatch_transactions_controller.rb +1 -1
- data/app/controllers/cats/core/dispatches_controller.rb +5 -5
- data/app/controllers/cats/core/loans_controller.rb +1 -1
- data/app/controllers/cats/core/purchase_orders_controller.rb +2 -2
- data/app/controllers/cats/core/receipt_authorizations_controller.rb +5 -5
- data/app/controllers/cats/core/receipt_transactions_controller.rb +2 -2
- data/app/controllers/cats/core/receipts_controller.rb +1 -1
- data/app/controllers/cats/core/roles_controller.rb +1 -1
- data/app/controllers/cats/core/round_beneficiaries_controller.rb +5 -5
- data/app/controllers/cats/core/round_plans_controller.rb +3 -3
- data/app/controllers/cats/core/stack_transactions_controller.rb +1 -1
- data/app/controllers/cats/core/stacks_controller.rb +2 -2
- data/app/controllers/cats/core/stores_controller.rb +1 -1
- data/app/controllers/cats/core/swaps_controller.rb +2 -2
- data/app/controllers/cats/core/users_controller.rb +1 -1
- data/app/controllers/concerns/cats/core/common.rb +15 -16
- data/app/models/cats/core/authorization.rb +1 -1
- data/app/models/cats/core/beneficiary_plan_item.rb +1 -1
- data/app/models/cats/core/commodity.rb +16 -12
- data/app/models/cats/core/commodity_substitution.rb +2 -2
- data/app/models/cats/core/dispatch.rb +29 -16
- data/app/models/cats/core/dispatch_authorization.rb +7 -3
- data/app/models/cats/core/dispatch_plan.rb +14 -6
- data/app/models/cats/core/dispatch_plan_item.rb +20 -10
- data/app/models/cats/core/dispatch_transaction.rb +15 -8
- data/app/models/cats/core/location.rb +2 -2
- data/app/models/cats/core/receipt_authorization.rb +18 -2
- data/app/models/cats/core/receipt_transaction.rb +17 -2
- data/app/models/cats/core/round_beneficiary.rb +4 -4
- data/app/models/cats/core/round_plan.rb +20 -2
- data/app/models/cats/core/round_plan_item.rb +24 -2
- data/app/models/cats/core/route.rb +15 -2
- data/app/models/cats/core/stack.rb +40 -30
- data/app/models/cats/core/stacking_rule.rb +2 -2
- data/app/models/cats/core/store.rb +21 -21
- data/app/models/cats/core/transporter.rb +2 -2
- data/app/models/cats/core/unit_conversion.rb +1 -3
- data/app/serializers/cats/core/cash_donation_serializer.rb +1 -1
- data/app/serializers/cats/core/commodity_donation_serializer.rb +2 -2
- data/app/serializers/cats/core/commodity_serializer.rb +2 -2
- data/app/serializers/cats/core/dispatch_authorization_serializer.rb +2 -2
- data/app/serializers/cats/core/dispatch_plan_item_serializer.rb +3 -3
- data/app/serializers/cats/core/dispatch_plan_serializer.rb +1 -1
- data/app/serializers/cats/core/dispatch_serializer.rb +2 -2
- data/app/serializers/cats/core/dispatch_transaction_serializer.rb +1 -1
- data/app/serializers/cats/core/loan_serializer.rb +1 -1
- data/app/serializers/cats/core/purchase_order_serializer.rb +2 -2
- data/app/serializers/cats/core/receipt_authorization_serializer.rb +2 -2
- data/app/serializers/cats/core/receipt_serializer.rb +1 -1
- data/app/serializers/cats/core/receipt_transaction_serializer.rb +2 -2
- data/app/serializers/cats/core/round_beneficiary_serializer.rb +1 -1
- data/app/serializers/cats/core/round_plan_serializer.rb +1 -1
- data/app/serializers/cats/core/stack_serializer.rb +1 -1
- data/app/serializers/cats/core/store_serializer.rb +1 -1
- data/app/serializers/cats/core/swap_serializer.rb +2 -2
- data/app/services/cats/core/authorization_service.rb +3 -9
- data/app/services/cats/core/beneficiary_service.rb +2 -2
- data/app/services/cats/core/dispatch_plan_service.rb +1 -1
- data/app/services/cats/core/dispatch_service.rb +18 -20
- data/app/services/cats/core/notification_service.rb +1 -1
- data/app/services/cats/core/round_plan_service.rb +4 -6
- data/app/services/cats/core/space_service.rb +6 -6
- data/app/services/cats/core/stack_service.rb +8 -8
- data/app/services/cats/core/user_service.rb +1 -1
- data/db/migrate/20210715114910_create_cats_core_users.rb +3 -3
- data/db/migrate/20210715120018_create_cats_core_roles.rb +11 -11
- data/db/migrate/20210715121244_create_cats_core_menus.rb +3 -3
- data/db/migrate/20210715122141_create_cats_core_menu_items.rb +3 -3
- data/db/migrate/20210715122423_create_cats_core_role_menus.rb +12 -12
- data/db/migrate/20210717031810_create_cats_core_plans.rb +3 -3
- data/db/migrate/20210717032024_create_cats_core_plan_items.rb +19 -19
- data/db/migrate/20210717032260_create_cats_core_beneficiary_categories.rb +3 -3
- data/db/migrate/20210717032270_create_cats_core_rations.rb +9 -9
- data/db/migrate/20210717032290_create_cats_core_beneficiary_plan_items.rb +7 -7
- data/db/migrate/20210717032295_create_cats_core_plan_item_details.rb +7 -7
- data/db/migrate/20210717032330_create_cats_core_commodity_donations.rb +12 -12
- data/db/migrate/20210717032408_create_cats_core_cash_donations.rb +6 -6
- data/db/migrate/20210717032602_create_cats_core_gift_certificates.rb +12 -12
- data/db/migrate/20210717032855_create_cats_core_purchase_orders.rb +12 -12
- data/db/migrate/20210717032927_create_cats_core_projects.rb +3 -3
- data/db/migrate/20210717033223_create_cats_core_commodities.rb +9 -9
- data/db/migrate/20210717140855_create_cats_core_stores.rb +3 -3
- data/db/migrate/20210717171101_create_cats_core_stacks.rb +9 -9
- data/db/migrate/20210718040129_create_cats_core_routes.rb +9 -9
- data/db/migrate/20210718042755_create_cats_core_rhn_requests.rb +6 -6
- data/db/migrate/20210718043328_create_cats_core_dispatch_plans.rb +6 -6
- data/db/migrate/20210718043401_create_cats_core_dispatch_plan_items.rb +15 -15
- data/db/migrate/20210718045516_create_cats_core_dispatches.rb +12 -12
- data/db/migrate/20210718055414_create_cats_core_dispatch_authorizations.rb +12 -12
- data/db/migrate/20210718202957_create_cats_core_dispatch_transactions.rb +10 -10
- data/db/migrate/20210727074646_create_cats_core_receipt_authorizations.rb +12 -12
- data/db/migrate/20210727105834_create_cats_core_receipts.rb +6 -6
- data/db/migrate/20210728041505_create_cats_core_lost_commodities.rb +6 -6
- data/db/migrate/20210814160628_create_cats_core_receipt_transactions.rb +9 -9
- data/db/migrate/20210814175406_create_cats_core_stack_transactions.rb +9 -9
- data/db/migrate/20211215114737_create_cats_core_transport_plans.rb +3 -3
- data/db/migrate/20211215114835_create_cats_core_transport_plan_items.rb +9 -9
- data/db/migrate/20211215121151_create_cats_core_transport_bids.rb +3 -3
- data/db/migrate/20211215124452_create_cats_core_transport_bid_items.rb +9 -9
- data/db/migrate/20211229160125_create_cats_core_transport_offers.rb +7 -7
- data/db/migrate/20211229160126_create_cats_core_offer_items.rb +6 -6
- data/db/migrate/20211229160127_create_cats_core_transport_contracts.rb +6 -6
- data/db/migrate/20211229160128_create_cats_core_contract_items.rb +9 -9
- data/db/migrate/20211229160129_create_cats_core_commodity_substitutions.rb +10 -10
- data/db/migrate/20220103152802_create_cats_core_tenderers.rb +6 -6
- data/db/migrate/20220107121752_create_cats_core_round_plans.rb +6 -6
- data/db/migrate/20220107122280_create_cats_core_round_rations.rb +12 -12
- data/db/migrate/20220107125025_create_cats_core_round_plan_items.rb +18 -18
- data/db/migrate/20220107126025_create_cats_core_beneficiary_round_plan_items.rb +7 -7
- data/db/migrate/20220107132433_create_cats_core_round_plan_item_details.rb +9 -9
- data/db/migrate/20220209083928_create_cats_core_hub_authorizations.rb +12 -12
- data/db/migrate/20220416143416_create_cats_core_unit_conversions.rb +7 -7
- data/db/migrate/20220417105839_create_cats_core_transport_requisitions.rb +12 -12
- data/db/migrate/20220417123835_create_cats_core_transport_requisition_items.rb +9 -9
- data/db/migrate/20220417151821_create_cats_core_transport_requisition_details.rb +6 -6
- data/db/migrate/20220506082329_create_cats_core_transport_orders.rb +9 -9
- data/db/migrate/20220506083042_create_cats_core_transport_order_items.rb +12 -12
- data/db/migrate/20220511082354_create_cats_core_beneficiaries.rb +6 -6
- data/db/migrate/20220626063501_create_cats_core_loans.rb +6 -6
- data/db/migrate/20220626063757_create_cats_core_swaps.rb +12 -12
- data/db/migrate/20220626132050_create_cats_core_round_beneficiaries.rb +12 -12
- data/db/migrate/20220923190857_create_cats_core_application_settings.rb +3 -3
- data/lib/cats/core/engine.rb +1 -3
- data/lib/cats/core/version.rb +1 -1
- data/spec/factories/cats/core/dispatch_authorizations.rb +1 -1
- data/spec/factories/cats/core/dispatch_plan_items.rb +1 -1
- data/spec/factories/cats/core/dispatches.rb +4 -4
- data/spec/factories/cats/core/round_plan_item_details.rb +1 -1
- metadata +41 -13
@@ -3,13 +3,13 @@ class CreateCatsCoreTransportContracts < ActiveRecord::Migration[6.1]
|
|
3
3
|
create_table :cats_core_transport_contracts do |t|
|
4
4
|
t.string :contract_no, unique: true
|
5
5
|
t.references :transporter,
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
null: false,
|
7
|
+
index: {name: "transporter_on_tc_indx"},
|
8
|
+
foreign_key: {to_table: :cats_core_transporters}
|
9
9
|
t.references :transport_bid,
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
null: false,
|
11
|
+
index: {name: "tb_on_tc_indx"},
|
12
|
+
foreign_key: {to_table: :cats_core_transport_bids}
|
13
13
|
t.date :contract_date, null: false
|
14
14
|
t.date :expires_on, null: false
|
15
15
|
t.string :payment_term
|
@@ -2,18 +2,18 @@ class CreateCatsCoreContractItems < ActiveRecord::Migration[6.1]
|
|
2
2
|
def change
|
3
3
|
create_table :cats_core_contract_items do |t|
|
4
4
|
t.references :transport_contract,
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
null: false,
|
6
|
+
index: {name: "tc_on_ci_indx"},
|
7
|
+
foreign_key: {to_table: :cats_core_transport_contracts}
|
8
8
|
t.references :route,
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
null: false,
|
10
|
+
index: {name: "route_on_ci_indx"},
|
11
|
+
foreign_key: {to_table: :cats_core_routes}
|
12
12
|
t.float :price, null: false
|
13
13
|
t.references :unit,
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
null: false,
|
15
|
+
index: {name: "unit_on_ci_indx"},
|
16
|
+
foreign_key: {to_table: :cats_core_unit_of_measures}
|
17
17
|
|
18
18
|
t.timestamps
|
19
19
|
end
|
@@ -2,22 +2,22 @@ class CreateCatsCoreCommoditySubstitutions < ActiveRecord::Migration[6.1]
|
|
2
2
|
def change
|
3
3
|
create_table :cats_core_commodity_substitutions do |t|
|
4
4
|
t.references :program,
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
null: false,
|
6
|
+
index: {name: "program_on_cs_indx"},
|
7
|
+
foreign_key: {to_table: :cats_core_programs}
|
8
8
|
t.references :commodity,
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
null: false,
|
10
|
+
index: {name: "commodity_on_cs_indx"},
|
11
|
+
foreign_key: {to_table: :cats_core_commodity_categories}
|
12
12
|
t.references :replaced_by,
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
null: false,
|
14
|
+
index: {name: "rb_on_cs_indx"},
|
15
|
+
foreign_key: {to_table: :cats_core_commodity_categories}
|
16
16
|
t.string :ratio, null: false
|
17
17
|
|
18
18
|
t.timestamps
|
19
19
|
|
20
|
-
t.index [
|
20
|
+
t.index %i[program_id commodity_id replaced_by_id], unique: true, name: "pcr_on_cs_indx"
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -2,13 +2,13 @@ class CreateCatsCoreTenderers < ActiveRecord::Migration[6.1]
|
|
2
2
|
def change
|
3
3
|
create_table :cats_core_tenderers do |t|
|
4
4
|
t.references :transport_bid,
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
null: false,
|
6
|
+
index: {name: "tb_on_tenderer_indx"},
|
7
|
+
foreign_key: {to_table: :cats_core_transport_bids}
|
8
8
|
t.references :transporter,
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
null: false,
|
10
|
+
index: {name: "transporter_on_tenderer_indx"},
|
11
|
+
foreign_key: {to_table: :cats_core_transporters}
|
12
12
|
t.string :purchased_by, null: false
|
13
13
|
t.string :phone_no, null: false
|
14
14
|
|
@@ -5,13 +5,13 @@ class CreateCatsCoreRoundPlans < ActiveRecord::Migration[6.1]
|
|
5
5
|
t.integer :rounds, array: true, default: []
|
6
6
|
t.string :status, null: false, default: "Draft"
|
7
7
|
t.references :plan,
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
null: false,
|
9
|
+
index: {name: "plan_on_mp_indx"},
|
10
|
+
foreign_key: {to_table: :cats_core_plans}
|
11
11
|
t.references :region,
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
null: false,
|
13
|
+
index: {name: "region_on_mp_indx"},
|
14
|
+
foreign_key: {to_table: :cats_core_locations}
|
15
15
|
|
16
16
|
t.timestamps
|
17
17
|
end
|
@@ -2,22 +2,22 @@ class CreateCatsCoreRoundRations < ActiveRecord::Migration[6.1]
|
|
2
2
|
def change
|
3
3
|
create_table :cats_core_round_rations do |t|
|
4
4
|
t.references :beneficiary_category,
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
null: false,
|
6
|
+
index: {name: "bc_on_rr_indx"},
|
7
|
+
foreign_key: {to_table: :cats_core_beneficiary_categories}
|
8
8
|
t.references :commodity_category,
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
null: false,
|
10
|
+
index: {name: "cc_on_rr_indx"},
|
11
|
+
foreign_key: {to_table: :cats_core_commodity_categories}
|
12
12
|
t.float :quantity, null: false
|
13
13
|
t.references :unit_of_measure,
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
null: false,
|
15
|
+
index: {name: "uom_on_rr_indx"},
|
16
|
+
foreign_key: {to_table: :cats_core_unit_of_measures}
|
17
17
|
t.references :round_plan,
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
null: false,
|
19
|
+
index: {name: "rp_on_rr_indx"},
|
20
|
+
foreign_key: {to_table: :cats_core_round_plans}
|
21
21
|
t.integer :no_of_days, null: false
|
22
22
|
|
23
23
|
t.timestamps
|
@@ -2,29 +2,29 @@ class CreateCatsCoreRoundPlanItems < ActiveRecord::Migration[6.1]
|
|
2
2
|
def change
|
3
3
|
create_table :cats_core_round_plan_items do |t|
|
4
4
|
t.references :round_plan,
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
null: false,
|
6
|
+
index: {name: "mp_on_mpi_indx"},
|
7
|
+
foreign_key: {to_table: :cats_core_round_plans, on_delete: :cascade}
|
8
8
|
t.references :region,
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
null: false,
|
10
|
+
index: {name: "region_on_round_plan_items_indx"},
|
11
|
+
foreign_key: {to_table: :cats_core_locations}
|
12
12
|
t.references :zone,
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
null: false,
|
14
|
+
index: {name: "zone_on_round_plan_items_indx"},
|
15
|
+
foreign_key: {to_table: :cats_core_locations}
|
16
16
|
t.references :woreda,
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
null: false,
|
18
|
+
index: {name: "woreda_on_round_plan_items_idnx"},
|
19
|
+
foreign_key: {to_table: :cats_core_locations}
|
20
20
|
t.references :fdp,
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
null: false,
|
22
|
+
index: {name: "fdp_on_round_plan_items_indx"},
|
23
|
+
foreign_key: {to_table: :cats_core_locations}
|
24
24
|
t.references :operator,
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
null: false,
|
26
|
+
index: {name: "operator_on_rpi_indx"},
|
27
|
+
foreign_key: {to_table: :cats_core_operators}
|
28
28
|
t.integer :plan_item_id, null: false
|
29
29
|
|
30
30
|
t.timestamps
|
@@ -2,13 +2,13 @@ class CreateCatsCoreBeneficiaryRoundPlanItems < ActiveRecord::Migration[7.0]
|
|
2
2
|
def change
|
3
3
|
create_table :cats_core_beneficiary_round_plan_items do |t|
|
4
4
|
t.references :round_plan_item,
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
null: false,
|
6
|
+
index: {name: "rpi_on_brpi_indx"},
|
7
|
+
foreign_key: {to_table: :cats_core_round_plan_items}
|
8
8
|
t.references :beneficiary_category,
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
null: false,
|
10
|
+
index: {name: "bc_on_brpi_indx"},
|
11
|
+
foreign_key: {to_table: :cats_core_beneficiary_categories}
|
12
12
|
t.integer :planned_beneficiaries, null: false
|
13
13
|
t.integer :beneficiaries, null: false
|
14
14
|
t.integer :beneficiary_plan_item_id, null: false
|
@@ -17,7 +17,7 @@ class CreateCatsCoreBeneficiaryRoundPlanItems < ActiveRecord::Migration[7.0]
|
|
17
17
|
end
|
18
18
|
add_index(
|
19
19
|
:cats_core_beneficiary_round_plan_items,
|
20
|
-
[
|
20
|
+
%i[round_plan_item_id beneficiary_category_id],
|
21
21
|
unique: true,
|
22
22
|
name: "rpii_on_bci_uniq_indx"
|
23
23
|
)
|
@@ -2,18 +2,18 @@ class CreateCatsCoreRoundPlanItemDetails < ActiveRecord::Migration[6.1]
|
|
2
2
|
def change
|
3
3
|
create_table :cats_core_round_plan_item_details do |t|
|
4
4
|
t.references :beneficiary_round_plan_item,
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
null: false,
|
6
|
+
index: {name: "brpi_on_rpid_indx"},
|
7
|
+
foreign_key: {to_table: :cats_core_beneficiary_round_plan_items}
|
8
8
|
t.references :round_ration,
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
null: false,
|
10
|
+
index: {name: "rr_on_rpid_indx"},
|
11
|
+
foreign_key: {to_table: :cats_core_round_rations}
|
12
12
|
t.float :quantity, null: false
|
13
13
|
t.references :unit,
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
null: false,
|
15
|
+
index: {name: "unit_on_rpid_indx"},
|
16
|
+
foreign_key: {to_table: :cats_core_unit_of_measures}
|
17
17
|
|
18
18
|
t.timestamps
|
19
19
|
end
|
@@ -2,23 +2,23 @@ class CreateCatsCoreHubAuthorizations < ActiveRecord::Migration[7.0]
|
|
2
2
|
def change
|
3
3
|
create_table :cats_core_hub_authorizations do |t|
|
4
4
|
t.references :dispatch_plan_item,
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
null: true,
|
6
|
+
index: {name: "dpi_on_ha_indx"},
|
7
|
+
foreign_key: {to_table: :cats_core_dispatch_plan_items}
|
8
8
|
t.references :store,
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
null: false,
|
10
|
+
index: {name: "store_on_ha_indx"},
|
11
|
+
foreign_key: {to_table: :cats_core_stores}
|
12
12
|
t.float :quantity, null: false
|
13
13
|
t.references :unit,
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
null: false,
|
15
|
+
index: {name: "unit_on_ha_indx"},
|
16
|
+
foreign_key: {to_table: :cats_core_unit_of_measures}
|
17
17
|
t.string :authorization_type, null: false
|
18
18
|
t.references :authorized_by,
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
null: false,
|
20
|
+
index: {name: "ab_on_ha_indx"},
|
21
|
+
foreign_key: {to_table: :cats_core_users}
|
22
22
|
|
23
23
|
t.timestamps
|
24
24
|
end
|
@@ -2,18 +2,18 @@ class CreateCatsCoreUnitConversions < ActiveRecord::Migration[7.0]
|
|
2
2
|
def change
|
3
3
|
create_table :cats_core_unit_conversions do |t|
|
4
4
|
t.references :from,
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
null: false,
|
6
|
+
index: {name: "from_on_uc_indx"},
|
7
|
+
foreign_key: {to_table: :cats_core_unit_of_measures}
|
8
8
|
t.references :to,
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
null: false,
|
10
|
+
index: {name: "to_on_uc_indx"},
|
11
|
+
foreign_key: {to_table: :cats_core_unit_of_measures}
|
12
12
|
t.float :factor, null: false
|
13
13
|
|
14
14
|
t.timestamps
|
15
15
|
end
|
16
16
|
|
17
|
-
add_index(:cats_core_unit_conversions, [
|
17
|
+
add_index(:cats_core_unit_conversions, %i[from_id to_id], unique: true)
|
18
18
|
end
|
19
19
|
end
|
@@ -2,23 +2,23 @@ class CreateCatsCoreTransportRequisitions < ActiveRecord::Migration[7.0]
|
|
2
2
|
def change
|
3
3
|
create_table :cats_core_transport_requisitions do |t|
|
4
4
|
t.references :dispatch_plan,
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
null: false,
|
6
|
+
index: {name: "dp_on_tr_indx"},
|
7
|
+
foreign_key: {to_table: :cats_core_dispatch_plans}
|
8
8
|
t.string :reference_no, null: false, unique: true
|
9
9
|
t.references :requested_by,
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
null: false,
|
11
|
+
index: {name: "rb_on_tr_indx"},
|
12
|
+
foreign_key: {to_table: :cats_core_users}
|
13
13
|
t.references :approved_by,
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
null: true,
|
15
|
+
index: {name: "ab_on_tr_indx"},
|
16
|
+
foreign_key: {to_table: :cats_core_users}
|
17
17
|
t.string :status, null: false
|
18
18
|
t.references :unit,
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
null: false,
|
20
|
+
index: {name: "unit_on_tr_indx"},
|
21
|
+
foreign_key: {to_table: :cats_core_unit_of_measures}
|
22
22
|
|
23
23
|
t.timestamps
|
24
24
|
end
|
@@ -2,18 +2,18 @@ class CreateCatsCoreTransportRequisitionItems < ActiveRecord::Migration[7.0]
|
|
2
2
|
def change
|
3
3
|
create_table :cats_core_transport_requisition_items do |t|
|
4
4
|
t.references :transport_requisition,
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
null: false,
|
6
|
+
index: {name: "tr_on_tri_indx"},
|
7
|
+
foreign_key: {to_table: :cats_core_transport_requisitions}
|
8
8
|
t.references :dispatch_plan_item,
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
null: false,
|
10
|
+
index: {name: "dpi_on_tri_indx"},
|
11
|
+
foreign_key: {to_table: :cats_core_dispatch_plan_items}
|
12
12
|
t.float :quantity, null: false
|
13
13
|
t.references :unit,
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
null: false,
|
15
|
+
index: {name: "unit_on_tri_indx"},
|
16
|
+
foreign_key: {to_table: :cats_core_unit_of_measures}
|
17
17
|
|
18
18
|
t.timestamps
|
19
19
|
end
|
@@ -2,14 +2,14 @@ class CreateCatsCoreTransportRequisitionDetails < ActiveRecord::Migration[7.0]
|
|
2
2
|
def change
|
3
3
|
create_table :cats_core_transport_requisition_details do |t|
|
4
4
|
t.references :transport_requisition_item,
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
null: false,
|
6
|
+
index: {name: "tri_on_trd_indx"},
|
7
|
+
foreign_key: {to_table: :cats_core_transport_requisition_items}
|
8
8
|
t.float :quantity, null: false
|
9
9
|
t.references :fdp,
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
null: false,
|
11
|
+
index: {name: "fdp_on_tri_indx"},
|
12
|
+
foreign_key: {to_table: :cats_core_locations}
|
13
13
|
|
14
14
|
t.timestamps
|
15
15
|
end
|
@@ -2,17 +2,17 @@ class CreateCatsCoreTransportOrders < ActiveRecord::Migration[7.0]
|
|
2
2
|
def change
|
3
3
|
create_table :cats_core_transport_orders do |t|
|
4
4
|
t.references :transport_requisition,
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
null: false,
|
6
|
+
index: {name: "tr_on_to_indx"},
|
7
|
+
foreign_key: {to_table: :cats_core_transport_requisitions}
|
8
8
|
t.references :prepared_by,
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
null: false,
|
10
|
+
index: {name: "pb_on_to_indx"},
|
11
|
+
foreign_key: {to_table: :cats_core_users}
|
12
12
|
t.references :approved_by,
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
null: true,
|
14
|
+
index: {name: "ab_on_to_indx"},
|
15
|
+
foreign_key: {to_table: :cats_core_users}
|
16
16
|
t.date :order_date, null: false
|
17
17
|
t.string :status, null: false, default: "Draft"
|
18
18
|
|
@@ -2,21 +2,21 @@ class CreateCatsCoreTransportOrderItems < ActiveRecord::Migration[7.0]
|
|
2
2
|
def change
|
3
3
|
create_table :cats_core_transport_order_items do |t|
|
4
4
|
t.references :transport_order,
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
null: false,
|
6
|
+
index: {name: "to_on_toi_indx"},
|
7
|
+
foreign_key: {to_table: :cats_core_transport_orders}
|
8
8
|
t.references :transporter,
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
null: false,
|
10
|
+
index: {name: "transporter_on_toi_indx"},
|
11
|
+
foreign_key: {to_table: :cats_core_transporters}
|
12
12
|
t.references :transport_contract,
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
null: true,
|
14
|
+
index: {name: "tc_on_toi_indx"},
|
15
|
+
foreign_key: {to_table: :cats_core_transport_contracts}
|
16
16
|
t.references :transport_requisition_item,
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
null: false,
|
18
|
+
index: {name: "tri_on_toi_indx"},
|
19
|
+
foreign_key: {to_table: :cats_core_transport_requisition_items}
|
20
20
|
t.integer :valid_for, null: false, default: 10
|
21
21
|
|
22
22
|
t.timestamps
|
@@ -6,13 +6,13 @@ class CreateCatsCoreBeneficiaries < ActiveRecord::Migration[7.0]
|
|
6
6
|
t.string :gender, null: false
|
7
7
|
t.string :phone
|
8
8
|
t.references :beneficiary_category,
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
null: false,
|
10
|
+
index: {name: "bc_on_beneficiaries_indx"},
|
11
|
+
foreign_key: {to_table: :cats_core_beneficiary_categories}
|
12
12
|
t.references :fdp,
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
null: false,
|
14
|
+
index: {name: "fdp_on_beneficiaries_indx"},
|
15
|
+
foreign_key: {to_table: :cats_core_locations}
|
16
16
|
|
17
17
|
t.timestamps
|
18
18
|
end
|
@@ -7,14 +7,14 @@ class CreateCatsCoreLoans < ActiveRecord::Migration[7.0]
|
|
7
7
|
t.date :agreement_date, null: false
|
8
8
|
t.date :repayment_date
|
9
9
|
t.references :commodity_category,
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
null: false,
|
11
|
+
index: {name: "cc_on_loan_indx"},
|
12
|
+
foreign_key: {to_table: :cats_core_commodity_categories}
|
13
13
|
t.float :quantity, null: false
|
14
14
|
t.references :unit,
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
null: false,
|
16
|
+
index: {name: "unit_on_loan_indx"},
|
17
|
+
foreign_key: {to_table: :cats_core_unit_of_measures}
|
18
18
|
|
19
19
|
t.timestamps
|
20
20
|
end
|
@@ -8,21 +8,21 @@ class CreateCatsCoreSwaps < ActiveRecord::Migration[7.0]
|
|
8
8
|
t.float :issued_quantity, null: false
|
9
9
|
t.float :received_quantity, null: false
|
10
10
|
t.references :issued_commodity,
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
null: false,
|
12
|
+
index: {name: "ic_on_swap_indx"},
|
13
|
+
foreign_key: {to_table: :cats_core_commodity_categories}
|
14
14
|
t.references :received_commodity,
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
null: false,
|
16
|
+
index: {name: "rc_on_swap_indx"},
|
17
|
+
foreign_key: {to_table: :cats_core_commodity_categories}
|
18
18
|
t.references :issued_unit,
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
null: false,
|
20
|
+
index: {name: "iu_on_swap_indx"},
|
21
|
+
foreign_key: {to_table: :cats_core_unit_of_measures}
|
22
22
|
t.references :received_unit,
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
null: false,
|
24
|
+
index: {name: "ru_on_swap_indx"},
|
25
|
+
foreign_key: {to_table: :cats_core_unit_of_measures}
|
26
26
|
|
27
27
|
t.timestamps
|
28
28
|
end
|
@@ -2,22 +2,22 @@ class CreateCatsCoreRoundBeneficiaries < ActiveRecord::Migration[7.0]
|
|
2
2
|
def change
|
3
3
|
create_table :cats_core_round_beneficiaries do |t|
|
4
4
|
t.references :beneficiary,
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
null: false,
|
6
|
+
index: {name: "beneficiary_on_rb_indx"},
|
7
|
+
foreign_key: {to_table: :cats_core_beneficiaries}
|
8
8
|
t.references :round_plan_item,
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
null: false,
|
10
|
+
index: {name: "rpi_on_rb_indx"},
|
11
|
+
foreign_key: {to_table: :cats_core_round_plan_items}
|
12
12
|
t.references :commodity_category,
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
null: false,
|
14
|
+
index: {name: "cc_on_rb_indx"},
|
15
|
+
foreign_key: {to_table: :cats_core_commodity_categories}
|
16
16
|
t.float :quantity, null: false
|
17
17
|
t.references :unit,
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
null: false,
|
19
|
+
index: {name: "unit_on_rb_indx"},
|
20
|
+
foreign_key: {to_table: :cats_core_unit_of_measures}
|
21
21
|
t.boolean :received, null: false, default: false
|
22
22
|
|
23
23
|
t.timestamps
|
@@ -4,9 +4,9 @@ class CreateCatsCoreApplicationSettings < ActiveRecord::Migration[7.0]
|
|
4
4
|
t.string :key, unique: true
|
5
5
|
t.string :value, null: false
|
6
6
|
t.references :application_module,
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
null: false,
|
8
|
+
index: {name: "am_on_as_indx"},
|
9
|
+
foreign_key: {to_table: :cats_core_application_modules}
|
10
10
|
|
11
11
|
t.timestamps
|
12
12
|
end
|
data/lib/cats/core/engine.rb
CHANGED
@@ -15,9 +15,7 @@ module Cats
|
|
15
15
|
end
|
16
16
|
|
17
17
|
initializer :append_migrations do |app|
|
18
|
-
unless app.root.to_s.match(root.to_s + File::SEPARATOR)
|
19
|
-
app.config.paths["db/migrate"].concat(config.paths["db/migrate"].expanded)
|
20
|
-
end
|
18
|
+
app.config.paths["db/migrate"].concat(config.paths["db/migrate"].expanded) unless app.root.to_s.match(root.to_s + File::SEPARATOR)
|
21
19
|
end
|
22
20
|
end
|
23
21
|
end
|
data/lib/cats/core/version.rb
CHANGED