From 4b0658a6851514cc9fcac2fce9c6f320154f1d56 Mon Sep 17 00:00:00 2001 From: Michael Vorburger Date: Mon, 22 Sep 2014 04:04:15 +0200 Subject: [PATCH] MIFOSX-1552 Spring Boot + MariaDB4j, read http://blog2.vorburger.ch/2014/09/mifos-executable-war-with-mariadb4j.html Signed-off-by: Michael Vorburger --- ...on_names_for_maker_checker_permissions.sql | 3 - mifosng-provider/build.gradle | 106 ++-- .../integrationtests/common/Utils.java | 7 +- .../org/mifosplatform/ServerApplication.java | 43 ++ .../ServerWithMariaDB4jApplication.java | 39 ++ .../AbstractApplicationConfiguration.java | 37 ++ .../core/boot/ApplicationExitUtil.java | 33 ++ .../EmbeddedTomcatWithSSLConfiguration.java | 104 ++++ .../boot/WarWebApplicationInitializer.java | 40 ++ .../core/boot/WebXmlConfiguration.java | 50 ++ .../core/boot/db/DataSourceConfiguration.java | 41 ++ .../core/boot/db/DataSourceProperties.java | 146 +++++ .../db/MariaDB4jDataSourceConfiguration.java | 49 ++ .../core/boot/db/MariaDB4jSetupService.java | 41 ++ .../db/TenantDataSourcePortFixService.java | 83 +++ ...onedConnectionCleanupShutdownListener.java | 10 +- .../service/TenantDatabaseUpgradeService.java | 39 +- .../TomcatJdbcDataSourcePerTenantService.java | 2 + .../jobs/annotation/CronMethodParser.java | 3 +- .../jobs/service/JobRegisterServiceImpl.java | 12 +- .../security/data/PlatformRequestLog.java | 8 +- .../resources/META-INF/spring/appContext.xml | 12 +- .../src/main/resources/keystore.jks | Bin .../V100__Group_saving_summary_report.sql | 0 ...mulitplesof_to_account_transfers_table.sql | 2 +- .../V102__client_attendance_tables.sql | 0 .../V103__cluster_support_for_batch_jobs.sql | 2 +- .../V104__permissions_for_transfers.sql | 8 +- ..._track_loan_transaction_against_office.sql | 0 .../V106__more_permissions_for_transfers.sql | 16 +- .../core_db/V107__datatable_code_mappings.sql | 0 .../V108__client_has_transfer_office.sql | 0 ..._transfer_withdrawal_fee_configuration.sql | 4 +- ...0__interest-posting-fields-for-savings.sql | 8 +- .../core_db/V110__group_center_close.sql | 0 ...nse_account_for_existing_loan_products.sql | 0 ...int_approach_for_datatables_by_default.sql | 0 .../core_db/V112__mixreport_sql_support.sql | 4 +- ...ack_savings_transaction_against_office.sql | 0 ...t_for_existing_savings_products - Copy.sql | 0 .../V115__permissions_for_cache_api.sql | 4 +- ...16__track_currency_for_journal_entries.sql | 0 .../V117__loan_charge_from_savings.sql | 9 +- .../V118_1__savings_charge_patch_update.sql | 0 ...licate_fund_source_to_account_mappings.sql | 2 +- ...rm_propose_and_accept_client_transfers.sql | 5 +- ..._account_for_existing_savings_products.sql | 0 ...batch_job_entry_for_pay_savings_charge.sql | 0 ...ome_from_penalties_for savings_product.sql | 0 ..._move_withdrawal_annual_fee_to_charges.sql | 168 +++--- ...yments_seperately_in_loan_transactions.sql | 2 +- .../core_db/V118__savings_charge.sql | 0 .../core_db/V119__add_template_table.sql | 4 +- .../core_db/V11__add-payment-details.sql | 3 - .../V120__accounting_running_balance.sql | 2 +- ...nting_running_balance_for_organization.sql | 2 +- ...122__recurring_fee_support_for_savings.sql | 0 .../V123__remove_payment_mode_for_savings.sql | 0 .../V124__added_min_max_cap_for_charges.sql | 15 +- ...mn_for_actual_fee_amount_or_percentage.sql | 0 ...al_database_structure_for_sms_outbound.sql | 14 +- .../core_db/V127__mobile_no_fields.sql | 8 +- .../V128__added_loan_installment_charge.sql | 0 .../V129__client_and_group_timeline.sql | 0 ...2__add_external_id_to_couple_of_tables.sql | 22 +- .../core_db/V130__calendar-history-table.sql | 0 ..._holiday-status-column-and-permissions.sql | 2 +- .../core_db/V132__borrower_cycle_changes.sql | 0 ...ding_payment_detail_with_journal_entry.sql | 3 +- ...1__submitted_date_updation_for_clients.sql | 1 - ...134_2__permissions_spelling_correction.sql | 0 ..._added_column_value_on_c_configuration.sql | 26 +- ..._added_permission_for_undo_written_off.sql | 0 ...136_1__update_script_strechy_parameter.sql | 0 ...137__added_is_active_column_in_m_staff.sql | 0 ...r_m_product_loan_and_m_savings_product.sql | 2 +- ...r_is_active_updated_to_true_in_m_staff.sql | 2 +- ...group_and_client_pending_configuration.sql | 20 +- ...yment_detail_id_in_ac_gl_journal_entry.sql | 0 .../V140__added_loan_charge_status.sql | 0 .../V141__add_early_repayment_strategy.sql | 0 ..._read_savingsaccount_charge_permission.sql | 0 ...create_journalentry_checker_permission.sql | 0 .../V144__spelling_mistake_corrections.sql | 0 ...orce_password_reset_in_c_configuration.sql | 0 .../core_db/V146__tranche_loans.sql | 4 +- ...147__tranche_loans_column_name_changes.sql | 0 .../core_db/V148__overdraft_changes.sql | 12 +- ...__add_created_date_savings_transaction.sql | 4 +- .../core_db/V14__rename_status_id_to_enum.sql | 0 .../core_db/V150__basic_savings_report.sql | 2 - ..._add_default_savings_account_to_client.sql | 0 .../V152__added_grace_for_over_due.sql | 0 .../V153__Insert_missed_permissions.sql | 0 .../core_db/V154__aging_details.sql | 0 .../core_db/V155__stretchy_into_pentaho.sql | 517 +++++++++--------- .../V156__added_loan_saving_txns_pentaho.sql | 0 .../V157__overdue_charge_improvements.sql | 2 +- ...V158__dashboard_and_navigation_queries.sql | 0 ...n_id_column_m_portfolio_command_source.sql | 0 .../core_db/V15__center_permissions.sql | 0 ..._nullValue_For_principal_on_lonProduct.sql | 0 .../V160__standing_instruction_changes.sql | 3 +- .../core_db/V161__added_accrual_batch_job.sql | 2 +- .../V162__overdue_charge_batch_job.sql | 0 .../core_db/V163__added_npa_for_loans.sql | 4 +- .../V164__fd_and_rd_deposit_tables.sql | 0 ...mission_for_disburse_to_saving_account.sql | 0 ..._amount_to_product_term_and_preclosure.sql | 6 +- ...columns_for_writtenOff_loans_recovered.sql | 3 +- ...xed_deposit_interest_to_linked_account.sql | 2 +- ...ts_to_core_reports_use_report_to_false.sql | 0 ...V16__drop_min_max_column_on_loan_table.sql | 0 ..._deposit_accounts_maturity_details_job.sql | 0 ...added_mandatory_savings_and_rd_changes.sql | 2 +- ...V172__accounting_changes_for_transfers.sql | 0 .../sql}/migrations/core_db/V173__ppi.sql | 2 +- .../core_db/V174__remove_interest_accrual.sql | 2 - .../V175__added_incentive_interest_rates.sql | 8 +- ...updates_to_financial_activity_accounts.sql | 2 +- .../V177__cleanup_for_client_incentives.sql | 0 ...tes_to_financial_activity_accounts_pt2.sql | 4 +- ...on_names_for_maker_checker_permissions.sql | 3 + .../V17__update_stretchy_reporting_ddl.sql | 10 +- ...waitingdisbursal_and_groupnamesbystaff.sql | 0 .../V181__standing_instruction_logging.sql | 0 ...in_required_balance_to_savings_product.sql | 0 ...d_min_balance_for_interest_calculation.sql | 3 +- ...n_required_balance_for_savings_product.sql | 3 - ...accrual_till_date_for_periodic_accrual.sql | 0 .../V186__added_periodic_accrual_job.sql | 0 ...__added_permission_to_periodic_accrual.sql | 0 ...d_savingscharge_inactivate_permissions.sql | 0 ...__m_loan_interest_recalculation_tables.sql | 0 ...8__update_stretchy_reporting_reportSql.sql | 3 +- ...ategroup_disassociategroup_permissions.sql | 0 ...e_gl_account_increase_size_of_name_col.sql | 0 .../V192__interest_recalculate_job.sql | 0 ...93__added_column_joiningDate_for_staff.sql | 0 ...stComponent_for_interest_recalculation.sql | 0 ..._moved_rest_frequency_to_product_level.sql | 4 +- ...d_loan_running_balance_to_transactions.sql | 0 ...d_loan_running_balance_of_transactions.sql | 1 - ...an_rescheduling_tables_and_permissions.sql | 0 ...ed_extra_columns_from_schedule_history.sql | 0 .../V19__report_maintenance_permissions.sql | 15 +- .../V1__mifosplatform-core-ddl-latest.sql | 0 ...nt_for_start_interest_calculation_date.sql | 0 .../migrations/core_db/V201__webhooks.sql | 0 ...eport_maint_perms_really_configuration.sql | 0 ...21__activation-permissions-for-clients.sql | 6 +- ...-group-for-consistency-add-permissions.sql | 6 +- ...-configuration-for-client-group-status.sql | 0 ...t-foreign-key-constraint-in-loan-table.sql | 0 ...ports_for_status_and_activation_change.sql | 46 +- ...support-for-withdrawal-fees-on-savings.sql | 6 +- ...27__add-loan-type-column-to-loan-table.sql | 0 ...ccounting-abstractions-and-autoposting.sql | 1 - ...add-support-for-annual-fees-on-savings.sql | 4 +- .../V2__mifosx-base-reference-data-utf8.sql | 74 +-- ...eferenceNumber-to-acc_gl_journal_entry.sql | 2 +- .../core_db/V31__drop-autopostings.sql | 2 - ...sociate-clients-from-group-permissions.sql | 0 ...que_check_on_stretchy_report_parameter.sql | 0 ...que_check_on_stretchy_report_parameter.sql | 5 +- ...dd_hierarchy_column_for_acc_gl_account.sql | 0 ...__add_tag_id_column_for_acc_gl_account.sql | 0 ...ter-group-collection-sheet-permissions.sql | 0 .../V38__add-group-summary-details-report.sql | 23 +- .../core_db/V39__payment-channels-updates.sql | 2 +- ...osx-permissions-and-authorisation-utf8.sql | 16 +- ...0__add_permissions_for_accounting_rule.sql | 0 .../core_db/V41__group-summary-reports.sql | 25 +- ...t_value_for_id_for_acc_accounting_rule.sql | 0 .../core_db/V43__accounting-for-savings.sql | 1 - ..._document-increase-size-of-column-type.sql | 0 .../V45__create_acc_rule_tags_table.sql | 0 .../core_db/V46__extend_datatables_api.sql | 1 - .../V47__staff-hierarchy-link-to-users.sql | 4 +- .../core_db/V48__adding-S3-Support.sql | 15 +- ...track-loan-charge-payment-transactions.sql | 1 - .../core_db/V4__mifosx-core-reports-utf8.sql | 1 - ...50__add-grace-settings-to-loan-product.sql | 4 +- ...ils-related-to-installment-performance.sql | 4 +- ...an_support_cols_to_acc_accounting_rule.sql | 4 +- ...vance-and-late-payments-on-installment.sql | 0 ...V54__charge-to-income-account-mappings.sql | 0 ...onal-transaction-processing-strategies.sql | 12 +- .../V56__track-overpaid-amount-on-loans.sql | 2 +- ...nd_credit_accounts_acc_accounting_rule.sql | 0 .../V58__create-holiday-tables_changed.sql | 0 ...add_group_roles_schema_and_permissions.sql | 0 ...ate-savings-product-and-account-tables.sql | 12 +- .../core_db/V60__quipo_dashboard_reports.sql | 76 ++- .../V61__txn_running_balance_example.sql | 54 +- .../V62__add_staff_id_to_m_client_changed.sql | 0 ...sbursement_with_meeting_column_to_loan.sql | 0 .../V64__add_permission_for_assign_staff.sql | 0 .../core_db/V65__fix_rupee_symbol_issues.sql | 0 .../V66__client_close_functionality.sql | 1 - .../core_db/V67__loans_in_advance_table.sql | 2 - .../V68__quipo_dashboard_reports_updated.sql | 86 ++- .../V69__loans_in_advance_initialise.sql | 10 +- ...__add_min_max_principal_column_to_loan.sql | 4 +- .../V70__quipo_program_detail_query_fix.sql | 12 +- ..._reschedule_repayment_to_configuration.sql | 0 .../V72__add_m_loan_counter_changes.sql | 4 +- ...led_to_and_processed_column_to_holiday.sql | 0 ...__alter_m_loan_counter_table_add_group.sql | 0 ...epayments-on-holidays_to_configuration.sql | 0 .../V76__rename_permission_grouping.sql | 0 .../V77__alter_m_product_loan_changes.sql | 0 .../V78__breakdown_portfolio_grouping.sql | 0 .../core_db/V79__schedule_jobs_tables.sql | 4 - ...7__remove_read_makerchecker_permission.sql | 7 +- .../V80__schedule_jobs_tables_updates.sql | 0 .../core_db/V81__savings_related_changes.sql | 14 +- ...jobs_tables_updates_for_running_status.sql | 2 +- .../core_db/V83__non-working-days-table.sql | 0 ...4__undo_savings_transaction_permission.sql | 0 .../V85__product_mix_related_changes.sql | 0 .../core_db/V86__update-working-days.sql | 0 .../V87__add_permission_for_scheduler.sql | 0 ...ed_update_constrain_for_scheduler_jobs.sql | 0 .../core_db/V89__added_scheduler_group.sql | 0 ...-transaction-permissions-if-they-exist.sql | 1 - ...90__client_performance_history_reports.sql | 0 ...ettings_for_holiday_and_non_workingday.sql | 0 .../V91__apply_annual_fees_permission.sql | 0 ...__group_center_assign_staff_permission.sql | 0 .../V93__loan_transaction_external_id.sql | 4 +- .../V94__added_savings_accont type.sql | 0 .../core_db/V95__batch_job_postInterest.sql | 0 .../V96__savings_accounts_transfers_table.sql | 0 ...mission_for_adjust_savings_transaction.sql | 0 ..._added_currency_roundof_for_multipleof.sql | 6 +- ..._constraint_column_to_loan_loanproduct.sql | 10 +- .../V1__mifos-platform-shared-tenants.sql | 0 .../V2__externalize-connection-properties.sql | 26 +- .../sample_data/load_sample_data.sql | 0 .../src/main/webapp/WEB-INF/web.xml | 59 +- .../common/RestAssuredFixture.java | 56 ++ .../java/org/mifosplatform/common/Utils.java | 68 ++- .../spring/SpringConfigurationTest.java | 7 + ...WithoutDatabaseAndNoJobsConfiguration.java | 14 +- ...pringBootWithMariaDB4jIntegrationTest.java | 25 + ...mbeddedTomcatWithSSLConfigurationTest.java | 43 ++ .../boot/tests/SpringBootServerLoginTest.java | 34 ++ 248 files changed, 1830 insertions(+), 969 deletions(-) delete mode 100644 mifosng-db/migrations/core_db/V179__updates_to_action_names_for_maker_checker_permissions.sql create mode 100644 mifosng-provider/src/main/java/org/mifosplatform/ServerApplication.java create mode 100644 mifosng-provider/src/main/java/org/mifosplatform/ServerWithMariaDB4jApplication.java create mode 100644 mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/AbstractApplicationConfiguration.java create mode 100644 mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/ApplicationExitUtil.java create mode 100644 mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/EmbeddedTomcatWithSSLConfiguration.java create mode 100644 mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/WarWebApplicationInitializer.java create mode 100644 mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/WebXmlConfiguration.java create mode 100644 mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/db/DataSourceConfiguration.java create mode 100644 mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/db/DataSourceProperties.java create mode 100644 mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/db/MariaDB4jDataSourceConfiguration.java create mode 100644 mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/db/MariaDB4jSetupService.java create mode 100644 mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/db/TenantDataSourcePortFixService.java rename keystore.jks => mifosng-provider/src/main/resources/keystore.jks (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V100__Group_saving_summary_report.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V101__add_mulitplesof_to_account_transfers_table.sql (67%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V102__client_attendance_tables.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V103__cluster_support_for_batch_jobs.sql (99%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V104__permissions_for_transfers.sql (79%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V105__track_loan_transaction_against_office.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V106__more_permissions_for_transfers.sql (83%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V107__datatable_code_mappings.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V108__client_has_transfer_office.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V109__account_transfer_withdrawal_fee_configuration.sql (85%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V10__interest-posting-fields-for-savings.sql (81%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V110__group_center_close.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V111_1__set default_transfers_in_suspense_account_for_existing_loan_products.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V111__disable_constraint_approach_for_datatables_by_default.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V112__mixreport_sql_support.sql (99%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V113__track_savings_transaction_against_office.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V114__set_default_transfers_in_suspense_account_for_existing_savings_products - Copy.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V115__permissions_for_cache_api.sql (88%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V116__track_currency_for_journal_entries.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V117__loan_charge_from_savings.sql (97%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V118_1__savings_charge_patch_update.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V118_2__product_mapping_delete_duplicate_fund_source_to_account_mappings.sql (67%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V118_3__permissions_form_propose_and_accept_client_transfers.sql (84%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V118_4__reset_default_transfers_in_suspense_account_for_existing_savings_products.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V118_5__batch_job_entry_for_pay_savings_charge.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V118_6__defaults_for_income_from_penalties_for savings_product.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V118_7__move_withdrawal_annual_fee_to_charges.sql (62%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V118_8__track_overpayments_seperately_in_loan_transactions.sql (94%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V118__savings_charge.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V119__add_template_table.sql (94%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V11__add-payment-details.sql (99%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V120__accounting_running_balance.sql (99%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V121__accounting_running_balance_for_organization.sql (99%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V122__recurring_fee_support_for_savings.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V123__remove_payment_mode_for_savings.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V124__added_min_max_cap_for_charges.sql (78%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V125__added_column_for_actual_fee_amount_or_percentage.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V126__initial_database_structure_for_sms_outbound.sql (87%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V127__mobile_no_fields.sql (77%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V128__added_loan_installment_charge.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V129__client_and_group_timeline.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V12__add_external_id_to_couple_of_tables.sql (60%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V130__calendar-history-table.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V131__holiday-status-column-and-permissions.sql (97%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V132__borrower_cycle_changes.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V133__adding_payment_detail_with_journal_entry.sql (99%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V134_1__submitted_date_updation_for_clients.sql (99%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V134_2__permissions_spelling_correction.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V134__added_column_value_on_c_configuration.sql (78%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V135__added_permission_for_undo_written_off.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V136_1__update_script_strechy_parameter.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V137__added_is_active_column_in_m_staff.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V138__add_short_name_for_m_product_loan_and_m_savings_product.sql (99%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V139__default_value_for_is_active_updated_to_true_in_m_staff.sql (69%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V13__add_group_and_client_pending_configuration.sql (60%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V140_1__added_payment_detail_id_in_ac_gl_journal_entry.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V140__added_loan_charge_status.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V141__add_early_repayment_strategy.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V142__read_savingsaccount_charge_permission.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V143__create_journalentry_checker_permission.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V144__spelling_mistake_corrections.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V145__add_force_password_reset_in_c_configuration.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V146__tranche_loans.sql (99%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V147__tranche_loans_column_name_changes.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V148__overdraft_changes.sql (85%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V149__add_created_date_savings_transaction.sql (89%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V14__rename_status_id_to_enum.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V150__basic_savings_report.sql (99%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V151__add_default_savings_account_to_client.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V152__added_grace_for_over_due.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V153__Insert_missed_permissions.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V154__aging_details.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V155__stretchy_into_pentaho.sql (92%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V156__added_loan_saving_txns_pentaho.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V157__overdue_charge_improvements.sql (99%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V158__dashboard_and_navigation_queries.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V159__add_transaction_id_column_m_portfolio_command_source.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V15__center_permissions.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V160_2__Allow_nullValue_For_principal_on_lonProduct.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V160__standing_instruction_changes.sql (99%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V161__added_accrual_batch_job.sql (99%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V162__overdue_charge_batch_job.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V163__added_npa_for_loans.sql (99%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V164__fd_and_rd_deposit_tables.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V165__added_permission_for_disburse_to_saving_account.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V166__added_deposit_amount_to_product_term_and_preclosure.sql (83%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V167__added_columns_for_writtenOff_loans_recovered.sql (94%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V168__added_transfer_fixed_deposit_interest_to_linked_account.sql (99%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V169__update_dashboard_reports_to_core_reports_use_report_to_false.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V16__drop_min_max_column_on_loan_table.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V170__update_deposit_accounts_maturity_details_job.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V171__added_mandatory_savings_and_rd_changes.sql (99%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V172__accounting_changes_for_transfers.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V173__ppi.sql (99%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V174__remove_interest_accrual.sql (99%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V175__added_incentive_interest_rates.sql (97%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V176__updates_to_financial_activity_accounts.sql (99%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V177__cleanup_for_client_incentives.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V178__updates_to_financial_activity_accounts_pt2.sql (91%) create mode 100644 mifosng-provider/src/main/resources/sql/migrations/core_db/V179__updates_to_action_names_for_maker_checker_permissions.sql rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V17__update_stretchy_reporting_ddl.sql (95%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V180__update_report_schemas_for_disbursed_vs_awaitingdisbursal_and_groupnamesbystaff.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V181__standing_instruction_logging.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V182__added_min_required_balance_to_savings_product.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V183__added_min_balance_for_interest_calculation.sql (99%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V184__update_min_required_balance_for_savings_product.sql (98%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V185__add_accrual_till_date_for_periodic_accrual.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V186__added_periodic_accrual_job.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V187__added_permission_to_periodic_accrual.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V188__add_savingscharge_inactivate_permissions.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V189__m_loan_interest_recalculation_tables.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V18__update_stretchy_reporting_reportSql.sql (97%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V190__add_associategroup_disassociategroup_permissions.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V191__update_gl_account_increase_size_of_name_col.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V192__interest_recalculate_job.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V193__added_column_joiningDate_for_staff.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V194__added_recalculatedInterestComponent_for_interest_recalculation.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V195__moved_rest_frequency_to_product_level.sql (95%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V196__added_loan_running_balance_to_transactions.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V197__updated_loan_running_balance_of_transactions.sql (99%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V198__loan_rescheduling_tables_and_permissions.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V199__removed_extra_columns_from_schedule_history.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V19__report_maintenance_permissions.sql (77%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V1__mifosplatform-core-ddl-latest.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V200__alter_savings_account_for_start_interest_calculation_date.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V201__webhooks.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V20__report_maint_perms_really_configuration.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V21__activation-permissions-for-clients.sql (86%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V22__alter-group-for-consistency-add-permissions.sql (92%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V23__remove-enable-disable-configuration-for-client-group-status.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V24__add-group-client-foreign-key-constraint-in-loan-table.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V25__update_client_reports_for_status_and_activation_change.sql (86%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V26__add-support-for-withdrawal-fees-on-savings.sql (84%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V27__add-loan-type-column-to-loan-table.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V28__accounting-abstractions-and-autoposting.sql (99%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V29__add-support-for-annual-fees-on-savings.sql (92%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V2__mifosx-base-reference-data-utf8.sql (92%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V30__add-referenceNumber-to-acc_gl_journal_entry.sql (64%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V31__drop-autopostings.sql (91%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V32__associate-disassociate-clients-from-group-permissions.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V33__drop_unique_check_on_stretchy_report_parameter.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V34__add_unique_check_on_stretchy_report_parameter.sql (50%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V35__add_hierarchy_column_for_acc_gl_account.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V36__add_tag_id_column_for_acc_gl_account.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V37__add-center-group-collection-sheet-permissions.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V38__add-group-summary-details-report.sql (84%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V39__payment-channels-updates.sql (92%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V3__mifosx-permissions-and-authorisation-utf8.sql (98%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V40__add_permissions_for_accounting_rule.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V41__group-summary-reports.sql (87%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V42__Add_default_value_for_id_for_acc_accounting_rule.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V43__accounting-for-savings.sql (99%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V44__document-increase-size-of-column-type.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V45__create_acc_rule_tags_table.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V46__extend_datatables_api.sql (99%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V47__staff-hierarchy-link-to-users.sql (90%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V48__adding-S3-Support.sql (92%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V49__track-loan-charge-payment-transactions.sql (99%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V4__mifosx-core-reports-utf8.sql (99%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V50__add-grace-settings-to-loan-product.sql (92%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V51__track-additional-details-related-to-installment-performance.sql (73%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V52__add_boolean_support_cols_to_acc_accounting_rule.sql (81%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V53__track-advance-and-late-payments-on-installment.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V54__charge-to-income-account-mappings.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V55__add-additional-transaction-processing-strategies.sql (65%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V56__track-overpaid-amount-on-loans.sql (82%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V57__add_default_values_to_debit_and_credit_accounts_acc_accounting_rule.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V58__create-holiday-tables_changed.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V59__add_group_roles_schema_and_permissions.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V5__update-savings-product-and-account-tables.sql (59%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V60__quipo_dashboard_reports.sql (92%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V61__txn_running_balance_example.sql (85%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V62__add_staff_id_to_m_client_changed.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V63__add_sync_disbursement_with_meeting_column_to_loan.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V64__add_permission_for_assign_staff.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V65__fix_rupee_symbol_issues.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V66__client_close_functionality.sql (99%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V67__loans_in_advance_table.sql (99%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V68__quipo_dashboard_reports_updated.sql (91%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V69__loans_in_advance_initialise.sql (83%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V6__add_min_max_principal_column_to_loan.sql (93%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V70__quipo_program_detail_query_fix.sql (87%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V71__insert_reschedule_repayment_to_configuration.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V72__add_m_loan_counter_changes.sql (96%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V73__add_repayments_rescheduled_to_and_processed_column_to_holiday.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V74__alter_m_loan_counter_table_add_group.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V75__add_reschedule-repayments-on-holidays_to_configuration.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V76__rename_permission_grouping.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V77__alter_m_product_loan_changes.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V78__breakdown_portfolio_grouping.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V79__schedule_jobs_tables.sql (99%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V7__remove_read_makerchecker_permission.sql (67%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V80__schedule_jobs_tables_updates.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V81__savings_related_changes.sql (93%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V82__schedule_jobs_tables_updates_for_running_status.sql (98%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V83__non-working-days-table.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V84__undo_savings_transaction_permission.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V85__product_mix_related_changes.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V86__update-working-days.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V87__add_permission_for_scheduler.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V88__added_update_constrain_for_scheduler_jobs.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V89__added_scheduler_group.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V8__deposit-transaction-permissions-if-they-exist.sql (98%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V90__client_performance_history_reports.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V91_1__configuration_settings_for_holiday_and_non_workingday.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V91__apply_annual_fees_permission.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V92__group_center_assign_staff_permission.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V93__loan_transaction_external_id.sql (71%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V94__added_savings_accont type.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V95__batch_job_postInterest.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V96__savings_accounts_transfers_table.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V97__add_permission_for_adjust_savings_transaction.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V98__added_currency_roundof_for_multipleof.sql (93%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/core_db/V9__add_min_max_constraint_column_to_loan_loanproduct.sql (96%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/list_db/V1__mifos-platform-shared-tenants.sql (100%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/list_db/V2__externalize-connection-properties.sql (98%) rename {mifosng-db => mifosng-provider/src/main/resources/sql}/migrations/sample_data/load_sample_data.sql (100%) create mode 100644 mifosng-provider/src/test/java/org/mifosplatform/common/RestAssuredFixture.java create mode 100644 mifosng-provider/src/test/java/org/mifosplatform/infrastructure/core/boot/tests/AbstractSpringBootWithMariaDB4jIntegrationTest.java create mode 100644 mifosng-provider/src/test/java/org/mifosplatform/infrastructure/core/boot/tests/EmbeddedTomcatWithSSLConfigurationTest.java create mode 100644 mifosng-provider/src/test/java/org/mifosplatform/infrastructure/core/boot/tests/SpringBootServerLoginTest.java diff --git a/mifosng-db/migrations/core_db/V179__updates_to_action_names_for_maker_checker_permissions.sql b/mifosng-db/migrations/core_db/V179__updates_to_action_names_for_maker_checker_permissions.sql deleted file mode 100644 index 9b295a536..000000000 --- a/mifosng-db/migrations/core_db/V179__updates_to_action_names_for_maker_checker_permissions.sql +++ /dev/null @@ -1,3 +0,0 @@ -UPDATE m_permission -SET action_name = CONCAT(action_name,'_CHECKER') -WHERE code LIKE "%_CHECKER"; \ No newline at end of file diff --git a/mifosng-provider/build.gradle b/mifosng-provider/build.gradle index fa166f6b1..0547c35b4 100644 --- a/mifosng-provider/build.gradle +++ b/mifosng-provider/build.gradle @@ -11,13 +11,15 @@ buildscript { dependencies { classpath 'org.gradle.api.plugins:gradle-tomcat-plugin:1.0', 'nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0', - 'org.zeroturnaround:gradle-jrebel-plugin:1.1.2' + 'org.zeroturnaround:gradle-jrebel-plugin:1.1.2', + 'org.springframework.boot:spring-boot-gradle-plugin:1.1.6.RELEASE' // also change springDataJpaVersion below } } apply plugin: 'rebel' apply plugin: 'license' apply plugin: 'war' +apply plugin: 'spring-boot' apply plugin: 'eclipse' apply plugin: 'idea' apply plugin: 'tomcat' @@ -25,14 +27,13 @@ apply plugin: 'project-report' /* define the valid syntax level for source files */ sourceCompatibility = JavaVersion.VERSION_1_7 -/* define binary compatiblity version */ +/* define binary compatibility version */ targetCompatibility = JavaVersion.VERSION_1_7 -project.ext.springVersion = '4.0.4.RELEASE' -project.ext.springSecurityVersion = '3.2.3.RELEASE' -project.ext.hibernateCoreVersion = '4.1.9.Final' +project.ext.springBootVersion = '1.1.6.RELEASE' +project.ext.springVersion = '4.0.7.RELEASE' project.ext.jerseyVersion = '1.17' -project.ext.springDataJpaVersion = '1.4.1.RELEASE' +project.ext.springDataJpaVersion = '1.7.0.RELEASE' // also change spring-boot-gradle-plugin version above project.ext.mysqlUser='root' project.ext.mysqlPassword='mysql' @@ -43,11 +44,13 @@ group = 'org.mifosplatform' repositories { jcenter() maven { - url "http://repository.pentaho.org/artifactory/pentaho/" + url "http://repository.pentaho.org/artifactory/pentaho/" } + // mavenLocal() // useful for local dev using MariaDB4j SNAPSHOTs (not needed for real-world non-SNAPHOT builds) } configurations { + providedRuntime // needed for Spring Boot executable WAR providedCompile compile runtime @@ -55,32 +58,28 @@ configurations { } dependencies { - def tomcatVersion = '7.0.47' + def tomcatVersion = '7.0.54' tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}", - "org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}" + "org.apache.tomcat.embed:tomcat-embed-logging-log4j:${tomcatVersion}" // NOT tomcat-embed-logging-juli (http://stackoverflow.com/questions/23963049/classcircularityerror-java-util-logging-logrecord-running-gradle-webapp-with-ja) tomcat("org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}") { exclude group: 'org.eclipse.jdt.core.compiler', module: 'ecj' } tomcat "org.apache.tomcat:tomcat-dbcp:${tomcatVersion}" + providedRuntime("org.springframework.boot:spring-boot-starter-tomcat") + providedCompile( - [group: 'javax.servlet', name: 'servlet-api', version: '2.5'], +// [group: 'javax.servlet', name: 'servlet-api', version: '2.5'], ) compile( - [group: 'org.springframework', name: 'spring-core', version: springVersion], - [group: 'org.springframework', name: 'spring-context-support', version: springVersion], - [group: 'org.springframework', name: 'spring-aspects', version: springVersion], - [group: 'org.springframework', name: 'spring-web', version: springVersion], - [group: 'org.springframework', name: 'spring-test', version: springVersion], - [group: 'org.springframework.security', name: 'spring-security-core', version: springSecurityVersion], - [group: 'org.springframework.security', name: 'spring-security-web', version: springSecurityVersion], - [group: 'org.springframework.security', name: 'spring-security-config', version: springSecurityVersion], - [group: 'org.aspectj', name: 'aspectjrt', version: '1.7.0.RELEASE'], + [group: 'ch.vorburger.mariaDB4j', name: 'mariaDB4j', version: '2.1.0'], - [group: 'org.hibernate', name: 'hibernate-core', version: hibernateCoreVersion], - [group: 'org.hibernate', name: 'hibernate-entitymanager', version: hibernateCoreVersion], - [group: 'org.hibernate.javax.persistence', name: 'hibernate-jpa-2.0-api', version: '1.0.1.Final'], + [group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: springBootVersion], + [group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: springBootVersion], + [group: 'org.springframework.boot', name: 'spring-boot-starter-security', version: springBootVersion], + + [group: 'org.springframework', name: 'spring-context-support', version: springVersion], [group: 'javax.ws.rs', name: 'jsr311-api', version: '1.1.1'], [group: 'com.sun.jersey', name: 'jersey-core', version: jerseyVersion], @@ -98,21 +97,15 @@ dependencies { [group: 'com.google.code.gson', name: 'gson', version: '2.2.4'], [group: 'com.google.guava', name: 'guava', version: '15.0'], - [group: 'org.springframework.data', name: 'spring-data-jpa', version: springDataJpaVersion], - - [group: 'joda-time', name: 'joda-time', version: '2.3'], + [group: 'joda-time', name: 'joda-time', version: '2.4'], [group: 'net.sourceforge.javacsv', name: 'javacsv', version: '2.0'], - [group: 'org.apache.commons', name: 'commons-email', version: '1.3.1'], - [group: 'org.apache.commons', name: 'commons-lang3', version: '3.1'], + [group: 'org.apache.commons', name: 'commons-email', version: '1.3.3'], + [group: 'org.apache.commons', name: 'commons-lang3', version: '3.3.2'], - [group: 'org.slf4j', name: 'slf4j-api', version: '1.7.5'], - [group: 'org.slf4j', name: 'jcl-over-slf4j', version: '1.7.5'], - - [group: 'ch.qos.logback', name: 'logback-core', version: '1.0.13'], - [group: 'ch.qos.logback', name: 'logback-classic', version: '1.0.13'], + // no slf4j & logback here (anymore), as spring-boot-starter-logging already brings this now, better assembled (log4j-over-slf4j was originally forgotten here) [group: 'mysql', name: 'mysql-connector-java', version: '5.1.27'], - [group: 'org.apache.tomcat', name: 'tomcat-jdbc', version: '7.0.47'], + [group: 'org.apache.tomcat', name: 'tomcat-jdbc', version: tomcatVersion], [group: 'pentaho-reporting-engine', name: 'pentaho-reporting-engine-classic-core', version: '3.9.1.1'], [group: 'pentaho-reporting-engine', name: 'pentaho-reporting-engine-classic-extensions', version: '3.9.1-GA'], @@ -138,17 +131,22 @@ dependencies { [group: 'com.lowagie', name: 'itext', version: '2.1.7'], [group: 'com.lowagie', name: 'itext-rtf', version: '2.1.7'], [group: 'org.mnode.ical4j', name: 'ical4j', version: '1.0.4'], - [group: 'com.googlecode.flyway', name: 'flyway-maven-plugin', version: '2.1.1'], + [group: 'com.googlecode.flyway', name: 'flyway-core', version: '2.1.1'], [group: 'org.quartz-scheduler', name: 'quartz', version: '2.1.7'], [group: 'com.amazonaws', name: 'aws-java-sdk', version: '1.2.1'], [group: 'net.sf.ehcache', name: 'ehcache', version: '2.7.2'], [group: 'com.github.spullara.mustache.java', name: 'compiler', version: '0.8.12'], - [group: 'com.jayway.jsonpath', name: 'json-path', version: '0.9.1']) + [group: 'com.jayway.jsonpath', name: 'json-path', version: '0.9.1'], - testCompile 'junit:junit:4.11', - 'junit:junit-dep:4.11', - 'org.mockito:mockito-all:1.9.5', - 'com.jayway.restassured:rest-assured:1.7.2' + // Although Mifos (at the time of writing) doesn't have any compile time dep. on this, + // it's useful to have this for the Spring Boot TestRestTemplate http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-rest-templates-test-utility + [group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.2.3'] + ) + testCompile 'junit:junit:4.11', + 'junit:junit-dep:4.11', + 'org.mockito:mockito-core:1.9.5', + 'com.jayway.restassured:rest-assured:1.7.2', + [group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: springBootVersion] } @@ -179,7 +177,7 @@ task dist(type:Zip){ include '*.sql' into('database') } - from('../mifosng-db/migrations') { + from('src/main/resources/sql/migrations') { fileMode = 0755 include '**/*' into('database/migrations') @@ -203,14 +201,11 @@ task deployPentahoReports() { war { it.dependsOn deployPentahoReports - from ('../mifosng-db/migrations/core_db') { - into "WEB-INF/classes/sql" - } } license { header rootProject.file('../LICENSE.md') - excludes(["**/*.mustache"]) + excludes(["**/*.mustache", "**/*.sql", "**/package-info.java", "**/keystore.jks"]) strictCheck true } @@ -229,7 +224,7 @@ tomcatRunWar { stopPort = 8081 stopKey= 'stopKey' enableSSL = true - keystoreFile = file('../keystore.jks') + keystoreFile = file('src/main/resources/keystore.jks') keystorePass = 'openmf' configFile = file('src/test/resources/META-INF/context.xml') } @@ -306,7 +301,7 @@ buildscript { } dependencies { - classpath 'com.github.ben-manes:gradle-flyway-plugin:0.2' + classpath "org.flywaydb:flyway-gradle-plugin:3.0" // version upgraded during Spring Boot & MariaDB4j work, as prev. used v0.2 didn't work well after *.sql moved from mifosng-db to mifosng-provider/src/main/resources (new version also has clearer errors, e.g. in case of missing DB) classpath 'mysql:mysql-connector-java:5.1.22' } } @@ -316,15 +311,12 @@ flyway { url = "jdbc:mysql://localhost:3306/mifostenant-default" user = mysqlUser password = mysqlPassword - - def filePath = "filesystem:$projectDir" + System.properties['file.separator'] + '..' + System.properties['file.separator'] + 'mifosng-db' + System.properties['file.separator'] + 'migrations' - locations = [filePath] } task migrateTenantDB<<{ description="Migrates a Tenant DB. Optionally can pass dbName. Defaults to 'mifostenant-default' (Example: -PdbName=someTenantDBname)" - def filePath = "filesystem:$projectDir" + System.properties['file.separator'] + '..' + System.properties['file.separator'] + 'mifosng-db' + System.properties['file.separator'] + 'migrations/core_db' + def filePath = "filesystem:$projectDir" + '/src/main/resources/sql/migrations/core_db' def tenantDbName = 'mifostenant-default'; if (rootProject.hasProperty("dbName")) { tenantDbName = rootProject.getProperty("dbName") @@ -339,7 +331,7 @@ task migrateTenantDB<<{ task showTenantDBInfo<<{ description="Shows the migration info for a Tenant DB. Optionally can pass dbName. Defaults to 'mifostenant-default' (Example: -PdbName=someTenantDBname)" - def filePath = "filesystem:$projectDir" + System.properties['file.separator'] + '..' + System.properties['file.separator'] + 'mifosng-db' + System.properties['file.separator'] + 'migrations/core_db' + def filePath = "filesystem:$projectDir" + '/src/main/resources/sql/migrations/core_db' def tenantDbName = 'mifostenant-default'; if (rootProject.hasProperty("dbName")) { tenantDbName = rootProject.getProperty("dbName") @@ -354,7 +346,7 @@ task showTenantDBInfo<<{ task migrateTenantListDB<<{ description="Migrates a Tenant List DB. Optionally can pass dbName. Defaults to 'mifosplatform-tenants' (Example: -PdbName=someDBname)" - def filePath = "filesystem:$projectDir" + System.properties['file.separator'] + '..' + System.properties['file.separator'] + 'mifosng-db' + System.properties['file.separator'] + 'migrations/list_db' + def filePath = "filesystem:$projectDir" + '/src/main/resources/sql/migrations/list_db' def tenantsDbName = 'mifosplatform-tenants'; if (rootProject.hasProperty("dbName")) { tenantsDbName = rootProject.getProperty("dbName") @@ -369,7 +361,7 @@ task migrateTenantListDB<<{ task showTenantListDBInfo<<{ description="Shows the migration info for a List DB. Optionally can pass dbName. Defaults to 'mifosplatform-tenants' (Example: -PdbName=someDBname)" - def filePath = "filesystem:$projectDir" + System.properties['file.separator'] + '..' + System.properties['file.separator'] + 'mifosng-db' + System.properties['file.separator'] + 'migrations/list_db' + def filePath = "filesystem:$projectDir" + '/src/main/resources/sql/migrations/list_db' def tenantsDbName = 'mifosplatform-tenants'; if (rootProject.hasProperty("dbName")) { tenantsDbName = rootProject.getProperty("dbName") @@ -383,7 +375,7 @@ task showTenantListDBInfo<<{ task repairTenantDB<<{ description="repair migrate" - def filePath = "filesystem:$projectDir" + System.properties['file.separator'] + '..' + System.properties['file.separator'] + 'mifosng-db' + System.properties['file.separator'] + 'migrations/list_db' + def filePath = "filesystem:$projectDir" + '/src/main/resources/sql/migrations/list_db' def tenantsDbName = 'mifosplatform-tenants'; if (rootProject.hasProperty("dbName")) { tenantsDbName = rootProject.getProperty("dbName") @@ -412,3 +404,9 @@ def qualifyVersionIfNecessary(version) { return version } +springBoot { + mainClass = 'org.mifosplatform.ServerWithMariaDB4jApplication' +} +bootRepackage { + mainClass = 'org.mifosplatform.ServerWithMariaDB4jApplication' +} \ No newline at end of file diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/Utils.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/Utils.java index e5bc869ed..aed37cc7d 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/Utils.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/Utils.java @@ -23,6 +23,11 @@ import com.jayway.restassured.path.json.JsonPath; import com.jayway.restassured.specification.RequestSpecification; import com.jayway.restassured.specification.ResponseSpecification; + +/** + * Util for RestAssured tests. + * This class here in src/integrationTest is copy/pasted to src/test; please keep them in sync. + */ @SuppressWarnings("unchecked") public class Utils { @@ -33,7 +38,7 @@ public class Utils { public static void initializeRESTAssured() { RestAssured.baseURI = "https://localhost"; RestAssured.port = 8443; - RestAssured.keystore("../keystore.jks", "openmf"); + RestAssured.keystore("src/main/resources/keystore.jks", "openmf"); } public static String loginIntoServerAndGetBase64EncodedAuthenticationKey() { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/ServerApplication.java b/mifosng-provider/src/main/java/org/mifosplatform/ServerApplication.java new file mode 100644 index 000000000..3a419e604 --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/ServerApplication.java @@ -0,0 +1,43 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.mifosplatform; + +import org.mifosplatform.infrastructure.core.boot.AbstractApplicationConfiguration; +import org.mifosplatform.infrastructure.core.boot.ApplicationExitUtil; +import org.mifosplatform.infrastructure.core.boot.EmbeddedTomcatWithSSLConfiguration; +import org.mifosplatform.infrastructure.core.boot.db.DataSourceConfiguration; +import org.mifosplatform.infrastructure.core.boot.db.DataSourceProperties; +import org.springframework.boot.SpringApplication; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.context.annotation.Import; + +/** + * Mifos main() application which launches Mifos X in an embedded Tomcat HTTP + * (using Spring Boot). + * + * The DataSource used is a to a "normal" external database (not use MariaDB4j). + * This DataSource can be configured with parameters, see {@link DataSourceProperties}. + * + * You can easily launch this via Debug as Java Application in your IDE - + * without needing command line Gradle stuff, no need to build and deploy a WAR, + * remote attachment etc. + * + * It's the old/classic Mifos (non-X) Workspace 2.0 reborn for Mifos X! ;-) + * + * @see DataSourceProperties about how to configure the DataSource used + * @see ServerWithMariaDB4jApplication for an alternative with an embedded DB + */ +public class ServerApplication { + + @Import({ DataSourceConfiguration.class, EmbeddedTomcatWithSSLConfiguration.class }) + private static class Configuration extends AbstractApplicationConfiguration { } + + public static void main(String[] args) throws Exception { + ConfigurableApplicationContext ctx = SpringApplication.run(Configuration.class, args); + ApplicationExitUtil.waitForKeyPressToCleanlyExit(ctx); + } + +} diff --git a/mifosng-provider/src/main/java/org/mifosplatform/ServerWithMariaDB4jApplication.java b/mifosng-provider/src/main/java/org/mifosplatform/ServerWithMariaDB4jApplication.java new file mode 100644 index 000000000..c489ac974 --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/ServerWithMariaDB4jApplication.java @@ -0,0 +1,39 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.mifosplatform; + +import org.mifosplatform.infrastructure.core.boot.AbstractApplicationConfiguration; +import org.mifosplatform.infrastructure.core.boot.ApplicationExitUtil; +import org.mifosplatform.infrastructure.core.boot.EmbeddedTomcatWithSSLConfiguration; +import org.mifosplatform.infrastructure.core.boot.db.MariaDB4jDataSourceConfiguration; +import org.springframework.boot.SpringApplication; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.context.annotation.Import; + +/** + * Mifos main() application which launches Mifos X in an embedded Tomcat HTTP + * server (using Spring Boot), as well as an embedded database (using + * MariaDB4j). + * + * You can easily launch this via Debug as Java Application in your IDE - + * without needing command line Gradle stuff, no need to build and deploy a WAR, + * remote attachment etc. + * + * It's the old/classic Mifos (non-X) Workspace 2.0 reborn for Mifos X! ;-) + * + * @see ServerApplication for the same without the embedded MariaDB4j database + */ +public class ServerWithMariaDB4jApplication { + + @Import({ MariaDB4jDataSourceConfiguration.class, EmbeddedTomcatWithSSLConfiguration.class }) + public static class Configuration extends AbstractApplicationConfiguration { } + + public static void main(String[] args) throws Exception { + ConfigurableApplicationContext ctx = SpringApplication.run(Configuration.class, args); + ApplicationExitUtil.waitForKeyPressToCleanlyExit(ctx); + } + +} diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/AbstractApplicationConfiguration.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/AbstractApplicationConfiguration.java new file mode 100644 index 000000000..3c95fa989 --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/AbstractApplicationConfiguration.java @@ -0,0 +1,37 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.mifosplatform.infrastructure.core.boot; + +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; +import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; +import org.springframework.context.annotation.ImportResource; + +/** + * Base Spring Configuration with what's common to all Configuration subclasses. + * + * Notably the EnableAutoConfiguration excludes relevant for (and often adjusted + * when upgrading versions of) Spring Boot, the "old" (pre. Spring Boot & + * MariaDB4j) Mifos X appContext.xml which all configurations need, and the + * web.xml successor WebXmlConfiguration. + * + * Should NOT include Configuration related to embedded Tomcat, data sources, + * and MariaDB4j (because those differ in the subclasses). + */ +@Configuration +@Import({ WebXmlConfiguration.class }) +@ImportResource({ "classpath*:META-INF/spring/appContext.xml" }) +@EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class, + HibernateJpaAutoConfiguration.class, + DataSourceTransactionManagerAutoConfiguration.class, + FlywayAutoConfiguration.class }) +public abstract class AbstractApplicationConfiguration { + +} diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/ApplicationExitUtil.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/ApplicationExitUtil.java new file mode 100644 index 000000000..8d6402089 --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/ApplicationExitUtil.java @@ -0,0 +1,33 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.mifosplatform.infrastructure.core.boot; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; + +import org.springframework.context.ConfigurableApplicationContext; + +public abstract class ApplicationExitUtil { + + private ApplicationExitUtil() {} + + public static void waitForKeyPressToCleanlyExit(ConfigurableApplicationContext ctx) throws IOException { + + // NOTE: In Eclipse, the Shutdown Hooks are not invoked on exit (red + // button).. In the case of MariaDB4j that's a problem because then the + // mysqld won't be stopped, so: + // (@see https://bugs.eclipse.org/bugs/show_bug.cgi?id=38016) + System.out.println("\nHit Enter to quit..."); + // NOTE: In Eclipse, System.console() is not available.. so: + // (@see https://bugs.eclipse.org/bugs/show_bug.cgi?id=122429) + BufferedReader d = new BufferedReader(new InputStreamReader(System.in)); + d.readLine(); + + ctx.stop(); + ctx.close(); + } +} \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/EmbeddedTomcatWithSSLConfiguration.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/EmbeddedTomcatWithSSLConfiguration.java new file mode 100644 index 000000000..2ce00dbea --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/EmbeddedTomcatWithSSLConfiguration.java @@ -0,0 +1,104 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.mifosplatform.infrastructure.core.boot; + +import java.io.File; +import java.io.IOException; +import java.net.URL; + +import org.apache.catalina.connector.Connector; +import org.apache.commons.io.FileUtils; +import org.apache.coyote.http11.Http11NioProtocol; +import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory; +import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.Resource; + +@Configuration +public class EmbeddedTomcatWithSSLConfiguration { + + // http://docs.spring.io/spring-boot/docs/1.1.5.RELEASE/reference/htmlsingle/#howto-enable-multiple-connectors-in-tomcat + + @Bean + public EmbeddedServletContainerFactory servletContainer() { + TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory(); + tomcat.setContextPath(getContextPath()); + tomcat.addAdditionalTomcatConnectors(createSslConnector()); + return tomcat; + } + + private String getContextPath() { + return "/mifosng-provider"; + } + + protected Connector createSslConnector() { + Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol"); + Http11NioProtocol protocol = (Http11NioProtocol) connector.getProtocolHandler(); + try { + File keystore = getFile(getKeystore()); + File truststore = keystore; + connector.setScheme("https"); + connector.setSecure(true); + connector.setPort(getHTTPSPort()); + protocol.setSSLEnabled(true); + protocol.setKeystoreFile(keystore.getAbsolutePath()); + protocol.setKeystorePass(getKeystorePass()); + protocol.setTruststoreFile(truststore.getAbsolutePath()); + protocol.setTruststorePass(getKeystorePass()); + // ? protocol.setKeyAlias("apitester"); + return connector; + } catch (IOException ex) { + throw new IllegalStateException("can't access keystore: [" + "keystore" + "] or truststore: [" + "keystore" + "]", ex); + } + } + + protected int getHTTPSPort() { + // TODO This shouldn't be hard-coded here, but configurable + return 8443; + } + + protected String getKeystorePass() { + return "openmf"; + } + + protected Resource getKeystore() { + return new ClassPathResource("/keystore.jks"); + } + + public File getFile(Resource resource) throws IOException { + try { + return resource.getFile(); + } catch (IOException e) { + // Uops.. OK, try again (below) + } + + try { + URL url = resource.getURL(); + // If this creates filenames that are too long on Win, + // then could just use resource.getFilename(), + // even though not unique, real risk prob. min.bon + String tempDir = System.getProperty("java.io.tmpdir"); + tempDir = tempDir + "/" + getClass().getSimpleName() + "/"; + String path = url.getPath(); + String uniqName = path.replace("file:/", "").replace('!', '_'); + String tempFullPath = tempDir + uniqName; + // instead of File.createTempFile(prefix?, suffix?); + File targetFile = new File(tempFullPath); + long len = resource.contentLength(); + if (!targetFile.exists() || targetFile.length() != len) { // Only copy new files + FileUtils.copyURLToFile(url, targetFile); + } + return targetFile; + } catch (IOException e) { + // Uops.. erm, give up: + throw new IOException("Cannot obtain a File for Resource: " + + resource.toString(), e); + } + + } +} \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/WarWebApplicationInitializer.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/WarWebApplicationInitializer.java new file mode 100644 index 000000000..8ea449df3 --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/WarWebApplicationInitializer.java @@ -0,0 +1,40 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.mifosplatform.infrastructure.core.boot; + +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.context.web.SpringBootServletInitializer; +import org.springframework.context.annotation.ImportResource; + +/** + * Required to still have a working legacy "classic" WAR. + * + * Configuration just adds the JNDI-based DataSource lookup to its + * AbstractApplicationConfiguration. + * + * This (intentionally) only configures the original (pre-Spring Boot & + * MariaDB4j) Mifos X Spring Beans, and does NOT include the embedded Tomcat + * (incl. TomcatSSLConfiguration) nor the MariaDB4jSetupService or + * MariaDB4jDataSourceConfiguration, and not even the DataSourceConfiguration + * (as it uses "classic" JNDI) - we want the WAR to "work like before". + * + * @see #howto-convert-an-existing-application-to-spring-boot + */ +public class WarWebApplicationInitializer extends SpringBootServletInitializer { + + @ImportResource({ "classpath*:META-INF/spring/jndi.xml" }) + private static class Configuration extends AbstractApplicationConfiguration { + } + + @Override + protected SpringApplicationBuilder configure( + SpringApplicationBuilder application) { + // let's share Spring Boot Love, so no showBanner(false) + return application.sources(Configuration.class); + } + +} \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/WebXmlConfiguration.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/WebXmlConfiguration.java new file mode 100644 index 000000000..87d8a184b --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/WebXmlConfiguration.java @@ -0,0 +1,50 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.mifosplatform.infrastructure.core.boot; + +import javax.servlet.Filter; +import javax.servlet.Servlet; + +import org.mifosplatform.infrastructure.core.filters.ResponseCorsFilter; +import org.springframework.boot.context.embedded.ServletRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.filter.DelegatingFilterProxy; + +import com.sun.jersey.spi.spring.container.servlet.SpringServlet; + +/** + * This Configuration replaces what formerly was in web.xml. + * + * @see #howto-convert-an-existing-application-to-spring-boot + */ +@Configuration +public class WebXmlConfiguration { + + @Bean + public Filter springSecurityFilterChain() { + return new DelegatingFilterProxy(); + } + + @Bean + public ServletRegistrationBean jersey() { + Servlet jerseyServlet = new SpringServlet(); + ServletRegistrationBean jerseyServletRegistration = new ServletRegistrationBean(); + jerseyServletRegistration.setServlet(jerseyServlet); + jerseyServletRegistration.addUrlMappings("/api/v1/*"); + jerseyServletRegistration.setName("jersey-servlet"); + jerseyServletRegistration.setLoadOnStartup(1); + jerseyServletRegistration.addInitParameter("com.sun.jersey.api.json.POJOMappingFeature", "true"); + jerseyServletRegistration.addInitParameter("com.sun.jersey.spi.container.ContainerResponseFilters", + ResponseCorsFilter.class.getName()); + // debugging for development: + // jerseyServletRegistration.addInitParameter("com.sun.jersey.spi.container.ContainerRequestFilters", + // LoggingFilter.class.getName()); + return jerseyServletRegistration; + } + +} \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/db/DataSourceConfiguration.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/db/DataSourceConfiguration.java new file mode 100644 index 000000000..df4e25b99 --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/db/DataSourceConfiguration.java @@ -0,0 +1,41 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.mifosplatform.infrastructure.core.boot.db; + +import javax.sql.DataSource; + +import org.apache.tomcat.jdbc.pool.PoolConfiguration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * Configuration for a DataSource. + * @see DataSourceProperties about how to configure this DS + */ +@Configuration +public class DataSourceConfiguration { + private static final Logger logger = LoggerFactory.getLogger(DataSourceConfiguration.class); + + @Bean + public DataSourceProperties dataSourceProperties() { + return new DataSourceProperties(); + } + + @Bean + public DataSource tenantDataSourceJndi() { + PoolConfiguration p = getProperties(); + org.apache.tomcat.jdbc.pool.DataSource ds = new org.apache.tomcat.jdbc.pool.DataSource(p); + logger.info("Created new DataSource; url=" + p.getUrl()); + return ds; + } + + protected DataSourceProperties getProperties() { + return dataSourceProperties(); + } + +} \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/db/DataSourceProperties.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/db/DataSourceProperties.java new file mode 100644 index 000000000..5f709c254 --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/db/DataSourceProperties.java @@ -0,0 +1,146 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.mifosplatform.infrastructure.core.boot.db; + +import javax.validation.constraints.NotNull; + +import org.apache.tomcat.jdbc.pool.PoolProperties; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.util.StringUtils; + +/** + * Configurable DataSource. Properties have sensible defaults, but end-users can + * override those via the Spring Values listed below; i.e. via -D Java System + * properties, or main() command line arguments, OS environment variables, from + * JNDI, or application.properties (thanks Spring Boot). For example: + * -Dmifos.datasource.port=3307. + */ +// NOT a @Component - we do not want this to picked up by component scan, only explicitly declared in DataSourceConfiguration (if that's active) +public class DataSourceProperties extends PoolProperties { + + public final static String PORT = "mifos.datasource.port"; + public final static String HOST = "mifos.datasource.host"; + public final static String DB = "mifos.datasource.db"; + public final static String UID = "mifos.datasource.username"; + public final static String PWD = "mifos.datasource.password"; + public final static String PROTOCOL = "mifos.datasource.protocol"; + public final static String SUBPROTOCOL = "mifos.datasource.subprotocol"; + + @Value("${" + PORT + ":3306}") + private volatile @NotNull int port; + + @Value("${" + HOST + ":localhost}") + private volatile @NotNull String hostname; + + @Value("${" + DB + ":mifosplatform-tenants}") + private volatile @NotNull String dbName; + + @Value("${" + UID + ":root}") + private volatile @NotNull String username; + + @Value("${" + PWD + ":mysql}") + private volatile @NotNull String password; + + @Value("${" + PROTOCOL + ":jdbc}") + private volatile @NotNull String jdbcProtocol; + + @Value("${" + SUBPROTOCOL + ":mysql}") + private volatile @NotNull String jdbcSubprotocol; + + + public DataSourceProperties() { + super(); + + // default to save us from re-specifying this; note that it can still be + // overridden + setDriverClassName(com.mysql.jdbc.Driver.class.getName()); + + setMifosDefaults(); + } + + /** + * as per (some of..) INSTALL.md and + * org.mifosplatform.infrastructure.core.service + * .TomcatJdbcDataSourcePerTenantService + * .createNewDataSourceFor(MifosPlatformTenant) + */ + protected void setMifosDefaults() { + setInitialSize(3); + // setMaxIdle(6); -- strange, why? + // setMinIdle(3); -- JavaDoc says default is initialSize.. so shouldn't + // be needed + if (getValidationQuery() == null) setValidationQuery("SELECT 1"); + setTestOnBorrow(true); + setTestOnReturn(true); + setTestWhileIdle(true); + setTimeBetweenEvictionRunsMillis(30000); + setTimeBetweenEvictionRunsMillis(60000); + setLogAbandoned(true); + setSuspectTimeout(60); + + setJdbcInterceptors("org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;" + + "org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer;org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport"); + } + + @Override + public void setUrl(@SuppressWarnings("unused") String url) { + throw new UnsupportedOperationException("Use setHost/Port/DB() instead of setURL()"); + } + + @Override + public String getUrl() { + String url = super.getUrl(); + if (StringUtils.hasText(url)) { + throw new IllegalStateException(); + } + return jdbcProtocol + ":" + jdbcSubprotocol + "://" + getHost() + ":" + getPort() + "/" + getDBName(); + } + + public String getHost() { + return hostname; + } + + public int getPort() { + return port; + } + + public String getDBName() { + return dbName; + } + + public void setPort(int port) { + this.port = port; + } + + public void setHost(String hostname) { + this.hostname = hostname; + } + + public void setDBName(String dbName) { + this.dbName = dbName; + } + + @Override + public String getUsername() { + return this.username; + } + + @Override + public void setUsername(String username) { + this.username = username; + } + + @Override + public String getPassword() { + return this.password; + } + + @Override + public void setPassword(String password) { + this.password = password; + } + +} \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/db/MariaDB4jDataSourceConfiguration.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/db/MariaDB4jDataSourceConfiguration.java new file mode 100644 index 000000000..ca93ebb62 --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/db/MariaDB4jDataSourceConfiguration.java @@ -0,0 +1,49 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.mifosplatform.infrastructure.core.boot.db; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService; + +@Configuration +public class MariaDB4jDataSourceConfiguration extends DataSourceConfiguration { + + @Bean + public MariaDB4jSetupService mariaDB4jSetUp() { + return new MariaDB4jSetupService(mariaDB4j().getDB()); + } + + @Bean + public MariaDB4jSpringService mariaDB4j() { + MariaDB4jSpringService mariaDB4jSpringService = new MariaDB4jSpringService(); + mariaDB4jSpringService.setDefaultBaseDir("build/db/bin"); + mariaDB4jSpringService.setDefaultDataDir("build/db/data"); + return mariaDB4jSpringService; + } + + @Override + // NOT @Bean @Override dataSourceProperties() - doesn't work :( + protected DataSourceProperties getProperties() { + DataSourceProperties p = super.getProperties(); + String dbName = mariaDB4jSetUp().getTenantDBName(); + // Do not use p.setUrl(mariaDB4j().getConfiguration().getURL(dbName)); + // Because TenantDataSourcePortFixService needs separate + // host/port/db/uid/pwd: + // (DataSourceProperties getUrl() creates the correct JDBC URL from it) + // This intentionally overrides any mifos.datasource.* settings, because + // in this configuration, logically the mariaDB4j settings take + // precedence: + p.setHost("localhost"); + p.setPort(mariaDB4j().getConfiguration().getPort()); + p.setDBName(dbName); + // TODO p.setUsername(mariaDB4j().getConfiguration().getUsername()); + // TODO p.setPassword(mariaDB4j().getConfiguration().getPassword()); + return p; + } + +} \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/db/MariaDB4jSetupService.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/db/MariaDB4jSetupService.java new file mode 100644 index 000000000..e34e35ef7 --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/db/MariaDB4jSetupService.java @@ -0,0 +1,41 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.mifosplatform.infrastructure.core.boot.db; + +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; + +import org.springframework.beans.factory.annotation.Autowired; + +import ch.vorburger.exec.ManagedProcessException; +import ch.vorburger.mariadb4j.DB; + +public class MariaDB4jSetupService { + + private DB db; + + @Autowired + public MariaDB4jSetupService(DB db) { + this.db = db; + } + + @PostConstruct + protected void setUpMifosDBs() throws ManagedProcessException { + db.createDB(getTenantDBName()); + db.createDB("mifostenant-default"); + // Note that we don't need to initialize the DBs, because + // the TenantDatabaseUpgradeService will do this in just a moment. + } + + public String getTenantDBName() { + return "mifosplatform-tenants"; + } + + @PreDestroy + protected void stop() throws ManagedProcessException { + db = null; + } +} \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/db/TenantDataSourcePortFixService.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/db/TenantDataSourcePortFixService.java new file mode 100644 index 000000000..8f38037a8 --- /dev/null +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/boot/db/TenantDataSourcePortFixService.java @@ -0,0 +1,83 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.mifosplatform.infrastructure.core.boot.db; + +import javax.sql.DataSource; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.stereotype.Service; + +/** + * Service which "fixes up" the schemaServerPort in the tenants table of the + * mifosplatform-tenants schema. It sets it to the actual current port of + * MariaDB4j, instead of the default 3306 which is hard-coded in the initial + * set-up SQL script (V1__mifos-platform-shared-tenants.sql). + * + * This service is called by the TenantDatabaseUpgradeService + * "just at the right time" during start-up, that is AFTER the initialization of + * the mifosplatform-tenants but BEFORE Flyway runs on all tenant schemas. + * + * It's difficult to achieve the same goal elsewhere, because we cannot do this + * e.g. in MariaDB4jSetupService, as that's too early + * (TenantDatabaseUpgradeService has not yet run), nor e.g. in + * TomcatJdbcDataSourcePerTenantService because in there we do not have access + * to and should not depend on MariaDB4j configuration. + */ +@Service +public class TenantDataSourcePortFixService { + private static final Logger logger = LoggerFactory.getLogger(TenantDataSourcePortFixService.class); + + /** + * While what this class does is convenient in 96% you may would like to + * completely disable it if you've hand tuned your tenants table for an + * advanced configuration and use e.g. different databases maybe on + * different hosts for different tenants. + */ + public final static String ENABLED = "mifos.tenantdb.fixup"; + @Value("${" + ENABLED + ":true}") + private boolean enabled; + + // required=false is important here, because in + // WebApplicationInitializerConfiguration for classic WAR there + // is (intentionally) no MariaDB4j nor a DataSourceProperties + // bean (because in the WAR we're using a DS from JNDI) + private @Autowired(required = false) DataSourceProperties dsp; + + private JdbcTemplate jdbcTemplate; + + @Autowired + public TenantDataSourcePortFixService(@Qualifier("tenantDataSourceJndi") final DataSource dataSource) { + this.jdbcTemplate = new JdbcTemplate(dataSource); + } + + public void fixUpTenantsSchemaServerPort() { + if (!enabled) { + logger.info("No schema_server_port UPDATE made to tenants table of the mifosplatform-tenants schema, because " + ENABLED + " = false"); + return; + } + if (dsp == null) { + // we don't have any generic mechanism to know the DB port, given just a tenant DataSource + logger.debug("No schema_server_port UPDATE made to tenants table of the mifosplatform-tenants schema (because neither MariaDB4j nor our own Spring Boot DataSourceConfiguration is used in a traditional WAR)"); + return; + } + int r = jdbcTemplate + .update("UPDATE tenants SET schema_server = ?, schema_server_port = ?, schema_username = ?, schema_password = ?", + dsp.getHost(), dsp.getPort(), dsp.getUsername(), dsp.getPassword()); + if ( r == 0 ) + logger.warn("UPDATE tenants SET ... did not update ANY rows - something is probably wrong"); + else + logger.info("Upated " + + r + + " rows in the tenants table of the mifosplatform-tenants schema to the real current host: " + + dsp.getHost() + ", port: " + dsp.getPort()); + } + +} diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/AbandonedConnectionCleanupShutdownListener.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/AbandonedConnectionCleanupShutdownListener.java index f5def24cd..53e721eea 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/AbandonedConnectionCleanupShutdownListener.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/AbandonedConnectionCleanupShutdownListener.java @@ -12,18 +12,22 @@ import java.util.Enumeration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.ApplicationListener; -import org.springframework.context.event.ContextStoppedEvent; +import org.springframework.context.event.ContextClosedEvent; import org.springframework.stereotype.Service; import com.mysql.jdbc.AbandonedConnectionCleanupThread; @Service -public class AbandonedConnectionCleanupShutdownListener implements ApplicationListener { +public class AbandonedConnectionCleanupShutdownListener implements ApplicationListener { private final static Logger logger = LoggerFactory.getLogger(AbandonedConnectionCleanupShutdownListener.class); + /** + * @see JobRegisterServiceImpl#onApplicationEvent(ContextClosedEvent) doc + * re. why we use ContextClosedEvent instead of ContextStoppedEvent + */ @Override - public void onApplicationEvent(@SuppressWarnings("unused") ContextStoppedEvent event) { + public void onApplicationEvent(@SuppressWarnings("unused") ContextClosedEvent event) { shutDowncleanUpThreadAndDeregisterJDBCDriver(); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/TenantDatabaseUpgradeService.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/TenantDatabaseUpgradeService.java index 57a497955..33d744a38 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/TenantDatabaseUpgradeService.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/TenantDatabaseUpgradeService.java @@ -8,13 +8,17 @@ package org.mifosplatform.infrastructure.core.service; import java.util.List; import javax.annotation.PostConstruct; +import javax.sql.DataSource; +import org.mifosplatform.infrastructure.core.boot.db.TenantDataSourcePortFixService; import org.mifosplatform.infrastructure.core.domain.MifosPlatformTenant; import org.mifosplatform.infrastructure.security.service.TenantDetailsService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Service; import com.googlecode.flyway.core.Flyway; +import com.googlecode.flyway.core.api.FlywayException; /** * A service that picks up on tenants that are configured to auto-update their @@ -24,23 +28,52 @@ import com.googlecode.flyway.core.Flyway; public class TenantDatabaseUpgradeService { private final TenantDetailsService tenantDetailsService; + protected final DataSource tenantDataSource; + protected final TenantDataSourcePortFixService tenantDataSourcePortFixService; @Autowired - public TenantDatabaseUpgradeService(final TenantDetailsService detailsService) { + public TenantDatabaseUpgradeService( + final TenantDetailsService detailsService, + @Qualifier("tenantDataSourceJndi") final DataSource dataSource, + TenantDataSourcePortFixService tenantDataSourcePortFixService) + { this.tenantDetailsService = detailsService; + this.tenantDataSource = dataSource; + this.tenantDataSourcePortFixService = tenantDataSourcePortFixService; } @PostConstruct public void upgradeAllTenants() { + upgradeTenantDB(); final List tenants = this.tenantDetailsService.findAllTenants(); for (final MifosPlatformTenant tenant : tenants) { if (tenant.isAutoUpdateEnabled()) { final Flyway flyway = new Flyway(); flyway.setDataSource(tenant.databaseURL(), tenant.getSchemaUsername(), tenant.getSchemaPassword()); - flyway.setLocations("sql"); + flyway.setLocations("sql/migrations/core_db"); flyway.setOutOfOrder(true); - flyway.migrate(); + try { + flyway.migrate(); + } catch (FlywayException e) { + String betterMessage = e.getMessage() + + "; for Tenant DB URL: " + tenant.databaseURL() + + ", username: " + tenant.getSchemaUsername(); + throw new FlywayException(betterMessage, e.getCause()); + } } } } + + /** + * Initializes, and if required upgrades (using Flyway) the Tenant DB itself. + */ + private void upgradeTenantDB() { + final Flyway flyway = new Flyway(); + flyway.setDataSource(tenantDataSource); + flyway.setLocations("sql/migrations/list_db"); + flyway.setOutOfOrder(true); + flyway.migrate(); + + tenantDataSourcePortFixService.fixUpTenantsSchemaServerPort(); + } } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/TomcatJdbcDataSourcePerTenantService.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/TomcatJdbcDataSourcePerTenantService.java index c6de3bd8f..f5a3cd13b 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/TomcatJdbcDataSourcePerTenantService.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/TomcatJdbcDataSourcePerTenantService.java @@ -64,6 +64,8 @@ public class TomcatJdbcDataSourcePerTenantService implements RoutingDataSourceSe // see // http://www.tomcatexpert.com/blog/2010/04/01/configuring-jdbc-pool-high-concurrency + // see also org.mifosplatform.DataSourceProperties.setMifosDefaults() + final String jdbcUrl = tenant.databaseURL(); final PoolConfiguration poolConfiguration = new PoolProperties(); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/jobs/annotation/CronMethodParser.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/jobs/annotation/CronMethodParser.java index 436cb6640..dabbfc8ae 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/jobs/annotation/CronMethodParser.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/jobs/annotation/CronMethodParser.java @@ -60,7 +60,8 @@ public class CronMethodParser { throws IOException { final String basePackagePath = ClassUtils.convertClassNameToResourcePath(new StandardEnvironment() .resolveRequiredPlaceholders(SEARCH_PACKAGE)); - final String packageSearchPath = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX + basePackagePath + "/" + RESOURCE_PATTERN; + String packageSearchPath = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX + basePackagePath + "/" + RESOURCE_PATTERN; + packageSearchPath = packageSearchPath.replace("//", "/"); // else it doesn't work if *.class are in WAR!! final Resource[] resources = resourcePatternResolver.getResources(packageSearchPath); for (final Resource resource : resources) { if (resource.isReadable()) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/jobs/service/JobRegisterServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/jobs/service/JobRegisterServiceImpl.java index 75940d6a6..433da0432 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/jobs/service/JobRegisterServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/jobs/service/JobRegisterServiceImpl.java @@ -36,7 +36,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationListener; -import org.springframework.context.event.ContextStoppedEvent; +import org.springframework.context.event.ContextClosedEvent; import org.springframework.scheduling.quartz.CronTriggerFactoryBean; import org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean; import org.springframework.scheduling.quartz.SchedulerFactoryBean; @@ -48,7 +48,7 @@ import org.springframework.stereotype.Service; * {@link CronTriggerFactoryBean} */ @Service -public class JobRegisterServiceImpl implements JobRegisterService, ApplicationListener { +public class JobRegisterServiceImpl implements JobRegisterService, ApplicationListener { private final static Logger logger = LoggerFactory.getLogger(JobRegisterServiceImpl.class); @@ -230,8 +230,14 @@ public class JobRegisterServiceImpl implements JobRegisterService, ApplicationLi return !this.schedularWritePlatformService.retriveSchedulerDetail().isSuspended(); } + /** + * Need to use ContextClosedEvent instead of ContextStoppedEvent because in + * case Spring Boot fails to start-up (e.g. because Tomcat port is already + * in use) then org.springframework.boot.SpringApplication.run(String...) + * does a context.close(); and not a context.stop(); + */ @Override - public void onApplicationEvent(@SuppressWarnings("unused") ContextStoppedEvent event) { + public void onApplicationEvent(@SuppressWarnings("unused") ContextClosedEvent event) { this.stopAllSchedulers(); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/security/data/PlatformRequestLog.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/security/data/PlatformRequestLog.java index 7dacef195..c3a3247e4 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/security/data/PlatformRequestLog.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/security/data/PlatformRequestLog.java @@ -28,14 +28,12 @@ public class PlatformRequestLog { @SuppressWarnings("unused") private final String url; @SuppressWarnings("unused") - private final Map parameters; + private final Map parameters; public static PlatformRequestLog from(final StopWatch task, final HttpServletRequest request) throws IOException { - final String requestUrl = request.getRequestURL().toString(); - @SuppressWarnings("unchecked") - final Map parameters = new HashMap<>(request.getParameterMap()); + final Map parameters = new HashMap<>(request.getParameterMap()); parameters.remove("password"); parameters.remove("_"); @@ -43,7 +41,7 @@ public class PlatformRequestLog { } private PlatformRequestLog(final long startTime, final long time, final String method, final String requestUrl, - final Map parameters) { + final Map parameters) { this.startTime = startTime; this.totalTime = time; this.method = method; diff --git a/mifosng-provider/src/main/resources/META-INF/spring/appContext.xml b/mifosng-provider/src/main/resources/META-INF/spring/appContext.xml index 8034f32ef..422d368b4 100644 --- a/mifosng-provider/src/main/resources/META-INF/spring/appContext.xml +++ b/mifosng-provider/src/main/resources/META-INF/spring/appContext.xml @@ -45,6 +45,13 @@ org.mifosplatform.batch"> + + + - diff --git a/keystore.jks b/mifosng-provider/src/main/resources/keystore.jks similarity index 100% rename from keystore.jks rename to mifosng-provider/src/main/resources/keystore.jks diff --git a/mifosng-db/migrations/core_db/V100__Group_saving_summary_report.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V100__Group_saving_summary_report.sql similarity index 100% rename from mifosng-db/migrations/core_db/V100__Group_saving_summary_report.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V100__Group_saving_summary_report.sql diff --git a/mifosng-db/migrations/core_db/V101__add_mulitplesof_to_account_transfers_table.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V101__add_mulitplesof_to_account_transfers_table.sql similarity index 67% rename from mifosng-db/migrations/core_db/V101__add_mulitplesof_to_account_transfers_table.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V101__add_mulitplesof_to_account_transfers_table.sql index 1cc31bce7..73a241de2 100644 --- a/mifosng-db/migrations/core_db/V101__add_mulitplesof_to_account_transfers_table.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V101__add_mulitplesof_to_account_transfers_table.sql @@ -1,2 +1,2 @@ -ALTER TABLE `m_savings_account_transfer` +ALTER TABLE `m_savings_account_transfer` ADD COLUMN `currency_multiplesof` SMALLINT(5) NULL DEFAULT NULL AFTER `currency_digits`; \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V102__client_attendance_tables.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V102__client_attendance_tables.sql similarity index 100% rename from mifosng-db/migrations/core_db/V102__client_attendance_tables.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V102__client_attendance_tables.sql diff --git a/mifosng-db/migrations/core_db/V103__cluster_support_for_batch_jobs.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V103__cluster_support_for_batch_jobs.sql similarity index 99% rename from mifosng-db/migrations/core_db/V103__cluster_support_for_batch_jobs.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V103__cluster_support_for_batch_jobs.sql index 7343f7f74..1ec73e894 100755 --- a/mifosng-db/migrations/core_db/V103__cluster_support_for_batch_jobs.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V103__cluster_support_for_batch_jobs.sql @@ -1,6 +1,6 @@ ALTER TABLE `job` ADD COLUMN `is_misfired` TINYINT(1) NOT NULL DEFAULT '0' AFTER `scheduler_group`; - + CREATE TABLE `scheduler_detail` ( `id` SMALLINT(2) NOT NULL AUTO_INCREMENT, `is_suspended` TINYINT(1) NOT NULL DEFAULT '0', diff --git a/mifosng-db/migrations/core_db/V104__permissions_for_transfers.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V104__permissions_for_transfers.sql similarity index 79% rename from mifosng-db/migrations/core_db/V104__permissions_for_transfers.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V104__permissions_for_transfers.sql index 485010005..4e428d252 100644 --- a/mifosng-db/migrations/core_db/V104__permissions_for_transfers.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V104__permissions_for_transfers.sql @@ -1,11 +1,11 @@ -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('portfolio_group', 'TRANSFERCLIENTS_GROUP', 'GROUP', 'TRANSFERCLIENTS', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('portfolio_group', 'TRANSFERCLIENTS_GROUP_CHECKER', 'GROUP', 'TRANSFERCLIENTS', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('portfolio', 'TRANSFER_CLIENT', 'CLIENT', 'TRANSFER', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('portfolio', 'TRANSFER_CLIENT_CHECKER', 'CLIENT', 'TRANSFER', 0); \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V105__track_loan_transaction_against_office.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V105__track_loan_transaction_against_office.sql similarity index 100% rename from mifosng-db/migrations/core_db/V105__track_loan_transaction_against_office.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V105__track_loan_transaction_against_office.sql diff --git a/mifosng-db/migrations/core_db/V106__more_permissions_for_transfers.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V106__more_permissions_for_transfers.sql similarity index 83% rename from mifosng-db/migrations/core_db/V106__more_permissions_for_transfers.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V106__more_permissions_for_transfers.sql index 3b99dea4e..b522f6eac 100644 --- a/mifosng-db/migrations/core_db/V106__more_permissions_for_transfers.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V106__more_permissions_for_transfers.sql @@ -2,29 +2,29 @@ DELETE FROM `m_permission` WHERE `code`="TRANSFER_CLIENT"; DELETE FROM `m_permission` WHERE `code`="TRANSFER_CLIENT_CHECKER"; /**Permissions for proposing a transfer**/ -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('portfolio', 'PROPOSETRANSFER_CLIENT', 'CLIENT', 'PROPOSETRANSFER', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('portfolio', 'PROPOSETRANSFER_CLIENT_CHECKER', 'CLIENT', 'PROPOSETRANSFER', 0); /**Permissions for accepting a transfer**/ -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('portfolio', 'ACCEPTTRANSFER_CLIENT', 'CLIENT', 'ACCEPTTRANSFER', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('portfolio', 'ACCEPTTRANSFER_CLIENT_CHECKER', 'CLIENT', 'ACCEPTTRANSFER', 0); /**Permissions for rejecting a transfer**/ -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('portfolio', 'REJECTTRANSFER_CLIENT', 'CLIENT', 'REJECTTRANSFER', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('portfolio', 'REJECTTRANSFER_CLIENT_CHECKER', 'CLIENT', 'REJECTTRANSFER', 0); /**Permissions for withdrawing a transfer proposal**/ -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('portfolio', 'WITHDRAWTRANSFER_CLIENT', 'CLIENT', 'WITHDRAWTRANSFER', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('portfolio', 'WITHDRAWTRANSFER_CLIENT_CHECKER', 'CLIENT', 'WITHDRAWTRANSFER', 0); \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V107__datatable_code_mappings.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V107__datatable_code_mappings.sql similarity index 100% rename from mifosng-db/migrations/core_db/V107__datatable_code_mappings.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V107__datatable_code_mappings.sql diff --git a/mifosng-db/migrations/core_db/V108__client_has_transfer_office.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V108__client_has_transfer_office.sql similarity index 100% rename from mifosng-db/migrations/core_db/V108__client_has_transfer_office.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V108__client_has_transfer_office.sql diff --git a/mifosng-db/migrations/core_db/V109__account_transfer_withdrawal_fee_configuration.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V109__account_transfer_withdrawal_fee_configuration.sql similarity index 85% rename from mifosng-db/migrations/core_db/V109__account_transfer_withdrawal_fee_configuration.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V109__account_transfer_withdrawal_fee_configuration.sql index 7e50e1708..e21b0d9ed 100755 --- a/mifosng-db/migrations/core_db/V109__account_transfer_withdrawal_fee_configuration.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V109__account_transfer_withdrawal_fee_configuration.sql @@ -1,5 +1,5 @@ ALTER TABLE `m_savings_product` - ADD COLUMN `withdrawal_fee_for_transfer` TINYINT NULL DEFAULT '1' AFTER `withdrawal_fee_type_enum`; - + ADD COLUMN `withdrawal_fee_for_transfer` TINYINT NULL DEFAULT '1' AFTER `withdrawal_fee_type_enum`; + ALTER TABLE `m_savings_account` ADD COLUMN `withdrawal_fee_for_transfer` TINYINT NULL DEFAULT '1' AFTER `withdrawal_fee_type_enum`; diff --git a/mifosng-db/migrations/core_db/V10__interest-posting-fields-for-savings.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V10__interest-posting-fields-for-savings.sql similarity index 81% rename from mifosng-db/migrations/core_db/V10__interest-posting-fields-for-savings.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V10__interest-posting-fields-for-savings.sql index b1a04c6bf..d5305cb98 100644 --- a/mifosng-db/migrations/core_db/V10__interest-posting-fields-for-savings.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V10__interest-posting-fields-for-savings.sql @@ -1,12 +1,12 @@ -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) -VALUES +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +VALUES ('transaction_savings', 'POSTINTEREST_SAVINGSACCOUNT', 'SAVINGSACCOUNT', 'POSTINTEREST', '1'), ('transaction_savings', 'POSTINTEREST_SAVINGSACCOUNT_CHECKER', 'SAVINGSACCOUNT', 'POSTINTEREST', '0'); -ALTER TABLE `m_savings_product` +ALTER TABLE `m_savings_product` ADD COLUMN `interest_posting_period_enum` SMALLINT(5) NOT NULL DEFAULT 4 AFTER `interest_compounding_period_enum`; -ALTER TABLE `m_savings_account` +ALTER TABLE `m_savings_account` ADD COLUMN `interest_posting_period_enum` SMALLINT(5) NOT NULL DEFAULT 4 AFTER `interest_compounding_period_enum`; \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V110__group_center_close.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V110__group_center_close.sql similarity index 100% rename from mifosng-db/migrations/core_db/V110__group_center_close.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V110__group_center_close.sql diff --git a/mifosng-db/migrations/core_db/V111_1__set default_transfers_in_suspense_account_for_existing_loan_products.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V111_1__set default_transfers_in_suspense_account_for_existing_loan_products.sql similarity index 100% rename from mifosng-db/migrations/core_db/V111_1__set default_transfers_in_suspense_account_for_existing_loan_products.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V111_1__set default_transfers_in_suspense_account_for_existing_loan_products.sql diff --git a/mifosng-db/migrations/core_db/V111__disable_constraint_approach_for_datatables_by_default.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V111__disable_constraint_approach_for_datatables_by_default.sql similarity index 100% rename from mifosng-db/migrations/core_db/V111__disable_constraint_approach_for_datatables_by_default.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V111__disable_constraint_approach_for_datatables_by_default.sql diff --git a/mifosng-db/migrations/core_db/V112__mixreport_sql_support.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V112__mixreport_sql_support.sql similarity index 99% rename from mifosng-db/migrations/core_db/V112__mixreport_sql_support.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V112__mixreport_sql_support.sql index 133e3f6b1..cd570bfe9 100644 --- a/mifosng-db/migrations/core_db/V112__mixreport_sql_support.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V112__mixreport_sql_support.sql @@ -1,4 +1,4 @@ -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('xbrlmapping', 'UPDATE_XBRLMAPPING', 'XBRLMAPPING', 'UPDATE', 0); DROP TABLE IF EXISTS `mix_taxonomy`; @@ -83,7 +83,7 @@ CREATE TABLE `mix_taxonomy_mapping` ( LOCK TABLES `mix_taxonomy_mapping` WRITE; -INSERT INTO `mix_taxonomy_mapping` (`id`, `identifier`, `config`, `last_update_date`, `currency`) VALUES +INSERT INTO `mix_taxonomy_mapping` (`id`, `identifier`, `config`, `last_update_date`, `currency`) VALUES (1,'default',NULL,NULL,''); UNLOCK TABLES; diff --git a/mifosng-db/migrations/core_db/V113__track_savings_transaction_against_office.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V113__track_savings_transaction_against_office.sql similarity index 100% rename from mifosng-db/migrations/core_db/V113__track_savings_transaction_against_office.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V113__track_savings_transaction_against_office.sql diff --git a/mifosng-db/migrations/core_db/V114__set_default_transfers_in_suspense_account_for_existing_savings_products - Copy.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V114__set_default_transfers_in_suspense_account_for_existing_savings_products - Copy.sql similarity index 100% rename from mifosng-db/migrations/core_db/V114__set_default_transfers_in_suspense_account_for_existing_savings_products - Copy.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V114__set_default_transfers_in_suspense_account_for_existing_savings_products - Copy.sql diff --git a/mifosng-db/migrations/core_db/V115__permissions_for_cache_api.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V115__permissions_for_cache_api.sql similarity index 88% rename from mifosng-db/migrations/core_db/V115__permissions_for_cache_api.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V115__permissions_for_cache_api.sql index e195d04a9..60c0a5fe6 100644 --- a/mifosng-db/migrations/core_db/V115__permissions_for_cache_api.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V115__permissions_for_cache_api.sql @@ -12,8 +12,8 @@ VALUES (1, 1); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('configuration', 'READ_CACHE', 'CACHE', 'READ', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('configuration', 'UPDATE_CACHE', 'CACHE', 'UPDATE', 0); \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V116__track_currency_for_journal_entries.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V116__track_currency_for_journal_entries.sql similarity index 100% rename from mifosng-db/migrations/core_db/V116__track_currency_for_journal_entries.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V116__track_currency_for_journal_entries.sql diff --git a/mifosng-db/migrations/core_db/V117__loan_charge_from_savings.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V117__loan_charge_from_savings.sql similarity index 97% rename from mifosng-db/migrations/core_db/V117__loan_charge_from_savings.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V117__loan_charge_from_savings.sql index f635fb942..32d3318fd 100755 --- a/mifosng-db/migrations/core_db/V117__loan_charge_from_savings.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V117__loan_charge_from_savings.sql @@ -15,13 +15,12 @@ ENGINE=InnoDB; ALTER TABLE `m_charge` ADD COLUMN `charge_payment_mode_enum` SMALLINT(5) NOT NULL DEFAULT '0' AFTER `charge_calculation_enum`; - + ALTER TABLE `m_loan_charge` - ADD COLUMN `charge_payment_mode_enum` SMALLINT(5) NOT NULL DEFAULT '0' AFTER `charge_calculation_enum`; - + ADD COLUMN `charge_payment_mode_enum` SMALLINT(5) NOT NULL DEFAULT '0' AFTER `charge_calculation_enum`; + INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('transaction_loan', 'PAY_LOANCHARGE', 'LOANCHARGE', 'PAY', 0); - + INSERT INTO `job` (`name`, `display_name`, `cron_expression`, `create_time`, `task_priority`, `group_name`, `previous_run_start_time`, `next_run_time`, `job_key`, `initializing_errorlog`, `is_active`, `currently_running`, `updates_allowed`, `scheduler_group`, `is_misfired`) VALUES ('Transfer Fee For Loans From Savings', 'Transfer Fee For Loans From Savings', '0 1 0 1/1 * ? *', now(), 5, NULL, NULL, NULL, NULL, NULL, 1, 0, 1, 0, 0); - \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V118_1__savings_charge_patch_update.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V118_1__savings_charge_patch_update.sql similarity index 100% rename from mifosng-db/migrations/core_db/V118_1__savings_charge_patch_update.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V118_1__savings_charge_patch_update.sql diff --git a/mifosng-db/migrations/core_db/V118_2__product_mapping_delete_duplicate_fund_source_to_account_mappings.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V118_2__product_mapping_delete_duplicate_fund_source_to_account_mappings.sql similarity index 67% rename from mifosng-db/migrations/core_db/V118_2__product_mapping_delete_duplicate_fund_source_to_account_mappings.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V118_2__product_mapping_delete_duplicate_fund_source_to_account_mappings.sql index fad8ea69d..7f2a76ada 100644 --- a/mifosng-db/migrations/core_db/V118_2__product_mapping_delete_duplicate_fund_source_to_account_mappings.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V118_2__product_mapping_delete_duplicate_fund_source_to_account_mappings.sql @@ -1 +1 @@ -delete from acc_product_mapping where financial_account_type=10 and payment_type is not null; \ No newline at end of file +delete from acc_product_mapping where financial_account_type=10 and payment_type is not null; \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V118_3__permissions_form_propose_and_accept_client_transfers.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V118_3__permissions_form_propose_and_accept_client_transfers.sql similarity index 84% rename from mifosng-db/migrations/core_db/V118_3__permissions_form_propose_and_accept_client_transfers.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V118_3__permissions_form_propose_and_accept_client_transfers.sql index 215d73c8b..431bccb3b 100644 --- a/mifosng-db/migrations/core_db/V118_3__permissions_form_propose_and_accept_client_transfers.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V118_3__permissions_form_propose_and_accept_client_transfers.sql @@ -1,7 +1,6 @@ /**Permissions for proposing and accepting a transfer**/ -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('portfolio', 'PROPOSEANDACCEPTTRANSFER_CLIENT', 'CLIENT', 'PROPOSEANDACCEPTTRANSFER', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('portfolio', 'PROPOSEANDACCEPTTRANSFER_CLIENT_CHECKER', 'CLIENT', 'PROPOSEANDACCEPTTRANSFER', 0); - diff --git a/mifosng-db/migrations/core_db/V118_4__reset_default_transfers_in_suspense_account_for_existing_savings_products.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V118_4__reset_default_transfers_in_suspense_account_for_existing_savings_products.sql similarity index 100% rename from mifosng-db/migrations/core_db/V118_4__reset_default_transfers_in_suspense_account_for_existing_savings_products.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V118_4__reset_default_transfers_in_suspense_account_for_existing_savings_products.sql diff --git a/mifosng-db/migrations/core_db/V118_5__batch_job_entry_for_pay_savings_charge.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V118_5__batch_job_entry_for_pay_savings_charge.sql similarity index 100% rename from mifosng-db/migrations/core_db/V118_5__batch_job_entry_for_pay_savings_charge.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V118_5__batch_job_entry_for_pay_savings_charge.sql diff --git a/mifosng-db/migrations/core_db/V118_6__defaults_for_income_from_penalties_for savings_product.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V118_6__defaults_for_income_from_penalties_for savings_product.sql similarity index 100% rename from mifosng-db/migrations/core_db/V118_6__defaults_for_income_from_penalties_for savings_product.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V118_6__defaults_for_income_from_penalties_for savings_product.sql diff --git a/mifosng-db/migrations/core_db/V118_7__move_withdrawal_annual_fee_to_charges.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V118_7__move_withdrawal_annual_fee_to_charges.sql similarity index 62% rename from mifosng-db/migrations/core_db/V118_7__move_withdrawal_annual_fee_to_charges.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V118_7__move_withdrawal_annual_fee_to_charges.sql index 21312590f..8f03fbf86 100644 --- a/mifosng-db/migrations/core_db/V118_7__move_withdrawal_annual_fee_to_charges.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V118_7__move_withdrawal_annual_fee_to_charges.sql @@ -19,7 +19,7 @@ begin declare t_calculation_percentage DECIMAL(19,6); declare t_calculation_on_amount DECIMAL(19,6); declare t_withdrawal_fee_name VARCHAR(100); - + declare t_charge_id BIGINT(20); declare t_savings_charge_id BIGINT(20); @@ -29,7 +29,7 @@ begin declare cursor1 cursor for - select sa.currency_code, sa.withdrawal_fee_type_enum, sa.withdrawal_fee_amount + select sa.currency_code, sa.withdrawal_fee_type_enum, sa.withdrawal_fee_amount from m_savings_account sa where sa.withdrawal_fee_amount is not null and sa.withdrawal_fee_amount > 0 group by sa.currency_code, sa.withdrawal_fee_type_enum; declare cursor2 cursor for @@ -39,55 +39,55 @@ begin select sat.id, sat.amount from m_savings_account_transaction sat where sat.savings_account_id=v_account_id and sat.transaction_type_enum=4; - declare continue handler for not found + declare continue handler for not found set no_more_rows := true; open cursor1; LOOP1: loop - fetch cursor1 into v_currency_code, v_withdrawal_fee_type_enum, v_withdrawal_fee_amount_charge_def; - if no_more_rows then - close cursor1; - leave LOOP1; - end if; - -- set withdrawal fee name - if(v_withdrawal_fee_type_enum = 1) then - set t_withdrawal_fee_name = CONCAT('Withdrawal fee-Flat-',v_currency_code); - else - set t_withdrawal_fee_name = CONCAT('Withdrawal fee-Percentage-',v_currency_code); - end if; + fetch cursor1 into v_currency_code, v_withdrawal_fee_type_enum, v_withdrawal_fee_amount_charge_def; + if no_more_rows then + close cursor1; + leave LOOP1; + end if; + -- set withdrawal fee name + if(v_withdrawal_fee_type_enum = 1) then + set t_withdrawal_fee_name = CONCAT('Withdrawal fee-Flat-',v_currency_code); + else + set t_withdrawal_fee_name = CONCAT('Withdrawal fee-Percentage-',v_currency_code); + end if; - -- get charge id if already exists - set t_charge_id = (select id from m_charge where name = t_withdrawal_fee_name); + -- get charge id if already exists + set t_charge_id = (select id from m_charge where name = t_withdrawal_fee_name); - if t_charge_id is null then - -- add withdrawal fee to charges - INSERT INTO `m_charge` (`name`, `currency_code`, `charge_applies_to_enum`, `charge_time_enum`, `charge_calculation_enum`, `charge_payment_mode_enum`, `amount`, `is_penalty`, `is_active`, `is_deleted`) VALUES (t_withdrawal_fee_name , v_currency_code, 2, 5, v_withdrawal_fee_type_enum, 0, v_withdrawal_fee_amount_charge_def, 0, 1, 0); + if t_charge_id is null then + -- add withdrawal fee to charges + INSERT INTO `m_charge` (`name`, `currency_code`, `charge_applies_to_enum`, `charge_time_enum`, `charge_calculation_enum`, `charge_payment_mode_enum`, `amount`, `is_penalty`, `is_active`, `is_deleted`) VALUES (t_withdrawal_fee_name , v_currency_code, 2, 5, v_withdrawal_fee_type_enum, 0, v_withdrawal_fee_amount_charge_def, 0, 1, 0); - -- get inserted charge id - set t_charge_id = last_insert_id(); - end if; + -- get inserted charge id + set t_charge_id = last_insert_id(); + end if; - open cursor2; + open cursor2; LOOP2: loop - fetch cursor2 into v_account_id, v_withdrawal_fee_amount; - if no_more_rows then - set no_more_rows := false; - close cursor2; - leave LOOP2; + fetch cursor2 into v_account_id, v_withdrawal_fee_amount; + if no_more_rows then + set no_more_rows := false; + close cursor2; + leave LOOP2; end if; if (v_withdrawal_fee_type_enum=1) then - set t_calculation_percentage = NULL; - set t_calculation_on_amount = NULL; + set t_calculation_percentage = NULL; + set t_calculation_on_amount = NULL; else set t_calculation_percentage = v_withdrawal_fee_amount; set v_withdrawal_fee_amount = 0; set t_calculation_on_amount = 0; end if; - if not exists (select id from m_savings_account_charge sac where - sac.savings_account_id=v_account_id and sac.charge_id=t_charge_id and sac.charge_time_enum=5) then - + if not exists (select id from m_savings_account_charge sac where + sac.savings_account_id=v_account_id and sac.charge_id=t_charge_id and sac.charge_time_enum=5) then + -- attach withdrawal charge to savings INSERT INTO `m_savings_account_charge` (`savings_account_id`, `charge_id`, `is_penalty`, `charge_time_enum`, `charge_due_date`, `fee_on_month`, `fee_on_day`, `charge_calculation_enum`, `calculation_percentage`, `calculation_on_amount`, `amount`, `amount_paid_derived`, `amount_waived_derived`, `amount_writtenoff_derived`, `amount_outstanding_derived`, `is_paid_derived`, `waived`, `is_active`) VALUES (v_account_id, t_charge_id, 0, 5, NULL, NULL, NULL, v_withdrawal_fee_type_enum, t_calculation_percentage, t_calculation_on_amount, v_withdrawal_fee_amount, NULL, NULL, NULL, 0.000000, 0, 0, 1); @@ -95,28 +95,28 @@ begin set t_savings_charge_id = last_insert_id(); else - - set t_savings_charge_id = (select id from m_savings_account_charge sac where sac.savings_account_id=v_account_id and sac.charge_id=t_charge_id and sac.charge_time_enum=5); + + set t_savings_charge_id = (select id from m_savings_account_charge sac where sac.savings_account_id=v_account_id and sac.charge_id=t_charge_id and sac.charge_time_enum=5); end if; open cursor3; LOOP3: loop - fetch cursor3 into v_savings_transaction_id, v_transaction_amount; - - if no_more_rows then - set no_more_rows := false; - close cursor3; - leave LOOP3; + fetch cursor3 into v_savings_transaction_id, v_transaction_amount; + + if no_more_rows then + set no_more_rows := false; + close cursor3; + leave LOOP3; end if; - if not exists (select id from m_savings_account_charge_paid_by sacp where - sacp.savings_account_transaction_id=v_savings_transaction_id and sacp.savings_account_charge_id=t_savings_charge_id) then - + if not exists (select id from m_savings_account_charge_paid_by sacp where + sacp.savings_account_transaction_id=v_savings_transaction_id and sacp.savings_account_charge_id=t_savings_charge_id) then + -- insert a record into savings account charge paid by INSERT INTO `m_savings_account_charge_paid_by` (`savings_account_transaction_id`, `savings_account_charge_id`, `amount`) VALUES(v_savings_transaction_id, t_savings_charge_id, v_transaction_amount); - + end if; end loop LOOP3; @@ -144,7 +144,7 @@ begin declare cursor1 cursor for - select sa.currency_code, sa.annual_fee_amount + select sa.currency_code, sa.annual_fee_amount from m_savings_account sa where sa.annual_fee_amount is not null and sa.annual_fee_on_month is not null and sa.annual_fee_on_day is not null group by sa.currency_code; declare cursor2 cursor for @@ -154,47 +154,47 @@ begin select sat.id, sat.amount from m_savings_account_transaction sat where sat.savings_account_id=v_account_id and sat.transaction_type_enum=5; - declare continue handler for not found + declare continue handler for not found set no_more_rows := true; open cursor1; LOOP1: loop - fetch cursor1 into v_currency_code, v_annual_fee_amount_charge_def; + fetch cursor1 into v_currency_code, v_annual_fee_amount_charge_def; - if no_more_rows then - close cursor1; - leave LOOP1; - end if; + if no_more_rows then + close cursor1; + leave LOOP1; + end if; - -- set annual fee name - set t_annual_fee_name = CONCAT('Annual fee - ',v_currency_code); - - -- get charge id if already exists - set t_charge_id = (select id from m_charge where name = t_annual_fee_name); + -- set annual fee name + set t_annual_fee_name = CONCAT('Annual fee - ',v_currency_code); - if t_charge_id is null then + -- get charge id if already exists + set t_charge_id = (select id from m_charge where name = t_annual_fee_name); - -- add annual fee to charges - INSERT INTO `m_charge` (`name`, `currency_code`, `charge_applies_to_enum`, `charge_time_enum`, `charge_calculation_enum`, `charge_payment_mode_enum`, `amount`, `is_penalty`, `is_active`, `is_deleted`) VALUES (t_annual_fee_name, v_currency_code, 2, 6, 1, 0, v_annual_fee_amount_charge_def, 0, 1, 0); + if t_charge_id is null then - -- get inserted charge id - set t_charge_id = last_insert_id(); + -- add annual fee to charges + INSERT INTO `m_charge` (`name`, `currency_code`, `charge_applies_to_enum`, `charge_time_enum`, `charge_calculation_enum`, `charge_payment_mode_enum`, `amount`, `is_penalty`, `is_active`, `is_deleted`) VALUES (t_annual_fee_name, v_currency_code, 2, 6, 1, 0, v_annual_fee_amount_charge_def, 0, 1, 0); - end if; + -- get inserted charge id + set t_charge_id = last_insert_id(); - open cursor2; + end if; + + open cursor2; LOOP2: loop - fetch cursor2 into v_account_id, v_annual_fee_amount, v_annual_fee_on_month, v_annual_fee_on_day, v_annual_fee_next_due_date; + fetch cursor2 into v_account_id, v_annual_fee_amount, v_annual_fee_on_month, v_annual_fee_on_day, v_annual_fee_next_due_date; - if no_more_rows then - set no_more_rows := false; - close cursor2; - leave LOOP2; + if no_more_rows then + set no_more_rows := false; + close cursor2; + leave LOOP2; end if; - if not exists (select id from m_savings_account_charge sac where - sac.savings_account_id=v_account_id and sac.charge_id=t_charge_id and sac.charge_time_enum=6) then - + if not exists (select id from m_savings_account_charge sac where + sac.savings_account_id=v_account_id and sac.charge_id=t_charge_id and sac.charge_time_enum=6) then + -- attach annual charge to savings INSERT INTO `m_savings_account_charge` (`savings_account_id`, `charge_id`, `is_penalty`, `charge_time_enum`, `charge_due_date`, `fee_on_month`, `fee_on_day`, `charge_calculation_enum`, `calculation_percentage`, `calculation_on_amount`, `amount`, `amount_paid_derived`, `amount_waived_derived`, `amount_writtenoff_derived`, `amount_outstanding_derived`, `is_paid_derived`, `waived`, `is_active`) VALUES (v_account_id, t_charge_id, 0, 6, v_annual_fee_next_due_date, v_annual_fee_on_month, v_annual_fee_on_day, 1, NULL, NULL, v_annual_fee_amount, NULL, NULL, NULL, v_annual_fee_amount, 0, 0, 1); @@ -202,27 +202,27 @@ begin set t_savings_charge_id = last_insert_id(); else - - set t_savings_charge_id = (select id from m_savings_account_charge sac where sac.savings_account_id=v_account_id and sac.charge_id=t_charge_id and sac.charge_time_enum=6); + + set t_savings_charge_id = (select id from m_savings_account_charge sac where sac.savings_account_id=v_account_id and sac.charge_id=t_charge_id and sac.charge_time_enum=6); end if; open cursor3; LOOP3: loop - fetch cursor3 into v_savings_transaction_id, v_transaction_amount; - - if no_more_rows then - set no_more_rows := false; - close cursor3; - leave LOOP3; + fetch cursor3 into v_savings_transaction_id, v_transaction_amount; + + if no_more_rows then + set no_more_rows := false; + close cursor3; + leave LOOP3; end if; - if not exists (select id from m_savings_account_charge_paid_by sacp where - sacp.savings_account_transaction_id=v_savings_transaction_id and sacp.savings_account_charge_id=t_savings_charge_id) then - + if not exists (select id from m_savings_account_charge_paid_by sacp where + sacp.savings_account_transaction_id=v_savings_transaction_id and sacp.savings_account_charge_id=t_savings_charge_id) then + -- insert a record into savings account charge paid by INSERT INTO `m_savings_account_charge_paid_by` (`savings_account_transaction_id`, `savings_account_charge_id`, `amount`) VALUES(v_savings_transaction_id, t_savings_charge_id, v_transaction_amount); - + end if; end loop LOOP3; diff --git a/mifosng-db/migrations/core_db/V118_8__track_overpayments_seperately_in_loan_transactions.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V118_8__track_overpayments_seperately_in_loan_transactions.sql similarity index 94% rename from mifosng-db/migrations/core_db/V118_8__track_overpayments_seperately_in_loan_transactions.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V118_8__track_overpayments_seperately_in_loan_transactions.sql index cdaac34d9..8ff31eaa5 100644 --- a/mifosng-db/migrations/core_db/V118_8__track_overpayments_seperately_in_loan_transactions.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V118_8__track_overpayments_seperately_in_loan_transactions.sql @@ -3,7 +3,7 @@ ALTER TABLE `m_loan_transaction` ADD COLUMN `overpayment_portion_derived` DECIMAL(19,6) NULL DEFAULT NULL AFTER `penalty_charges_portion_derived`; /**Add dummy liability account if organization already has a loan product with accounting enabled**/ -INSERT INTO `acc_gl_account` (`name`, `hierarchy`, `gl_code`,`account_usage`, `classification_enum`,`description`) +INSERT INTO `acc_gl_account` (`name`, `hierarchy`, `gl_code`,`account_usage`, `classification_enum`,`description`) select 'Loan Overpayments (Temp)', '.', '22000-Temp', 1, 2,'Temporary account to track Loan overpayments Liabilities' FROM m_product_loan WHERE accounting_type != 1 limit 1; diff --git a/mifosng-db/migrations/core_db/V118__savings_charge.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V118__savings_charge.sql similarity index 100% rename from mifosng-db/migrations/core_db/V118__savings_charge.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V118__savings_charge.sql diff --git a/mifosng-db/migrations/core_db/V119__add_template_table.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V119__add_template_table.sql similarity index 94% rename from mifosng-db/migrations/core_db/V119__add_template_table.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V119__add_template_table.sql index 190af26ba..2454a205d 100644 --- a/mifosng-db/migrations/core_db/V119__add_template_table.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V119__add_template_table.sql @@ -7,7 +7,7 @@ CREATE TABLE `m_template` ( `type` int(11) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `unq_name` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `m_templatemappers`; CREATE TABLE `m_templatemappers` ( @@ -27,7 +27,7 @@ CREATE TABLE `m_template_m_templatemappers` ( KEY (`m_template_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('organistion', 'DELETE_TEMPLATE', 'TEMPLATE', 'DELETE', 0), ('organistion', 'CREATE_TEMPLATE', 'TEMPLATE', 'CREATE', 0), ('organistion', 'UPDATE_TEMPLATE', 'TEMPLATE', 'UPDATE', 0), diff --git a/mifosng-db/migrations/core_db/V11__add-payment-details.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V11__add-payment-details.sql similarity index 99% rename from mifosng-db/migrations/core_db/V11__add-payment-details.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V11__add-payment-details.sql index 02fc1f5e3..22aed1fb9 100755 --- a/mifosng-db/migrations/core_db/V11__add-payment-details.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V11__add-payment-details.sql @@ -22,6 +22,3 @@ Update loan transaction to add a link to transaction detail table ALTER TABLE `m_loan_transaction` ADD COLUMN `payment_detail_id` BIGINT(20) NULL AFTER `loan_id`, ADD CONSTRAINT `FK_m_loan_transaction_m_payment_detail` FOREIGN KEY (`payment_detail_id`) REFERENCES `m_payment_detail` (`id`); - - - diff --git a/mifosng-db/migrations/core_db/V120__accounting_running_balance.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V120__accounting_running_balance.sql similarity index 99% rename from mifosng-db/migrations/core_db/V120__accounting_running_balance.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V120__accounting_running_balance.sql index 93694a15c..6d338d994 100755 --- a/mifosng-db/migrations/core_db/V120__accounting_running_balance.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V120__accounting_running_balance.sql @@ -1,5 +1,5 @@ ALTER TABLE `acc_gl_journal_entry` ADD COLUMN `is_running_balance_caculated` TINYINT NOT NULL DEFAULT '0' AFTER `lastmodified_date`, ADD COLUMN `office_running_balance` DECIMAL(19,6) NOT NULL DEFAULT '0.000000' AFTER `is_running_balance_caculated`; - + INSERT INTO `job` (`name`, `display_name`, `cron_expression`, `create_time`, `task_priority`, `group_name`, `previous_run_start_time`, `next_run_time`, `job_key`, `initializing_errorlog`, `is_active`, `currently_running`, `updates_allowed`, `scheduler_group`, `is_misfired`) VALUES ('Update Accounting Running Balances', 'Update Accounting Running Balances', '0 1 0 1/1 * ? *', now(), 5, NULL, NULL, NULL, NULL, NULL, 1, 0, 1, 0, 0); diff --git a/mifosng-db/migrations/core_db/V121__accounting_running_balance_for_organization.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V121__accounting_running_balance_for_organization.sql similarity index 99% rename from mifosng-db/migrations/core_db/V121__accounting_running_balance_for_organization.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V121__accounting_running_balance_for_organization.sql index 71aa9eaac..5946090aa 100755 --- a/mifosng-db/migrations/core_db/V121__accounting_running_balance_for_organization.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V121__accounting_running_balance_for_organization.sql @@ -1,4 +1,4 @@ ALTER TABLE `acc_gl_journal_entry` ADD COLUMN `organization_running_balance` DECIMAL(19,6) NOT NULL DEFAULT '0.000000' AFTER `office_running_balance`; - + INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('accounting', 'UPDATERUNNINGBALANCE_JOURNALENTRY', 'JOURNALENTRY', 'UPDATERUNNINGBALANCE', 0); diff --git a/mifosng-db/migrations/core_db/V122__recurring_fee_support_for_savings.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V122__recurring_fee_support_for_savings.sql similarity index 100% rename from mifosng-db/migrations/core_db/V122__recurring_fee_support_for_savings.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V122__recurring_fee_support_for_savings.sql diff --git a/mifosng-db/migrations/core_db/V123__remove_payment_mode_for_savings.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V123__remove_payment_mode_for_savings.sql similarity index 100% rename from mifosng-db/migrations/core_db/V123__remove_payment_mode_for_savings.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V123__remove_payment_mode_for_savings.sql diff --git a/mifosng-db/migrations/core_db/V124__added_min_max_cap_for_charges.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V124__added_min_max_cap_for_charges.sql similarity index 78% rename from mifosng-db/migrations/core_db/V124__added_min_max_cap_for_charges.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V124__added_min_max_cap_for_charges.sql index eb762a805..eac4db778 100755 --- a/mifosng-db/migrations/core_db/V124__added_min_max_cap_for_charges.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V124__added_min_max_cap_for_charges.sql @@ -1,8 +1,7 @@ -ALTER TABLE `m_charge` -ADD COLUMN `min_cap` DECIMAL(19,6) NULL AFTER `is_deleted`, -ADD COLUMN `max_cap` DECIMAL(19,6) NULL AFTER `min_cap`; - -ALTER TABLE `m_loan_charge` -ADD COLUMN `min_cap` DECIMAL(19,6) NULL AFTER `waived`, -ADD COLUMN `max_cap` DECIMAL(19,6) NULL AFTER `min_cap`; - +ALTER TABLE `m_charge` +ADD COLUMN `min_cap` DECIMAL(19,6) NULL AFTER `is_deleted`, +ADD COLUMN `max_cap` DECIMAL(19,6) NULL AFTER `min_cap`; + +ALTER TABLE `m_loan_charge` +ADD COLUMN `min_cap` DECIMAL(19,6) NULL AFTER `waived`, +ADD COLUMN `max_cap` DECIMAL(19,6) NULL AFTER `min_cap`; diff --git a/mifosng-db/migrations/core_db/V125__added_column_for_actual_fee_amount_or_percentage.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V125__added_column_for_actual_fee_amount_or_percentage.sql similarity index 100% rename from mifosng-db/migrations/core_db/V125__added_column_for_actual_fee_amount_or_percentage.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V125__added_column_for_actual_fee_amount_or_percentage.sql diff --git a/mifosng-db/migrations/core_db/V126__initial_database_structure_for_sms_outbound.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V126__initial_database_structure_for_sms_outbound.sql similarity index 87% rename from mifosng-db/migrations/core_db/V126__initial_database_structure_for_sms_outbound.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V126__initial_database_structure_for_sms_outbound.sql index 0d2a74798..9257f49a4 100644 --- a/mifosng-db/migrations/core_db/V126__initial_database_structure_for_sms_outbound.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V126__initial_database_structure_for_sms_outbound.sql @@ -17,20 +17,20 @@ CREATE TABLE `sms_messages_outbound` ( -- Permissions for CRUD on SMS outbound message tracking DELETE FROM `m_permission` WHERE `entity_name`='SMS'; -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('organisation', 'READ_SMS', 'SMS', 'READ', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('organisation', 'CREATE_SMS', 'SMS', 'CREATE', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('organisation', 'CREATE_SMS_CHECKER', 'SMS', 'CREATE', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('organisation', 'UPDATE_SMS', 'SMS', 'UPDATE', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('organisation', 'UPDATE_SMS_CHECKER', 'SMS', 'UPDATE', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('organisation', 'DELETE_SMS', 'SMS', 'DELETE', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('organisation', 'DELETE_SMS_CHECKER', 'SMS', 'DELETE', 0); \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V127__mobile_no_fields.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V127__mobile_no_fields.sql similarity index 77% rename from mifosng-db/migrations/core_db/V127__mobile_no_fields.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V127__mobile_no_fields.sql index b5d23bde6..7e9f9b1e5 100644 --- a/mifosng-db/migrations/core_db/V127__mobile_no_fields.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V127__mobile_no_fields.sql @@ -1,8 +1,8 @@ -ALTER TABLE `m_client` -ADD COLUMN `mobile_no` VARCHAR(50) NULL DEFAULT NULL AFTER `display_name`, +ALTER TABLE `m_client` +ADD COLUMN `mobile_no` VARCHAR(50) NULL DEFAULT NULL AFTER `display_name`, ADD UNIQUE INDEX `mobile_no_UNIQUE` (`mobile_no` ASC); -ALTER TABLE `m_staff` -ADD COLUMN `mobile_no` VARCHAR(50) NULL DEFAULT NULL AFTER `display_name`, +ALTER TABLE `m_staff` +ADD COLUMN `mobile_no` VARCHAR(50) NULL DEFAULT NULL AFTER `display_name`, ADD UNIQUE INDEX `mobile_no_UNIQUE` (`mobile_no` ASC); \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V128__added_loan_installment_charge.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V128__added_loan_installment_charge.sql similarity index 100% rename from mifosng-db/migrations/core_db/V128__added_loan_installment_charge.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V128__added_loan_installment_charge.sql diff --git a/mifosng-db/migrations/core_db/V129__client_and_group_timeline.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V129__client_and_group_timeline.sql similarity index 100% rename from mifosng-db/migrations/core_db/V129__client_and_group_timeline.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V129__client_and_group_timeline.sql diff --git a/mifosng-db/migrations/core_db/V12__add_external_id_to_couple_of_tables.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V12__add_external_id_to_couple_of_tables.sql similarity index 60% rename from mifosng-db/migrations/core_db/V12__add_external_id_to_couple_of_tables.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V12__add_external_id_to_couple_of_tables.sql index 964070d58..9803937a6 100644 --- a/mifosng-db/migrations/core_db/V12__add_external_id_to_couple_of_tables.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V12__add_external_id_to_couple_of_tables.sql @@ -1,28 +1,26 @@ -ALTER TABLE m_group +ALTER TABLE m_group ADD UNIQUE INDEX `external_id_UNIQUE` (`external_id` ASC) ; ALTER TABLE m_product_loan - ADD COLUMN `external_id` VARCHAR(100) NULL AFTER `loan_transaction_strategy_id` , - ADD UNIQUE INDEX `external_id_UNIQUE` (`external_id` ASC) ; + ADD COLUMN `external_id` VARCHAR(100) NULL AFTER `loan_transaction_strategy_id` , + ADD UNIQUE INDEX `external_id_UNIQUE` (`external_id` ASC) ; ALTER TABLE m_staff - ADD COLUMN `external_id` VARCHAR(100) NULL AFTER `display_name` , - ADD UNIQUE INDEX `external_id_UNIQUE` (`external_id` ASC) ; + ADD COLUMN `external_id` VARCHAR(100) NULL AFTER `display_name` , + ADD UNIQUE INDEX `external_id_UNIQUE` (`external_id` ASC) ; -/* status_id values for client and group +/* status_id values for client and group 0 - Invalid 100 - Pending 300 - Active 600 - Closed( or Exited) */ -ALTER TABLE m_client - ADD COLUMN `status_id` INT(5) NOT NULL DEFAULT 300 AFTER `is_deleted` ; - - -ALTER TABLE m_group - ADD COLUMN `status_id` INT(5) NOT NULL DEFAULT 300 AFTER `is_deleted` ; +ALTER TABLE m_client + ADD COLUMN `status_id` INT(5) NOT NULL DEFAULT 300 AFTER `is_deleted` ; +ALTER TABLE m_group + ADD COLUMN `status_id` INT(5) NOT NULL DEFAULT 300 AFTER `is_deleted` ; diff --git a/mifosng-db/migrations/core_db/V130__calendar-history-table.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V130__calendar-history-table.sql similarity index 100% rename from mifosng-db/migrations/core_db/V130__calendar-history-table.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V130__calendar-history-table.sql diff --git a/mifosng-db/migrations/core_db/V131__holiday-status-column-and-permissions.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V131__holiday-status-column-and-permissions.sql similarity index 97% rename from mifosng-db/migrations/core_db/V131__holiday-status-column-and-permissions.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V131__holiday-status-column-and-permissions.sql index fca399788..e5268f6db 100644 --- a/mifosng-db/migrations/core_db/V131__holiday-status-column-and-permissions.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V131__holiday-status-column-and-permissions.sql @@ -8,7 +8,7 @@ ALTER TABLE `m_holiday` UPDATE `m_holiday` set `status_enum`=300; INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('organisation', 'CREATE_HOLIDAY_CHECKER', 'HOLIDAY', 'CREATE', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('organisation', 'ACTIVATE_HOLIDAY', 'HOLIDAY', 'ACTIVATE', 0); +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('organisation', 'ACTIVATE_HOLIDAY', 'HOLIDAY', 'ACTIVATE', 0); INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('organisation', 'ACTIVATE_HOLIDAY_CHECKER', 'HOLIDAY', 'ACTIVATE', 0); INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('organisation', 'UPDATE_HOLIDAY', 'HOLIDAY', 'UPDATE', 0); INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('organisation', 'UPDATE_HOLIDAY_CHECKER', 'HOLIDAY', 'UPDATE', 0); diff --git a/mifosng-db/migrations/core_db/V132__borrower_cycle_changes.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V132__borrower_cycle_changes.sql similarity index 100% rename from mifosng-db/migrations/core_db/V132__borrower_cycle_changes.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V132__borrower_cycle_changes.sql diff --git a/mifosng-db/migrations/core_db/V133__adding_payment_detail_with_journal_entry.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V133__adding_payment_detail_with_journal_entry.sql similarity index 99% rename from mifosng-db/migrations/core_db/V133__adding_payment_detail_with_journal_entry.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V133__adding_payment_detail_with_journal_entry.sql index 3e20d4f8a..a434861bd 100755 --- a/mifosng-db/migrations/core_db/V133__adding_payment_detail_with_journal_entry.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V133__adding_payment_detail_with_journal_entry.sql @@ -3,8 +3,7 @@ ALTER TABLE `acc_gl_journal_entry` ADD COLUMN `savings_transaction_id` BIGINT(20) NULL AFTER `loan_transaction_id`, ADD CONSTRAINT `FK_acc_gl_journal_entry_m_loan_transaction` FOREIGN KEY (`loan_transaction_id`) REFERENCES `m_loan_transaction` (`id`), ADD CONSTRAINT `FK_acc_gl_journal_entry_m_savings_account_transaction` FOREIGN KEY (`savings_transaction_id`) REFERENCES `m_savings_account_transaction` (`id`); - + UPDATE acc_gl_journal_entry je SET je.savings_transaction_id=je.transaction_id,je.transaction_id=Concat('S',je.transaction_id) WHERE je.entity_type_enum=2; UPDATE acc_gl_journal_entry je SET je.loan_transaction_id=je.transaction_id,je.transaction_id=Concat('L',je.transaction_id) WHERE je.entity_type_enum=1; - diff --git a/mifosng-db/migrations/core_db/V134_1__submitted_date_updation_for_clients.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V134_1__submitted_date_updation_for_clients.sql similarity index 99% rename from mifosng-db/migrations/core_db/V134_1__submitted_date_updation_for_clients.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V134_1__submitted_date_updation_for_clients.sql index da828085b..962c09560 100755 --- a/mifosng-db/migrations/core_db/V134_1__submitted_date_updation_for_clients.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V134_1__submitted_date_updation_for_clients.sql @@ -3,4 +3,3 @@ UPDATE m_client mc SET mc.submittedon_date=now() where mc.submittedon_date is NU UPDATE m_group mg SET mg.submittedon_date=mg.activation_date where mg.submittedon_date is NULL; UPDATE m_group mg SET mg.submittedon_date=now() where mg.submittedon_date is NULL; - diff --git a/mifosng-db/migrations/core_db/V134_2__permissions_spelling_correction.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V134_2__permissions_spelling_correction.sql similarity index 100% rename from mifosng-db/migrations/core_db/V134_2__permissions_spelling_correction.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V134_2__permissions_spelling_correction.sql diff --git a/mifosng-db/migrations/core_db/V134__added_column_value_on_c_configuration.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V134__added_column_value_on_c_configuration.sql similarity index 78% rename from mifosng-db/migrations/core_db/V134__added_column_value_on_c_configuration.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V134__added_column_value_on_c_configuration.sql index ea7232f53..b66bd6ed6 100755 --- a/mifosng-db/migrations/core_db/V134__added_column_value_on_c_configuration.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V134__added_column_value_on_c_configuration.sql @@ -1,14 +1,12 @@ -ALTER TABLE `c_configuration` -ADD COLUMN `value` INT NULL AFTER `name`; - -INSERT INTO `c_configuration` ( -`id` , -`name` , -`value` , -`enabled` -) -VALUES ( -NULL , 'penalty-wait-period', '2', '1' -); - - +ALTER TABLE `c_configuration` +ADD COLUMN `value` INT NULL AFTER `name`; + +INSERT INTO `c_configuration` ( +`id` , +`name` , +`value` , +`enabled` +) +VALUES ( +NULL , 'penalty-wait-period', '2', '1' +); diff --git a/mifosng-db/migrations/core_db/V135__added_permission_for_undo_written_off.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V135__added_permission_for_undo_written_off.sql similarity index 100% rename from mifosng-db/migrations/core_db/V135__added_permission_for_undo_written_off.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V135__added_permission_for_undo_written_off.sql diff --git a/mifosng-db/migrations/core_db/V136_1__update_script_strechy_parameter.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V136_1__update_script_strechy_parameter.sql similarity index 100% rename from mifosng-db/migrations/core_db/V136_1__update_script_strechy_parameter.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V136_1__update_script_strechy_parameter.sql diff --git a/mifosng-db/migrations/core_db/V137__added_is_active_column_in_m_staff.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V137__added_is_active_column_in_m_staff.sql similarity index 100% rename from mifosng-db/migrations/core_db/V137__added_is_active_column_in_m_staff.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V137__added_is_active_column_in_m_staff.sql diff --git a/mifosng-db/migrations/core_db/V138__add_short_name_for_m_product_loan_and_m_savings_product.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V138__add_short_name_for_m_product_loan_and_m_savings_product.sql similarity index 99% rename from mifosng-db/migrations/core_db/V138__add_short_name_for_m_product_loan_and_m_savings_product.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V138__add_short_name_for_m_product_loan_and_m_savings_product.sql index bab1844ee..656d01250 100644 --- a/mifosng-db/migrations/core_db/V138__add_short_name_for_m_product_loan_and_m_savings_product.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V138__add_short_name_for_m_product_loan_and_m_savings_product.sql @@ -7,7 +7,7 @@ ALTER TABLE `m_product_loan` CHANGE COLUMN `short_name` `short_name` VARCHAR(4) NOT NULL AFTER `id`; ALTER TABLE `m_product_loan` ADD UNIQUE INDEX `unq_short_name` (`short_name`); - + ALTER TABLE `m_savings_product` ADD COLUMN `short_name` VARCHAR(4) NULL DEFAULT NULL AFTER `name`; update m_savings_product set short_name=concat(LEFT(name,2), RIGHT(id,2)) where short_name is null; diff --git a/mifosng-db/migrations/core_db/V139__default_value_for_is_active_updated_to_true_in_m_staff.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V139__default_value_for_is_active_updated_to_true_in_m_staff.sql similarity index 69% rename from mifosng-db/migrations/core_db/V139__default_value_for_is_active_updated_to_true_in_m_staff.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V139__default_value_for_is_active_updated_to_true_in_m_staff.sql index fdbc7dfb1..8706102fa 100644 --- a/mifosng-db/migrations/core_db/V139__default_value_for_is_active_updated_to_true_in_m_staff.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V139__default_value_for_is_active_updated_to_true_in_m_staff.sql @@ -1,3 +1,3 @@ ALTER TABLE `m_staff` - CHANGE COLUMN `is_active` `is_active` TINYINT(1) NOT NULL DEFAULT '1' AFTER `organisational_role_parent_staff_id`; + CHANGE COLUMN `is_active` `is_active` TINYINT(1) NOT NULL DEFAULT '1' AFTER `organisational_role_parent_staff_id`; UPDATE `m_staff` SET `is_active`=1; \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V13__add_group_and_client_pending_configuration.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V13__add_group_and_client_pending_configuration.sql similarity index 60% rename from mifosng-db/migrations/core_db/V13__add_group_and_client_pending_configuration.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V13__add_group_and_client_pending_configuration.sql index e093e89ea..57e6dc98a 100644 --- a/mifosng-db/migrations/core_db/V13__add_group_and_client_pending_configuration.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V13__add_group_and_client_pending_configuration.sql @@ -7,13 +7,13 @@ INSERT INTO c_configuration (`name`, `enabled`) VALUES ('allow-pending-client-st INSERT INTO c_configuration (`name`, `enabled`) VALUES ('allow-pending-group-status', '0'); -INSERT INTO .`r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) - VALUES ('status_id', '0', 'Invalid', 'Invalid'); -INSERT INTO .`r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) - VALUES ('status_id', '100', 'Pending', 'Pending'); -INSERT INTO .`r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) - VALUES ('status_id', '300', 'Active', 'Active'); -INSERT INTO .`r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) - VALUES ('status_id', '600', 'Closed', 'Closed'); -INSERT INTO .`r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) - VALUES ('loan_status_id', '0', 'Invalid', 'Invalid'); \ No newline at end of file +INSERT INTO .`r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) + VALUES ('status_id', '0', 'Invalid', 'Invalid'); +INSERT INTO .`r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) + VALUES ('status_id', '100', 'Pending', 'Pending'); +INSERT INTO .`r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) + VALUES ('status_id', '300', 'Active', 'Active'); +INSERT INTO .`r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) + VALUES ('status_id', '600', 'Closed', 'Closed'); +INSERT INTO .`r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) + VALUES ('loan_status_id', '0', 'Invalid', 'Invalid'); \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V140_1__added_payment_detail_id_in_ac_gl_journal_entry.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V140_1__added_payment_detail_id_in_ac_gl_journal_entry.sql similarity index 100% rename from mifosng-db/migrations/core_db/V140_1__added_payment_detail_id_in_ac_gl_journal_entry.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V140_1__added_payment_detail_id_in_ac_gl_journal_entry.sql diff --git a/mifosng-db/migrations/core_db/V140__added_loan_charge_status.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V140__added_loan_charge_status.sql similarity index 100% rename from mifosng-db/migrations/core_db/V140__added_loan_charge_status.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V140__added_loan_charge_status.sql diff --git a/mifosng-db/migrations/core_db/V141__add_early_repayment_strategy.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V141__add_early_repayment_strategy.sql similarity index 100% rename from mifosng-db/migrations/core_db/V141__add_early_repayment_strategy.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V141__add_early_repayment_strategy.sql diff --git a/mifosng-db/migrations/core_db/V142__read_savingsaccount_charge_permission.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V142__read_savingsaccount_charge_permission.sql similarity index 100% rename from mifosng-db/migrations/core_db/V142__read_savingsaccount_charge_permission.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V142__read_savingsaccount_charge_permission.sql diff --git a/mifosng-db/migrations/core_db/V143__create_journalentry_checker_permission.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V143__create_journalentry_checker_permission.sql similarity index 100% rename from mifosng-db/migrations/core_db/V143__create_journalentry_checker_permission.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V143__create_journalentry_checker_permission.sql diff --git a/mifosng-db/migrations/core_db/V144__spelling_mistake_corrections.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V144__spelling_mistake_corrections.sql similarity index 100% rename from mifosng-db/migrations/core_db/V144__spelling_mistake_corrections.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V144__spelling_mistake_corrections.sql diff --git a/mifosng-db/migrations/core_db/V145__add_force_password_reset_in_c_configuration.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V145__add_force_password_reset_in_c_configuration.sql similarity index 100% rename from mifosng-db/migrations/core_db/V145__add_force_password_reset_in_c_configuration.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V145__add_force_password_reset_in_c_configuration.sql diff --git a/mifosng-db/migrations/core_db/V146__tranche_loans.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V146__tranche_loans.sql similarity index 99% rename from mifosng-db/migrations/core_db/V146__tranche_loans.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V146__tranche_loans.sql index d009bce56..badd9562c 100644 --- a/mifosng-db/migrations/core_db/V146__tranche_loans.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V146__tranche_loans.sql @@ -20,8 +20,8 @@ ALTER TABLE `m_loan` ADD COLUMN `fixed_emi_amount` DECIMAL(19,6) NULL AFTER `loan_product_counter`, ADD COLUMN `approved_principal` DECIMAL(19,6) NOT NULL AFTER `principal_amount`, ADD COLUMN `max_outstanding_loan_balance` DECIMAL(19,6) NULL DEFAULT NULL AFTER `fixed_emi_amount`; - -UPDATE m_loan ml SET ml.approved_principal = ml.principal_amount; + +UPDATE m_loan ml SET ml.approved_principal = ml.principal_amount; INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('portfolio', 'UPDATE_DISBURSEMENTDETAIL', 'DISBURSEMENTDETAIL', 'UPDATE', 0); diff --git a/mifosng-db/migrations/core_db/V147__tranche_loans_column_name_changes.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V147__tranche_loans_column_name_changes.sql similarity index 100% rename from mifosng-db/migrations/core_db/V147__tranche_loans_column_name_changes.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V147__tranche_loans_column_name_changes.sql diff --git a/mifosng-db/migrations/core_db/V148__overdraft_changes.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V148__overdraft_changes.sql similarity index 85% rename from mifosng-db/migrations/core_db/V148__overdraft_changes.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V148__overdraft_changes.sql index c9649a162..cfe7a41db 100755 --- a/mifosng-db/migrations/core_db/V148__overdraft_changes.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V148__overdraft_changes.sql @@ -1,14 +1,14 @@ ALTER TABLE `m_savings_product` ADD COLUMN `allow_overdraft` TINYINT(1) NOT NULL DEFAULT '0' AFTER `withdrawal_fee_for_transfer`, ADD COLUMN `overdraft_limit` DECIMAL(19,6) NULL DEFAULT NULL AFTER `allow_overdraft`; - + ALTER TABLE `m_savings_account` ADD COLUMN `allow_overdraft` TINYINT(1) NOT NULL DEFAULT '0' AFTER `withdrawal_fee_for_transfer`, - ADD COLUMN `overdraft_limit` DECIMAL(19,6) NULL DEFAULT NULL AFTER `allow_overdraft`; - + ADD COLUMN `overdraft_limit` DECIMAL(19,6) NULL DEFAULT NULL AFTER `allow_overdraft`; + ALTER TABLE `m_savings_account_transaction` - ADD COLUMN `overdraft_amount_derived` DECIMAL(19,6) NULL DEFAULT NULL AFTER `amount`; - + ADD COLUMN `overdraft_amount_derived` DECIMAL(19,6) NULL DEFAULT NULL AFTER `amount`; + ALTER TABLE `m_client` ADD COLUMN `default_savings_product` BIGINT(20) NULL DEFAULT NULL AFTER `closedon_userid`, - ADD CONSTRAINT `FK_m_client_m_savings_product` FOREIGN KEY (`default_savings_product`) REFERENCES `m_savings_product` (`id`); \ No newline at end of file + ADD CONSTRAINT `FK_m_client_m_savings_product` FOREIGN KEY (`default_savings_product`) REFERENCES `m_savings_product` (`id`); \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V149__add_created_date_savings_transaction.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V149__add_created_date_savings_transaction.sql similarity index 89% rename from mifosng-db/migrations/core_db/V149__add_created_date_savings_transaction.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V149__add_created_date_savings_transaction.sql index 85ffedd80..7af5f3c14 100755 --- a/mifosng-db/migrations/core_db/V149__add_created_date_savings_transaction.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V149__add_created_date_savings_transaction.sql @@ -1,4 +1,4 @@ ALTER TABLE `m_savings_account_transaction` ADD COLUMN `created_date` DATETIME NOT NULL AFTER `cumulative_balance_derived`; - -update m_savings_account_transaction sat set sat.created_date=sat.transaction_date; \ No newline at end of file + +update m_savings_account_transaction sat set sat.created_date=sat.transaction_date; \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V14__rename_status_id_to_enum.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V14__rename_status_id_to_enum.sql similarity index 100% rename from mifosng-db/migrations/core_db/V14__rename_status_id_to_enum.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V14__rename_status_id_to_enum.sql diff --git a/mifosng-db/migrations/core_db/V150__basic_savings_report.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V150__basic_savings_report.sql similarity index 99% rename from mifosng-db/migrations/core_db/V150__basic_savings_report.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V150__basic_savings_report.sql index c919830d7..0b17ade06 100755 --- a/mifosng-db/migrations/core_db/V150__basic_savings_report.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V150__basic_savings_report.sql @@ -28,5 +28,3 @@ INSERT INTO `r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `en INSERT INTO `r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`, `enum_type`) VALUES ('savings_transaction_type_enum', 15, 'Reject Transfer', 'Reject Transfer', 0); INSERT INTO `r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`, `enum_type`) VALUES ('savings_transaction_type_enum', 16, 'Written-Off', 'Written-Off', 0); INSERT INTO `r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`, `enum_type`) VALUES ('savings_transaction_type_enum', 17, 'Overdraft Interest', 'Overdraft Interest', 0); - - diff --git a/mifosng-db/migrations/core_db/V151__add_default_savings_account_to_client.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V151__add_default_savings_account_to_client.sql similarity index 100% rename from mifosng-db/migrations/core_db/V151__add_default_savings_account_to_client.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V151__add_default_savings_account_to_client.sql diff --git a/mifosng-db/migrations/core_db/V152__added_grace_for_over_due.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V152__added_grace_for_over_due.sql similarity index 100% rename from mifosng-db/migrations/core_db/V152__added_grace_for_over_due.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V152__added_grace_for_over_due.sql diff --git a/mifosng-db/migrations/core_db/V153__Insert_missed_permissions.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V153__Insert_missed_permissions.sql similarity index 100% rename from mifosng-db/migrations/core_db/V153__Insert_missed_permissions.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V153__Insert_missed_permissions.sql diff --git a/mifosng-db/migrations/core_db/V154__aging_details.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V154__aging_details.sql similarity index 100% rename from mifosng-db/migrations/core_db/V154__aging_details.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V154__aging_details.sql diff --git a/mifosng-db/migrations/core_db/V155__stretchy_into_pentaho.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V155__stretchy_into_pentaho.sql similarity index 92% rename from mifosng-db/migrations/core_db/V155__stretchy_into_pentaho.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V155__stretchy_into_pentaho.sql index 32ca191f7..63865a715 100644 --- a/mifosng-db/migrations/core_db/V155__stretchy_into_pentaho.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V155__stretchy_into_pentaho.sql @@ -26,694 +26,693 @@ INSERT INTO stretchy_report (report_name, report_type, report_category, report_s INSERT INTO stretchy_report (report_name, report_type, report_category, report_sql, description, core_report, use_report) VALUES ("Written-Off Loans(Pentaho)", 'Pentaho', 'Loan', '(NULL)', '(NULL)', 1, 1); INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans - Details(Pentaho)'),(select sp.id from stretchy_parameter sp where sp.parameter_name='OfficeIdSelectOne'),'branch'); - + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans - Details(Pentaho)'),(select sp.id from stretchy_parameter sp where sp.parameter_name='loanOfficerIdSelectAll'), 'loanOfficer'); - + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans - Details(Pentaho)'),(select sp.id from stretchy_parameter sp where sp.parameter_name='currencyIdSelectAll'), 'currencyId'); INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans - Details(Pentaho)'),(select sp.id from stretchy_parameter sp where sp.parameter_name='fundIdSelectAll'),'fundId'); - + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans - Details(Pentaho)'),(select sp.id from stretchy_parameter sp where sp.parameter_name='loanProductIdSelectAll'), 'loanProductId'); INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans - Details(Pentaho)'),(select sp.id from stretchy_parameter sp where sp.parameter_name='loanPurposeIdSelectAll'),'loanPurposeId'); -INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) +INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans - Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='OfficeIdSelectOne'), 'Branch'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans - Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanOfficerIdSelectAll'), 'loanOfficer'); - - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans - Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='currencyIdSelectAll'), 'CurrencyId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans - Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='fundIdSelectAll'), 'fundId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans - Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanProductIdSelectAll'), 'loanProductId'); - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans - Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanPurposeIdSelectAll'), 'loanPurposeId'); - - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans - Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='parTypeSelect'), 'parType'); -INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) +INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans by Disbursal Period(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='OfficeIdSelectOne'), 'Branch'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans by Disbursal Period(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanOfficerIdSelectAll'), 'loanOfficer'); - - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans by Disbursal Period(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='currencyIdSelectAll'), 'CurrencyId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans by Disbursal Period(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='fundIdSelectAll'), 'fundId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans by Disbursal Period(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanProductIdSelectAll'), 'loanProductId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans by Disbursal Period(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanPurposeIdSelectAll'), 'loanPurposeId'); - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans by Disbursal Period(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='startDateSelect'), 'startDate'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans by Disbursal Period(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='endDateSelect'), 'endDate'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans in last installment Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='OfficeIdSelectOne'), 'Branch'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans in last installment Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanOfficerIdSelectAll'), 'Loan Officer'); - - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans in last installment Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='currencyIdSelectAll'), 'CurrencyId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans in last installment Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='fundIdSelectAll'), 'fundId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans in last installment Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanProductIdSelectAll'), 'loanProductId'); - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans in last installment Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanPurposeIdSelectAll'), 'loanPurposeId'); - - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans in last installment Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='parTypeSelect'), 'parType'); - - - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans in last installment(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='OfficeIdSelectOne'), 'Branch'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans in last installment(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanOfficerIdSelectAll'), 'Loan Officer'); - - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans in last installment(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='currencyIdSelectAll'), 'CurrencyId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans in last installment(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='fundIdSelectAll'), 'fundId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans in last installment(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanProductIdSelectAll'), 'loanProductId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans in last installment(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanPurposeIdSelectAll'), 'loanPurposeId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans Passed Final Maturity Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='OfficeIdSelectOne'), 'Branch'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans Passed Final Maturity Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanOfficerIdSelectAll'), 'Loan Officer'); - - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans Passed Final Maturity Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='currencyIdSelectAll'), 'CurrencyId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans Passed Final Maturity Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='fundIdSelectAll'), 'fundId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans Passed Final Maturity Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanProductIdSelectAll'), 'loanProductId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans Passed Final Maturity Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanPurposeIdSelectAll'), 'loanPurposeId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans Passed Final Maturity Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='parTypeSelect'), 'parType'); - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans Passed Final Maturity(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='OfficeIdSelectOne'), 'Branch'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans Passed Final Maturity(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanOfficerIdSelectAll'), 'Loan Officer'); - - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans Passed Final Maturity(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='currencyIdSelectAll'), 'CurrencyId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans Passed Final Maturity(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='fundIdSelectAll'), 'fundId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans Passed Final Maturity(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanProductIdSelectAll'), 'loanProductId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Active Loans Passed Final Maturity(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanPurposeIdSelectAll'), 'loanPurposeId'); - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Aging Detail(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='OfficeIdSelectOne'), 'Branch'); -INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) +INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Aging Summary (Arrears in Months)(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='OfficeIdSelectOne'), 'Branch'); - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Aging Summary (Arrears in Months)(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='currencyIdSelectAll'), - 'CurrencyId'); - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + 'CurrencyId'); + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Aging Summary (Arrears in Weeks)(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='OfficeIdSelectOne'), 'Branch'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Aging Summary (Arrears in Weeks)(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='currencyIdSelectAll'), 'CurrencyId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Client Listing(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='OfficeIdSelectOne'), 'selectOffice'); -INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) +INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Client Loans Listing(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='OfficeIdSelectOne'), 'Branch'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Client Loans Listing(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanOfficerIdSelectAll'), 'Loan Officer'); - - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Client Loans Listing(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='currencyIdSelectAll'), 'CurrencyId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Client Loans Listing(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='fundIdSelectAll'), 'fundId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Client Loans Listing(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanProductIdSelectAll'), 'loanProductId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Client Loans Listing(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanPurposeIdSelectAll'), 'loanPurposeId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Expected Payments By Date - Basic(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='OfficeIdSelectOne'), 'Branch'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Expected Payments By Date - Basic(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanOfficerIdSelectAll'), 'Loan Officer'); - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Expected Payments By Date - Basic(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='startDateSelect'), 'startDate'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Expected Payments By Date - Basic(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='endDateSelect'), 'endDate'); - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Funds Disbursed Between Dates Summary by Office(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='OfficeIdSelectOne'), 'Branch'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Funds Disbursed Between Dates Summary by Office(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='currencyIdSelectAll'), 'CurrencyId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Funds Disbursed Between Dates Summary by Office(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='fundIdSelectAll'), 'fundId'); - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Funds Disbursed Between Dates Summary by Office(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='startDateSelect'), 'startDate'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Funds Disbursed Between Dates Summary by Office(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='endDateSelect'), 'endDate'); - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Funds Disbursed Between Dates Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='currencyIdSelectAll'), 'CurrencyId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Funds Disbursed Between Dates Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='fundIdSelectAll'), 'fundId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Funds Disbursed Between Dates Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='startDateSelect'), 'startDate'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Funds Disbursed Between Dates Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='endDateSelect'), 'endDate'); - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Loans Awaiting Disbursal Summary by Month(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='OfficeIdSelectOne'), 'Branch'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Loans Awaiting Disbursal Summary by Month(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanOfficerIdSelectAll'), 'Loan Officer'); - - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Loans Awaiting Disbursal Summary by Month(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='currencyIdSelectAll'), 'CurrencyId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Loans Awaiting Disbursal Summary by Month(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='fundIdSelectAll'), 'fundId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Loans Awaiting Disbursal Summary by Month(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanProductIdSelectAll'), 'loanProductId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Loans Awaiting Disbursal Summary by Month(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanPurposeIdSelectAll'), 'loanPurposeId'); - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Loans Awaiting Disbursal Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='OfficeIdSelectOne'), 'Branch'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Loans Awaiting Disbursal Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanOfficerIdSelectAll'), 'Loan Officer'); - - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Loans Awaiting Disbursal Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='currencyIdSelectAll'), 'CurrencyId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Loans Awaiting Disbursal Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='fundIdSelectAll'), 'fundId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Loans Awaiting Disbursal Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanProductIdSelectAll'), 'loanProductId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Loans Awaiting Disbursal Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanPurposeIdSelectAll'), 'loanPurposeId'); - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Loans Awaiting Disbursal(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='OfficeIdSelectOne'), 'Branch'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Loans Awaiting Disbursal(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanOfficerIdSelectAll'), 'Loan Officer'); - - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Loans Awaiting Disbursal(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='currencyIdSelectAll'), 'CurrencyId'); - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Loans Awaiting Disbursal(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='fundIdSelectAll'), 'fundId'); - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Loans Awaiting Disbursal(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanProductIdSelectAll'), 'loanProductId'); - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Loans Awaiting Disbursal(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanPurposeIdSelectAll'), 'loanPurposeId'); - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Loans Pending Approval(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='OfficeIdSelectOne'), 'Branch'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Loans Pending Approval(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanOfficerIdSelectAll'), 'Loan Officer'); - - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Loans Pending Approval(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='currencyIdSelectAll'), 'CurrencyId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Loans Pending Approval(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='fundIdSelectAll'), 'fundId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Loans Pending Approval(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanProductIdSelectAll'), 'loanProductId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Loans Pending Approval(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanPurposeIdSelectAll'), 'loanPurposeId'); - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Obligation Met Loans Details(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='OfficeIdSelectOne'), 'Branch'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Obligation Met Loans Details(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanOfficerIdSelectAll'), 'Loan Officer'); - - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Obligation Met Loans Details(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='currencyIdSelectAll'), 'CurrencyId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Obligation Met Loans Details(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='fundIdSelectAll'), 'fundId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Obligation Met Loans Details(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanProductIdSelectAll'), 'loanProductId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Obligation Met Loans Details(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanPurposeIdSelectAll'), 'loanPurposeId'); - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Obligation Met Loans Details(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='startDateSelect'), 'startDate'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Obligation Met Loans Details(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='endDateSelect'), 'endDate'); - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Obligation Met Loans Details(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='obligDateTypeSelect'), 'obligDateType'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Obligation Met Loans Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='OfficeIdSelectOne'), 'Branch'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Obligation Met Loans Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanOfficerIdSelectAll'), 'Loan Officer'); - - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Obligation Met Loans Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='currencyIdSelectAll'), 'CurrencyId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Obligation Met Loans Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='fundIdSelectAll'), 'fundId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Obligation Met Loans Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanProductIdSelectAll'), 'loanProductId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Obligation Met Loans Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanPurposeIdSelectAll'), 'loanPurposeId'); - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Obligation Met Loans Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='startDateSelect'), 'Startdate'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Obligation Met Loans Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='endDateSelect'), 'Enddate'); - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Obligation Met Loans Summary(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='obligDateTypeSelect'), 'obligDateType'); - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Portfolio at Risk by Branch(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='OfficeIdSelectOne'), 'Branch'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Portfolio at Risk by Branch(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanOfficerIdSelectAll'), 'Loan Officer'); - - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Portfolio at Risk by Branch(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='currencyIdSelectAll'), 'CurrencyId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Portfolio at Risk by Branch(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='fundIdSelectAll'), 'fundId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Portfolio at Risk by Branch(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanProductIdSelectAll'), 'loanProductId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Portfolio at Risk by Branch(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanPurposeIdSelectAll'), 'loanPurposeId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Portfolio at Risk by Branch(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='parTypeSelect'), 'parType'); - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Portfolio at Risk(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='OfficeIdSelectOne'), 'Branch'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Portfolio at Risk(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanOfficerIdSelectAll'), 'loanOfficer'); - - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Portfolio at Risk(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='currencyIdSelectAll'), 'CurrencyId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Portfolio at Risk(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='fundIdSelectAll'), 'fundId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Portfolio at Risk(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanProductIdSelectAll'), 'loanProductId'); - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Portfolio at Risk(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanPurposeIdSelectAll'), 'loanPurposeId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Portfolio at Risk(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='parTypeSelect'), 'parType'); - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Rescheduled Loans(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='OfficeIdSelectOne'), 'Branch'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Rescheduled Loans(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='currencyIdSelectAll'), 'CurrencyId'); - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Rescheduled Loans(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanProductIdSelectAll'), 'loanProductId'); -INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) +INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Rescheduled Loans(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='startDateSelect'), 'startDate'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Rescheduled Loans(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='endDateSelect'), 'endDate'); -INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) +INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='TxnRunningBalances(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='OfficeIdSelectOne'), 'Branch'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='TxnRunningBalances(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanOfficerIdSelectAll'), 'Loan Officer'); - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='TxnRunningBalances(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='startDateSelect'), 'startDate'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='TxnRunningBalances(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='endDateSelect'), 'endDate'); - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Written-Off Loans(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='OfficeIdSelectOne'), 'Branch'); - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Written-Off Loans(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='currencyIdSelectAll'), 'CurrencyId'); - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Written-Off Loans(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='loanProductIdSelectAll'), 'loanProductId'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Written-Off Loans(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='startDateSelect'), 'startDate'); - - INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) + + INSERT INTO stretchy_report_parameter (report_id, parameter_id, report_parameter_name) VALUES ((select sr.id From stretchy_report sr where sr.report_name='Written-Off Loans(Pentaho)'), (select sp.id from stretchy_parameter sp where sp.parameter_name='endDateSelect'), 'endDate'); - - \ No newline at end of file + diff --git a/mifosng-db/migrations/core_db/V156__added_loan_saving_txns_pentaho.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V156__added_loan_saving_txns_pentaho.sql similarity index 100% rename from mifosng-db/migrations/core_db/V156__added_loan_saving_txns_pentaho.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V156__added_loan_saving_txns_pentaho.sql diff --git a/mifosng-db/migrations/core_db/V157__overdue_charge_improvements.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V157__overdue_charge_improvements.sql similarity index 99% rename from mifosng-db/migrations/core_db/V157__overdue_charge_improvements.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V157__overdue_charge_improvements.sql index 4aaa9a8ad..37a2ee52f 100755 --- a/mifosng-db/migrations/core_db/V157__overdue_charge_improvements.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V157__overdue_charge_improvements.sql @@ -1,6 +1,6 @@ ALTER TABLE `m_charge` ADD COLUMN `fee_frequency` SMALLINT(5) NULL DEFAULT NULL AFTER `max_cap`; - + CREATE TABLE `m_loan_overdue_installment_charge` ( `id` BIGINT(20) NOT NULL AUTO_INCREMENT, `loan_charge_id` BIGINT(20) NOT NULL, diff --git a/mifosng-db/migrations/core_db/V158__dashboard_and_navigation_queries.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V158__dashboard_and_navigation_queries.sql similarity index 100% rename from mifosng-db/migrations/core_db/V158__dashboard_and_navigation_queries.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V158__dashboard_and_navigation_queries.sql diff --git a/mifosng-db/migrations/core_db/V159__add_transaction_id_column_m_portfolio_command_source.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V159__add_transaction_id_column_m_portfolio_command_source.sql similarity index 100% rename from mifosng-db/migrations/core_db/V159__add_transaction_id_column_m_portfolio_command_source.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V159__add_transaction_id_column_m_portfolio_command_source.sql diff --git a/mifosng-db/migrations/core_db/V15__center_permissions.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V15__center_permissions.sql similarity index 100% rename from mifosng-db/migrations/core_db/V15__center_permissions.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V15__center_permissions.sql diff --git a/mifosng-db/migrations/core_db/V160_2__Allow_nullValue_For_principal_on_lonProduct.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V160_2__Allow_nullValue_For_principal_on_lonProduct.sql similarity index 100% rename from mifosng-db/migrations/core_db/V160_2__Allow_nullValue_For_principal_on_lonProduct.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V160_2__Allow_nullValue_For_principal_on_lonProduct.sql diff --git a/mifosng-db/migrations/core_db/V160__standing_instruction_changes.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V160__standing_instruction_changes.sql similarity index 99% rename from mifosng-db/migrations/core_db/V160__standing_instruction_changes.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V160__standing_instruction_changes.sql index 4fa97b1fa..b0918a9cc 100755 --- a/mifosng-db/migrations/core_db/V160__standing_instruction_changes.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V160__standing_instruction_changes.sql @@ -113,7 +113,7 @@ ALTER TABLE `m_account_transfer_details` DROP COLUMN `currency_multiplesof`, DROP COLUMN `amount`, DROP COLUMN `description`; - + DROP TABLE `m_savings_account_transfer`; INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('account_transfer', 'READ_STANDINGINSTRUCTION ', 'STANDINGINSTRUCTION ', 'READ', 0); @@ -123,4 +123,3 @@ INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `c INSERT INTO `job` (`name`, `display_name`, `cron_expression`, `create_time`, `task_priority`, `group_name`, `previous_run_start_time`, `next_run_time`, `job_key`, `initializing_errorlog`, `is_active`, `currently_running`, `updates_allowed`, `scheduler_group`, `is_misfired`) VALUES ('Execute Standing Instruction', 'Execute Standing Instruction', '0 0 0 1/1 * ? *', now(), 5, NULL, NULL, NULL, NULL, NULL, 1, 0, 1, 0, 0); - diff --git a/mifosng-db/migrations/core_db/V161__added_accrual_batch_job.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V161__added_accrual_batch_job.sql similarity index 99% rename from mifosng-db/migrations/core_db/V161__added_accrual_batch_job.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V161__added_accrual_batch_job.sql index 70c288067..06c88d3d7 100755 --- a/mifosng-db/migrations/core_db/V161__added_accrual_batch_job.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V161__added_accrual_batch_job.sql @@ -2,5 +2,5 @@ ALTER TABLE `m_loan_repayment_schedule` ADD COLUMN `accrual_interest_derived` DECIMAL(19,6) NULL DEFAULT NULL AFTER `interest_waived_derived`, ADD COLUMN `accrual_fee_charges_derived` DECIMAL(19,6) NULL DEFAULT NULL AFTER `fee_charges_waived_derived`, ADD COLUMN `accrual_penalty_charges_derived` DECIMAL(19,6) NULL DEFAULT NULL AFTER `penalty_charges_waived_derived`; - + INSERT INTO `job` (`name`, `display_name`, `cron_expression`, `create_time`, `task_priority`, `group_name`, `previous_run_start_time`, `next_run_time`, `job_key`, `initializing_errorlog`, `is_active`, `currently_running`, `updates_allowed`, `scheduler_group`, `is_misfired`) VALUES ('Add Accrual Transactions', 'Add Accrual Transactions', '0 1 0 1/1 * ? *', now(), 5, NULL, NULL, NULL, NULL, NULL, 1, 0, 1, 0, 0); diff --git a/mifosng-db/migrations/core_db/V162__overdue_charge_batch_job.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V162__overdue_charge_batch_job.sql similarity index 100% rename from mifosng-db/migrations/core_db/V162__overdue_charge_batch_job.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V162__overdue_charge_batch_job.sql diff --git a/mifosng-db/migrations/core_db/V163__added_npa_for_loans.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V163__added_npa_for_loans.sql similarity index 99% rename from mifosng-db/migrations/core_db/V163__added_npa_for_loans.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V163__added_npa_for_loans.sql index 2bb528a11..cd86d3abe 100755 --- a/mifosng-db/migrations/core_db/V163__added_npa_for_loans.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V163__added_npa_for_loans.sql @@ -1,7 +1,7 @@ ALTER TABLE `m_product_loan` ADD COLUMN `overdue_days_for_npa` SMALLINT(5) NULL DEFAULT NULL AFTER `grace_on_arrears_ageing`; - + ALTER TABLE `m_loan` ADD COLUMN `is_npa` TINYINT(1) NOT NULL DEFAULT '0' AFTER `grace_on_arrears_ageing`; - + INSERT INTO `job` (`name`, `display_name`, `cron_expression`, `create_time`) VALUES ('Update Non Performing Assets', 'Update Non Performing Assets', '0 0 0 1/1 * ? *', now()); \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V164__fd_and_rd_deposit_tables.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V164__fd_and_rd_deposit_tables.sql similarity index 100% rename from mifosng-db/migrations/core_db/V164__fd_and_rd_deposit_tables.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V164__fd_and_rd_deposit_tables.sql diff --git a/mifosng-db/migrations/core_db/V165__added_permission_for_disburse_to_saving_account.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V165__added_permission_for_disburse_to_saving_account.sql similarity index 100% rename from mifosng-db/migrations/core_db/V165__added_permission_for_disburse_to_saving_account.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V165__added_permission_for_disburse_to_saving_account.sql diff --git a/mifosng-db/migrations/core_db/V166__added_deposit_amount_to_product_term_and_preclosure.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V166__added_deposit_amount_to_product_term_and_preclosure.sql similarity index 83% rename from mifosng-db/migrations/core_db/V166__added_deposit_amount_to_product_term_and_preclosure.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V166__added_deposit_amount_to_product_term_and_preclosure.sql index 75127561d..bb8e210fb 100644 --- a/mifosng-db/migrations/core_db/V166__added_deposit_amount_to_product_term_and_preclosure.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V166__added_deposit_amount_to_product_term_and_preclosure.sql @@ -1,6 +1,6 @@ -ALTER TABLE `m_deposit_product_term_and_preclosure` - ADD COLUMN `min_deposit_amount` DECIMAL(19,6) NULL DEFAULT NULL, - ADD COLUMN `max_deposit_amount` DECIMAL(19,6) NULL DEFAULT NULL, +ALTER TABLE `m_deposit_product_term_and_preclosure` + ADD COLUMN `min_deposit_amount` DECIMAL(19,6) NULL DEFAULT NULL, + ADD COLUMN `max_deposit_amount` DECIMAL(19,6) NULL DEFAULT NULL, ADD COLUMN `deposit_amount` DECIMAL(19,6) NULL DEFAULT NULL; ALTER TABLE m_deposit_account_term_and_preclosure diff --git a/mifosng-db/migrations/core_db/V167__added_columns_for_writtenOff_loans_recovered.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V167__added_columns_for_writtenOff_loans_recovered.sql similarity index 94% rename from mifosng-db/migrations/core_db/V167__added_columns_for_writtenOff_loans_recovered.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V167__added_columns_for_writtenOff_loans_recovered.sql index 8d4d7429c..a2afaad27 100644 --- a/mifosng-db/migrations/core_db/V167__added_columns_for_writtenOff_loans_recovered.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V167__added_columns_for_writtenOff_loans_recovered.sql @@ -15,7 +15,7 @@ Alter table m_loan add column total_recovered_derived Decimal(19,6); -INSERT INTO `acc_gl_account` (`name`, `hierarchy`, `gl_code`,`account_usage`, `classification_enum`,`description`) +INSERT INTO `acc_gl_account` (`name`, `hierarchy`, `gl_code`,`account_usage`, `classification_enum`,`description`) select 'Loan Recovery (Temp)', '.', '220002-Temp', 1, 4,'Temporary account to track income from Loan recovery' FROM m_product_loan WHERE accounting_type != 1 limit 1; @@ -25,4 +25,3 @@ select (select max(id) from acc_gl_account where classification_enum=4 and accou from acc_product_mapping mapping where mapping.financial_account_type = 4 and mapping.product_type=1 group by mapping.product_id; - diff --git a/mifosng-db/migrations/core_db/V168__added_transfer_fixed_deposit_interest_to_linked_account.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V168__added_transfer_fixed_deposit_interest_to_linked_account.sql similarity index 99% rename from mifosng-db/migrations/core_db/V168__added_transfer_fixed_deposit_interest_to_linked_account.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V168__added_transfer_fixed_deposit_interest_to_linked_account.sql index 9f03d7854..0d412bfbf 100755 --- a/mifosng-db/migrations/core_db/V168__added_transfer_fixed_deposit_interest_to_linked_account.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V168__added_transfer_fixed_deposit_interest_to_linked_account.sql @@ -1,6 +1,6 @@ ALTER TABLE `job_run_history` CHANGE COLUMN `error_message` `error_message` TEXT NULL DEFAULT NULL AFTER `status`; - + ALTER TABLE `m_deposit_account_term_and_preclosure` ADD COLUMN `transfer_interest_to_linked_account` TINYINT(1) NOT NULL DEFAULT '0' AFTER `expected_firstdepositon_date`; diff --git a/mifosng-db/migrations/core_db/V169__update_dashboard_reports_to_core_reports_use_report_to_false.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V169__update_dashboard_reports_to_core_reports_use_report_to_false.sql similarity index 100% rename from mifosng-db/migrations/core_db/V169__update_dashboard_reports_to_core_reports_use_report_to_false.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V169__update_dashboard_reports_to_core_reports_use_report_to_false.sql diff --git a/mifosng-db/migrations/core_db/V16__drop_min_max_column_on_loan_table.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V16__drop_min_max_column_on_loan_table.sql similarity index 100% rename from mifosng-db/migrations/core_db/V16__drop_min_max_column_on_loan_table.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V16__drop_min_max_column_on_loan_table.sql diff --git a/mifosng-db/migrations/core_db/V170__update_deposit_accounts_maturity_details_job.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V170__update_deposit_accounts_maturity_details_job.sql similarity index 100% rename from mifosng-db/migrations/core_db/V170__update_deposit_accounts_maturity_details_job.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V170__update_deposit_accounts_maturity_details_job.sql diff --git a/mifosng-db/migrations/core_db/V171__added_mandatory_savings_and_rd_changes.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V171__added_mandatory_savings_and_rd_changes.sql similarity index 99% rename from mifosng-db/migrations/core_db/V171__added_mandatory_savings_and_rd_changes.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V171__added_mandatory_savings_and_rd_changes.sql index e539eb3cd..c1ba72678 100644 --- a/mifosng-db/migrations/core_db/V171__added_mandatory_savings_and_rd_changes.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V171__added_mandatory_savings_and_rd_changes.sql @@ -23,7 +23,7 @@ ALTER TABLE `m_deposit_account_recurring_detail` DROP COLUMN `recurring_deposit_type_enum`, DROP COLUMN `recurring_deposit_frequency`, DROP COLUMN `recurring_deposit_frequency_type_enum`; - + ALTER TABLE `m_deposit_product_term_and_preclosure` DROP COLUMN `interest_free_period_applicable`, diff --git a/mifosng-db/migrations/core_db/V172__accounting_changes_for_transfers.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V172__accounting_changes_for_transfers.sql similarity index 100% rename from mifosng-db/migrations/core_db/V172__accounting_changes_for_transfers.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V172__accounting_changes_for_transfers.sql diff --git a/mifosng-db/migrations/core_db/V173__ppi.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V173__ppi.sql similarity index 99% rename from mifosng-db/migrations/core_db/V173__ppi.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V173__ppi.sql index 0ed8c9bae..7c11b7dc0 100644 --- a/mifosng-db/migrations/core_db/V173__ppi.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V173__ppi.sql @@ -73,7 +73,7 @@ VALUES VALUES (95, 100); - + CREATE TABLE IF NOT EXISTS `ppi_likelihoods` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, diff --git a/mifosng-db/migrations/core_db/V174__remove_interest_accrual.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V174__remove_interest_accrual.sql similarity index 99% rename from mifosng-db/migrations/core_db/V174__remove_interest_accrual.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V174__remove_interest_accrual.sql index cd4546329..fb0dc10d2 100644 --- a/mifosng-db/migrations/core_db/V174__remove_interest_accrual.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V174__remove_interest_accrual.sql @@ -1,5 +1,3 @@ /**Remove all existing apply interest transaction Types**/ update m_loan_transaction set interest_portion_derived=amount where transaction_type_enum=11; update m_loan_transaction set transaction_type_enum=10 where transaction_type_enum=11; - - diff --git a/mifosng-db/migrations/core_db/V175__added_incentive_interest_rates.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V175__added_incentive_interest_rates.sql similarity index 97% rename from mifosng-db/migrations/core_db/V175__added_incentive_interest_rates.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V175__added_incentive_interest_rates.sql index c785d1a1d..36955154c 100755 --- a/mifosng-db/migrations/core_db/V175__added_incentive_interest_rates.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V175__added_incentive_interest_rates.sql @@ -4,11 +4,11 @@ ALTER TABLE `m_client` ADD CONSTRAINT `FK_m_client_type_m_code_value` FOREIGN KEY (`client_type_cv_id`) REFERENCES `m_code_value` (`id`), ADD CONSTRAINT `FK_m_client_classification_m_code_value` FOREIGN KEY (`client_classification_cv_id`) REFERENCES `m_code_value` (`id`), ADD CONSTRAINT `FK1_m_client_gender_m_code_value` FOREIGN KEY (`gender_cv_id`) REFERENCES `m_code_value` (`id`); - + INSERT INTO `m_code` (`code_name`, `is_system_defined`) VALUES ('ClientType', 1); INSERT INTO `m_code` (`code_name`, `is_system_defined`) VALUES ('ClientClassification', 1); - - + + CREATE TABLE `m_interest_incentives` ( `id` BIGINT(20) NOT NULL AUTO_INCREMENT, `interest_rate_slab_id` BIGINT(20) NOT NULL, @@ -46,4 +46,4 @@ ALTER TABLE `m_interest_rate_slab` ALTER TABLE `m_savings_account_interest_rate_slab` DROP COLUMN `interest_rate_for_female`, DROP COLUMN `interest_rate_for_children`, - DROP COLUMN `interest_rate_for_senior_citizen`; \ No newline at end of file + DROP COLUMN `interest_rate_for_senior_citizen`; \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V176__updates_to_financial_activity_accounts.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V176__updates_to_financial_activity_accounts.sql similarity index 99% rename from mifosng-db/migrations/core_db/V176__updates_to_financial_activity_accounts.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V176__updates_to_financial_activity_accounts.sql index 021f0dffc..4c6dabbba 100644 --- a/mifosng-db/migrations/core_db/V176__updates_to_financial_activity_accounts.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V176__updates_to_financial_activity_accounts.sql @@ -7,7 +7,7 @@ ALTER TABLE `acc_gl_office_mapping` ALTER TABLE `acc_gl_office_mapping` CHANGE COLUMN `financial_account_type` `financial_activity_type` SMALLINT(5) NOT NULL; - + ALTER TABLE `acc_gl_office_mapping` ADD UNIQUE INDEX `financial_activity_type` (`financial_activity_type`); diff --git a/mifosng-db/migrations/core_db/V177__cleanup_for_client_incentives.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V177__cleanup_for_client_incentives.sql similarity index 100% rename from mifosng-db/migrations/core_db/V177__cleanup_for_client_incentives.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V177__cleanup_for_client_incentives.sql diff --git a/mifosng-db/migrations/core_db/V178__updates_to_financial_activity_accounts_pt2.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V178__updates_to_financial_activity_accounts_pt2.sql similarity index 91% rename from mifosng-db/migrations/core_db/V178__updates_to_financial_activity_accounts_pt2.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V178__updates_to_financial_activity_accounts_pt2.sql index 2137a42dc..958733152 100644 --- a/mifosng-db/migrations/core_db/V178__updates_to_financial_activity_accounts_pt2.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V178__updates_to_financial_activity_accounts_pt2.sql @@ -2,10 +2,10 @@ update m_permission set entity_name="FINANCIALACTIVITYACCOUNT" where entity_name update m_permission set code="READ_FINANCIALACTIVITYACCOUNT" where code="READ_OFFICEGLACCOUNT"; update m_permission set code="CREATE_FINANCIALACTIVITYACCOUNT" where code="CREATE_OFFICEGLACCOUNT"; update m_permission set code="DELETE_FINANCIALACTIVITYACCOUNT" where code="DELETE_OFFICEGLACCOUNT"; -update m_permission set code="UPDATE_FINANCIALACTIVITYACCOUNT" where code="UPDATE_OFFICEGLACCOUNT"; +update m_permission set code="UPDATE_FINANCIALACTIVITYACCOUNT" where code="UPDATE_OFFICEGLACCOUNT"; /*Default Account for tracking account transfer*/ -INSERT INTO `acc_gl_account` (`name`, `hierarchy`, `gl_code`,`account_usage`, `classification_enum`,`description`) +INSERT INTO `acc_gl_account` (`name`, `hierarchy`, `gl_code`,`account_usage`, `classification_enum`,`description`) select 'Liability Transfer (Temp)', '.', '220004-Temp', 1, 2,'Temporary Liability account to track Account Transfers' FROM m_product_loan WHERE accounting_type != 1 limit 1; diff --git a/mifosng-provider/src/main/resources/sql/migrations/core_db/V179__updates_to_action_names_for_maker_checker_permissions.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V179__updates_to_action_names_for_maker_checker_permissions.sql new file mode 100644 index 000000000..61a31789a --- /dev/null +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V179__updates_to_action_names_for_maker_checker_permissions.sql @@ -0,0 +1,3 @@ +UPDATE m_permission +SET action_name = CONCAT(action_name,'_CHECKER') +WHERE code LIKE "%_CHECKER"; \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V17__update_stretchy_reporting_ddl.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V17__update_stretchy_reporting_ddl.sql similarity index 95% rename from mifosng-db/migrations/core_db/V17__update_stretchy_reporting_ddl.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V17__update_stretchy_reporting_ddl.sql index deef29ed1..9aab88ec0 100644 --- a/mifosng-db/migrations/core_db/V17__update_stretchy_reporting_ddl.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V17__update_stretchy_reporting_ddl.sql @@ -61,7 +61,7 @@ select report_id, parameter_id, report_parameter_name from stretchy_report_parameter; -ALTER TABLE `stretchy_parameter_tmp` +ALTER TABLE `stretchy_parameter_tmp` ADD CONSTRAINT `fk_stretchy_parameter_001` FOREIGN KEY (`parent_id` ) REFERENCES `stretchy_parameter_tmp` (`id` ) @@ -69,9 +69,9 @@ ALTER TABLE `stretchy_parameter_tmp` ADD INDEX `fk_stretchy_parameter_001_idx` (`parent_id` ASC); SET foreign_key_checks = 0; -ALTER TABLE `stretchy_report_parameter_tmp` +ALTER TABLE `stretchy_report_parameter_tmp` ADD CONSTRAINT `fk_report_parameter_001` FOREIGN KEY (`report_id` ) - REFERENCES `stretchy_report_tmp` (`id` ) ON DELETE CASCADE ON UPDATE RESTRICT, + REFERENCES `stretchy_report_tmp` (`id` ) ON DELETE CASCADE ON UPDATE RESTRICT, ADD CONSTRAINT `fk_report_parameter_002` FOREIGN KEY (`parameter_id` ) REFERENCES `stretchy_parameter_tmp` (`id` ) ON DELETE RESTRICT ON UPDATE RESTRICT, @@ -84,7 +84,7 @@ drop table stretchy_report_parameter; drop table stretchy_report; drop table stretchy_parameter; -rename table +rename table stretchy_report_tmp to stretchy_report, stretchy_parameter_tmp to stretchy_parameter, -stretchy_report_parameter_tmp to stretchy_report_parameter; \ No newline at end of file +stretchy_report_parameter_tmp to stretchy_report_parameter; \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V180__update_report_schemas_for_disbursed_vs_awaitingdisbursal_and_groupnamesbystaff.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V180__update_report_schemas_for_disbursed_vs_awaitingdisbursal_and_groupnamesbystaff.sql similarity index 100% rename from mifosng-db/migrations/core_db/V180__update_report_schemas_for_disbursed_vs_awaitingdisbursal_and_groupnamesbystaff.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V180__update_report_schemas_for_disbursed_vs_awaitingdisbursal_and_groupnamesbystaff.sql diff --git a/mifosng-db/migrations/core_db/V181__standing_instruction_logging.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V181__standing_instruction_logging.sql similarity index 100% rename from mifosng-db/migrations/core_db/V181__standing_instruction_logging.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V181__standing_instruction_logging.sql diff --git a/mifosng-db/migrations/core_db/V182__added_min_required_balance_to_savings_product.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V182__added_min_required_balance_to_savings_product.sql similarity index 100% rename from mifosng-db/migrations/core_db/V182__added_min_required_balance_to_savings_product.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V182__added_min_required_balance_to_savings_product.sql diff --git a/mifosng-db/migrations/core_db/V183__added_min_balance_for_interest_calculation.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V183__added_min_balance_for_interest_calculation.sql similarity index 99% rename from mifosng-db/migrations/core_db/V183__added_min_balance_for_interest_calculation.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V183__added_min_balance_for_interest_calculation.sql index eaaadb89c..9cb5b4634 100755 --- a/mifosng-db/migrations/core_db/V183__added_min_balance_for_interest_calculation.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V183__added_min_balance_for_interest_calculation.sql @@ -1,6 +1,5 @@ ALTER TABLE `m_savings_product` ADD COLUMN `min_balance_for_interest_calculation` DECIMAL(19,6) NULL DEFAULT NULL AFTER `allow_overdraft_min_balance`; - + ALTER TABLE `m_savings_account` ADD COLUMN `min_balance_for_interest_calculation` DECIMAL(19,6) NULL DEFAULT NULL AFTER `allow_overdraft_min_balance`; - \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V184__update_min_required_balance_for_savings_product.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V184__update_min_required_balance_for_savings_product.sql similarity index 98% rename from mifosng-db/migrations/core_db/V184__update_min_required_balance_for_savings_product.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V184__update_min_required_balance_for_savings_product.sql index d4c7e20a4..8769b991a 100644 --- a/mifosng-db/migrations/core_db/V184__update_min_required_balance_for_savings_product.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V184__update_min_required_balance_for_savings_product.sql @@ -3,6 +3,3 @@ ALTER TABLE `m_savings_product` ALTER TABLE `m_savings_account` CHANGE COLUMN `allow_overdraft_min_balance` `enforce_min_required_balance` TINYINT(1) NOT NULL DEFAULT '0' AFTER `min_required_balance`; - - - diff --git a/mifosng-db/migrations/core_db/V185__add_accrual_till_date_for_periodic_accrual.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V185__add_accrual_till_date_for_periodic_accrual.sql similarity index 100% rename from mifosng-db/migrations/core_db/V185__add_accrual_till_date_for_periodic_accrual.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V185__add_accrual_till_date_for_periodic_accrual.sql diff --git a/mifosng-db/migrations/core_db/V186__added_periodic_accrual_job.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V186__added_periodic_accrual_job.sql similarity index 100% rename from mifosng-db/migrations/core_db/V186__added_periodic_accrual_job.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V186__added_periodic_accrual_job.sql diff --git a/mifosng-db/migrations/core_db/V187__added_permission_to_periodic_accrual.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V187__added_permission_to_periodic_accrual.sql similarity index 100% rename from mifosng-db/migrations/core_db/V187__added_permission_to_periodic_accrual.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V187__added_permission_to_periodic_accrual.sql diff --git a/mifosng-db/migrations/core_db/V188__add_savingscharge_inactivate_permissions.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V188__add_savingscharge_inactivate_permissions.sql similarity index 100% rename from mifosng-db/migrations/core_db/V188__add_savingscharge_inactivate_permissions.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V188__add_savingscharge_inactivate_permissions.sql diff --git a/mifosng-db/migrations/core_db/V189__m_loan_interest_recalculation_tables.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V189__m_loan_interest_recalculation_tables.sql similarity index 100% rename from mifosng-db/migrations/core_db/V189__m_loan_interest_recalculation_tables.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V189__m_loan_interest_recalculation_tables.sql diff --git a/mifosng-db/migrations/core_db/V18__update_stretchy_reporting_reportSql.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V18__update_stretchy_reporting_reportSql.sql similarity index 97% rename from mifosng-db/migrations/core_db/V18__update_stretchy_reporting_reportSql.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V18__update_stretchy_reporting_reportSql.sql index b0dcad307..095ea4b80 100644 --- a/mifosng-db/migrations/core_db/V18__update_stretchy_reporting_reportSql.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V18__update_stretchy_reporting_reportSql.sql @@ -1,7 +1,6 @@ UPDATE `stretchy_parameter` SET `parameter_sql`='select sp.parameter_name, sp.parameter_variable, sp.parameter_label, sp.parameter_displayType, \r sp.parameter_FormatType, sp.parameter_default, sp.selectOne, sp.selectAll, spp.parameter_name as parentParameterName\r from stretchy_parameter sp\r left join stretchy_parameter spp on spp.id = sp.parent_id\r where sp.special is null\r and exists \r (select \'f\' \r from stretchy_report sr\r join stretchy_report_parameter srp on srp.report_id = sr.id\r where sr.report_name in(${reportListing})\r and srp.parameter_id = sp.id\r )\r order by sp.id' WHERE `id`='1002'; -UPDATE `stretchy_parameter` SET `parameter_sql`='select r.id as report_id, r.report_name, r.report_type, r.report_subtype, r.report_category,\nrp.id as parameter_id, rp.report_parameter_name, p.parameter_name\n from stretchy_report r\n left join stretchy_report_parameter rp on rp.report_id = r.id \n left join stretchy_parameter p on p.id = rp.parameter_id\n where r.use_report is true\n and exists\n ( select \'f\'\n from m_appuser_role ur \n join m_role r on r.id = ur.role_id\n join m_role_permission rp on rp.role_id = r.id\n join m_permission p on p.id = rp.permission_id\n where ur.appuser_id = ${currentUserId}\n and (p.code in (\'ALL_FUNCTIONS_READ\', \'ALL_FUNCTIONS\') or p.code = concat(\"READ_\", r.report_name)) )\n order by r.report_category, r.report_name, rp.id' WHERE `id`='1001'; +UPDATE `stretchy_parameter` SET `parameter_sql`='select r.id as report_id, r.report_name, r.report_type, r.report_subtype, r.report_category,\nrp.id as parameter_id, rp.report_parameter_name, p.parameter_name\n from stretchy_report r\n left join stretchy_report_parameter rp on rp.report_id = r.id \n left join stretchy_parameter p on p.id = rp.parameter_id\n where r.use_report is true\n and exists\n ( select \'f\'\n from m_appuser_role ur \n join m_role r on r.id = ur.role_id\n join m_role_permission rp on rp.role_id = r.id\n join m_permission p on p.id = rp.permission_id\n where ur.appuser_id = ${currentUserId}\n and (p.code in (\'ALL_FUNCTIONS_READ\', \'ALL_FUNCTIONS\') or p.code = concat(\"READ_\", r.report_name)) )\n order by r.report_category, r.report_name, rp.id' WHERE `id`='1001'; UPDATE `stretchy_parameter` SET `parameter_sql`='select r.id as report_id, r.report_name, r.report_type, r.report_subtype, r.report_category,\n rp.id as parameter_id, rp.report_parameter_name, p.parameter_name\n from stretchy_report r\n left join stretchy_report_parameter rp on rp.report_id = r.id\n left join stretchy_parameter p on p.id = rp.parameter_id\n where r.report_category = \'${reportCategory}\'\n and r.use_report is true\n and exists\n (select \'f\'\n from m_appuser_role ur \n join m_role r on r.id = ur.role_id\n join m_role_permission rp on rp.role_id = r.id\n join m_permission p on p.id = rp.permission_id\n where ur.appuser_id = ${currentUserId}\n and (p.code in (\'ALL_FUNCTIONS_READ\', \'ALL_FUNCTIONS\') or p.code = concat(\"READ_\", r.report_name)) )\n order by r.report_category, r.report_name, rp.id' WHERE `id`='1003'; - diff --git a/mifosng-db/migrations/core_db/V190__add_associategroup_disassociategroup_permissions.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V190__add_associategroup_disassociategroup_permissions.sql similarity index 100% rename from mifosng-db/migrations/core_db/V190__add_associategroup_disassociategroup_permissions.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V190__add_associategroup_disassociategroup_permissions.sql diff --git a/mifosng-db/migrations/core_db/V191__update_gl_account_increase_size_of_name_col.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V191__update_gl_account_increase_size_of_name_col.sql similarity index 100% rename from mifosng-db/migrations/core_db/V191__update_gl_account_increase_size_of_name_col.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V191__update_gl_account_increase_size_of_name_col.sql diff --git a/mifosng-db/migrations/core_db/V192__interest_recalculate_job.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V192__interest_recalculate_job.sql similarity index 100% rename from mifosng-db/migrations/core_db/V192__interest_recalculate_job.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V192__interest_recalculate_job.sql diff --git a/mifosng-db/migrations/core_db/V193__added_column_joiningDate_for_staff.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V193__added_column_joiningDate_for_staff.sql similarity index 100% rename from mifosng-db/migrations/core_db/V193__added_column_joiningDate_for_staff.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V193__added_column_joiningDate_for_staff.sql diff --git a/mifosng-db/migrations/core_db/V194__added_recalculatedInterestComponent_for_interest_recalculation.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V194__added_recalculatedInterestComponent_for_interest_recalculation.sql similarity index 100% rename from mifosng-db/migrations/core_db/V194__added_recalculatedInterestComponent_for_interest_recalculation.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V194__added_recalculatedInterestComponent_for_interest_recalculation.sql diff --git a/mifosng-db/migrations/core_db/V195__moved_rest_frequency_to_product_level.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V195__moved_rest_frequency_to_product_level.sql similarity index 95% rename from mifosng-db/migrations/core_db/V195__moved_rest_frequency_to_product_level.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V195__moved_rest_frequency_to_product_level.sql index e840e0eb7..5bf413623 100755 --- a/mifosng-db/migrations/core_db/V195__moved_rest_frequency_to_product_level.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V195__moved_rest_frequency_to_product_level.sql @@ -2,8 +2,8 @@ ALTER TABLE `m_product_loan_recalculation_details` ADD COLUMN `rest_frequency_type_enum` SMALLINT(1) NOT NULL AFTER `reschedule_strategy_enum`, ADD COLUMN `rest_frequency_interval` SMALLINT(3) NOT NULL DEFAULT '0' AFTER `rest_frequency_type_enum`, ADD COLUMN `rest_freqency_date` DATE NULL DEFAULT NULL AFTER `rest_frequency_interval`; - + ALTER TABLE `m_loan_recalculation_details` ADD COLUMN `rest_frequency_type_enum` SMALLINT(1) NOT NULL AFTER `reschedule_strategy_enum`, ADD COLUMN `rest_frequency_interval` SMALLINT(3) NOT NULL DEFAULT '0' AFTER `rest_frequency_type_enum`, - ADD COLUMN `rest_freqency_date` DATE NULL DEFAULT NULL AFTER `rest_frequency_interval`; \ No newline at end of file + ADD COLUMN `rest_freqency_date` DATE NULL DEFAULT NULL AFTER `rest_frequency_interval`; \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V196__added_loan_running_balance_to_transactions.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V196__added_loan_running_balance_to_transactions.sql similarity index 100% rename from mifosng-db/migrations/core_db/V196__added_loan_running_balance_to_transactions.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V196__added_loan_running_balance_to_transactions.sql diff --git a/mifosng-db/migrations/core_db/V197__updated_loan_running_balance_of_transactions.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V197__updated_loan_running_balance_of_transactions.sql similarity index 99% rename from mifosng-db/migrations/core_db/V197__updated_loan_running_balance_of_transactions.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V197__updated_loan_running_balance_of_transactions.sql index cfb2e143b..b7b94177d 100755 --- a/mifosng-db/migrations/core_db/V197__updated_loan_running_balance_of_transactions.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V197__updated_loan_running_balance_of_transactions.sql @@ -11,4 +11,3 @@ INSERT INTO m_loan_transaction_temp(`id`,`loan_id`,`transaction_date`,`amount`) UPDATE m_loan_transaction lt SET lt.outstanding_loan_balance_derived = (select sum(ltt.amount) from m_loan_transaction_temp ltt where ((ltt.transaction_date = lt.transaction_date and ltt.id <= lt.id) or ltt.transaction_date < lt.transaction_date) and ltt.loan_id = lt.loan_id) where lt.transaction_type_enum != 10 and lt.is_reversed = 0; DROP TABLE `m_loan_transaction_temp`; - diff --git a/mifosng-db/migrations/core_db/V198__loan_rescheduling_tables_and_permissions.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V198__loan_rescheduling_tables_and_permissions.sql similarity index 100% rename from mifosng-db/migrations/core_db/V198__loan_rescheduling_tables_and_permissions.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V198__loan_rescheduling_tables_and_permissions.sql diff --git a/mifosng-db/migrations/core_db/V199__removed_extra_columns_from_schedule_history.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V199__removed_extra_columns_from_schedule_history.sql similarity index 100% rename from mifosng-db/migrations/core_db/V199__removed_extra_columns_from_schedule_history.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V199__removed_extra_columns_from_schedule_history.sql diff --git a/mifosng-db/migrations/core_db/V19__report_maintenance_permissions.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V19__report_maintenance_permissions.sql similarity index 77% rename from mifosng-db/migrations/core_db/V19__report_maintenance_permissions.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V19__report_maintenance_permissions.sql index 60867d13e..6d1cee7e3 100644 --- a/mifosng-db/migrations/core_db/V19__report_maintenance_permissions.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V19__report_maintenance_permissions.sql @@ -1,15 +1,14 @@ -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'READ_REPORT', 'REPORT', 'READ', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'CREATE_REPORT', 'REPORT', 'CREATE', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'CREATE_REPORT_CHECKER', 'REPORT', 'CREATE', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'UPDATE_REPORT', 'REPORT', 'UPDATE', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'UPDATE_REPORT_CHECKER', 'REPORT', 'UPDATE', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'DELETE_REPORT', 'REPORT', 'DELETE', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'DELETE_REPORT_CHECKER', 'REPORT', 'DELETE', 0); - diff --git a/mifosng-db/migrations/core_db/V1__mifosplatform-core-ddl-latest.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V1__mifosplatform-core-ddl-latest.sql similarity index 100% rename from mifosng-db/migrations/core_db/V1__mifosplatform-core-ddl-latest.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V1__mifosplatform-core-ddl-latest.sql diff --git a/mifosng-db/migrations/core_db/V200__alter_savings_account_for_start_interest_calculation_date.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V200__alter_savings_account_for_start_interest_calculation_date.sql similarity index 100% rename from mifosng-db/migrations/core_db/V200__alter_savings_account_for_start_interest_calculation_date.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V200__alter_savings_account_for_start_interest_calculation_date.sql diff --git a/mifosng-db/migrations/core_db/V201__webhooks.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V201__webhooks.sql similarity index 100% rename from mifosng-db/migrations/core_db/V201__webhooks.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V201__webhooks.sql diff --git a/mifosng-db/migrations/core_db/V20__report_maint_perms_really_configuration.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V20__report_maint_perms_really_configuration.sql similarity index 100% rename from mifosng-db/migrations/core_db/V20__report_maint_perms_really_configuration.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V20__report_maint_perms_really_configuration.sql diff --git a/mifosng-db/migrations/core_db/V21__activation-permissions-for-clients.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V21__activation-permissions-for-clients.sql similarity index 86% rename from mifosng-db/migrations/core_db/V21__activation-permissions-for-clients.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V21__activation-permissions-for-clients.sql index c42f2a555..98cf78e29 100644 --- a/mifosng-db/migrations/core_db/V21__activation-permissions-for-clients.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V21__activation-permissions-for-clients.sql @@ -2,7 +2,7 @@ INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `c INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('portfolio', 'ACTIVATE_CLIENT_CHECKER', 'CLIENT', 'ACTIVATE', 0); -ALTER TABLE `m_client` -CHANGE COLUMN `external_id` `external_id` VARCHAR(100) NULL DEFAULT NULL AFTER `account_no`, -CHANGE COLUMN `status_enum` `status_enum` INT(5) NOT NULL DEFAULT '300' AFTER `external_id`, +ALTER TABLE `m_client` +CHANGE COLUMN `external_id` `external_id` VARCHAR(100) NULL DEFAULT NULL AFTER `account_no`, +CHANGE COLUMN `status_enum` `status_enum` INT(5) NOT NULL DEFAULT '300' AFTER `external_id`, CHANGE COLUMN `joined_date` `activation_date` DATE NULL DEFAULT NULL AFTER `status_enum`; \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V22__alter-group-for-consistency-add-permissions.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V22__alter-group-for-consistency-add-permissions.sql similarity index 92% rename from mifosng-db/migrations/core_db/V22__alter-group-for-consistency-add-permissions.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V22__alter-group-for-consistency-add-permissions.sql index fc24a41d7..749fd53a7 100644 --- a/mifosng-db/migrations/core_db/V22__alter-group-for-consistency-add-permissions.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V22__alter-group-for-consistency-add-permissions.sql @@ -6,14 +6,14 @@ INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `c ALTER TABLE `m_group` DROP FOREIGN KEY `FK_m_group_level`; -ALTER TABLE `m_group` +ALTER TABLE `m_group` CHANGE COLUMN `external_id` `external_id` VARCHAR(100) NULL DEFAULT NULL AFTER `id`, CHANGE COLUMN `status_enum` `status_enum` INT(5) NOT NULL DEFAULT '300' AFTER `external_id`, CHANGE COLUMN `name` `display_name` VARCHAR(100) NOT NULL AFTER `level_id`, -CHANGE COLUMN `level_Id` `level_id` INT(11) NOT NULL, +CHANGE COLUMN `level_Id` `level_id` INT(11) NOT NULL, ADD CONSTRAINT `FK_m_group_level` FOREIGN KEY (`level_id`) REFERENCES `m_group_level` (`id`); -ALTER TABLE `m_group` +ALTER TABLE `m_group` DROP COLUMN `is_deleted`, ADD COLUMN `activation_date` DATE NULL DEFAULT NULL AFTER `status_enum` ; \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V23__remove-enable-disable-configuration-for-client-group-status.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V23__remove-enable-disable-configuration-for-client-group-status.sql similarity index 100% rename from mifosng-db/migrations/core_db/V23__remove-enable-disable-configuration-for-client-group-status.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V23__remove-enable-disable-configuration-for-client-group-status.sql diff --git a/mifosng-db/migrations/core_db/V24__add-group-client-foreign-key-constraint-in-loan-table.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V24__add-group-client-foreign-key-constraint-in-loan-table.sql similarity index 100% rename from mifosng-db/migrations/core_db/V24__add-group-client-foreign-key-constraint-in-loan-table.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V24__add-group-client-foreign-key-constraint-in-loan-table.sql diff --git a/mifosng-db/migrations/core_db/V25__update_client_reports_for_status_and_activation_change.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V25__update_client_reports_for_status_and_activation_change.sql similarity index 86% rename from mifosng-db/migrations/core_db/V25__update_client_reports_for_status_and_activation_change.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V25__update_client_reports_for_status_and_activation_change.sql index 494d5daeb..1b2872216 100644 --- a/mifosng-db/migrations/core_db/V25__update_client_reports_for_status_and_activation_change.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V25__update_client_reports_for_status_and_activation_change.sql @@ -1,12 +1,12 @@ update stretchy_report -set report_sql = "select -concat(repeat("".."", +set report_sql = "select +concat(repeat("".."", ((LENGTH(ounder.`hierarchy`) - LENGTH(REPLACE(ounder.`hierarchy`, '.', '')) - 1))), ounder.`name`) as ""Office/Branch"", - c.account_no as ""Client Account No."", -c.display_name as ""Name"", + c.account_no as ""Client Account No."", +c.display_name as ""Name"", r.enum_message_property as ""Status"", c.activation_date as ""Activation"", c.external_id as ""External Id"" -from m_office o +from m_office o join m_office ounder on ounder.hierarchy like concat(o.hierarchy, '%') and ounder.hierarchy like concat('${currentUserHierarchy}', '%') join m_client c on c.office_id = ounder.id @@ -17,17 +17,17 @@ order by ounder.hierarchy, c.account_no" where report_name = 'Client Listing'; update stretchy_report -set report_sql = "select -concat(repeat("".."", - ((LENGTH(ounder.`hierarchy`) - LENGTH(REPLACE(ounder.`hierarchy`, '.', '')) - 1))), ounder.`name`) as ""Office/Branch"", c.account_no as ""Client Account No."", +set report_sql = "select +concat(repeat("".."", + ((LENGTH(ounder.`hierarchy`) - LENGTH(REPLACE(ounder.`hierarchy`, '.', '')) - 1))), ounder.`name`) as ""Office/Branch"", c.account_no as ""Client Account No."", c.display_name as ""Name"", r.enum_message_property as ""Client Status"", -lo.display_name as ""Loan Officer"", l.account_no as ""Loan Account No."", l.external_id as ""External Id"", p.name as Loan, st.enum_message_property as ""Status"", +lo.display_name as ""Loan Officer"", l.account_no as ""Loan Account No."", l.external_id as ""External Id"", p.name as Loan, st.enum_message_property as ""Status"", f.`name` as Fund, purp.code_value as ""Loan Purpose"", -ifnull(cur.display_symbol, l.currency_code) as Currency, +ifnull(cur.display_symbol, l.currency_code) as Currency, l.principal_amount, l.arrearstolerance_amount as ""Arrears Tolerance Amount"", -l.number_of_repayments as ""Expected No. Repayments"", -l.annual_nominal_interest_rate as "" Annual Nominal Interest Rate"", +l.number_of_repayments as ""Expected No. Repayments"", +l.annual_nominal_interest_rate as "" Annual Nominal Interest Rate"", l.nominal_interest_rate_per_period as ""Nominal Interest Rate Per Period"", ipf.enum_message_property as ""Interest Rate Frequency"", im.enum_message_property as ""Interest Method"", @@ -39,35 +39,35 @@ rf.enum_message_property as ""Repayment Frequency Period"", am.enum_message_property as ""Amortization"", l.total_charges_due_at_disbursement_derived as ""Total Charges Due At Disbursement"", date(l.submittedon_date) as Submitted, date(l.approvedon_date) Approved, l.expected_disbursedon_date As ""Expected Disbursal"", -date(l.expected_firstrepaymenton_date) as ""Expected First Repayment"", +date(l.expected_firstrepaymenton_date) as ""Expected First Repayment"", date(l.interest_calculated_from_date) as ""Interest Calculated From"" , -date(l.disbursedon_date) as Disbursed, +date(l.disbursedon_date) as Disbursed, date(l.expected_maturedon_date) ""Expected Maturity"", date(l.maturedon_date) as ""Matured On"", date(l.closedon_date) as Closed, -date(l.rejectedon_date) as Rejected, date(l.rescheduledon_date) as Rescheduled, +date(l.rejectedon_date) as Rejected, date(l.rescheduledon_date) as Rescheduled, date(l.withdrawnon_date) as Withdrawn, date(l.writtenoffon_date) ""Written Off"" -from m_office o +from m_office o join m_office ounder on ounder.hierarchy like concat(o.hierarchy, '%') and ounder.hierarchy like concat('${currentUserHierarchy}', '%') join m_client c on c.office_id = ounder.id -left join r_enum_value r on r.enum_name = 'status_enum' +left join r_enum_value r on r.enum_name = 'status_enum' and r.enum_id = c.status_enum left join m_loan l on l.client_id = c.id left join m_staff lo on lo.id = l.loan_officer_id left join m_product_loan p on p.id = l.product_id left join m_fund f on f.id = l.fund_id left join r_enum_value st on st.enum_name = ""loan_status_id"" and st.enum_id = l.loan_status_id -left join r_enum_value ipf on ipf.enum_name = ""interest_period_frequency_enum"" +left join r_enum_value ipf on ipf.enum_name = ""interest_period_frequency_enum"" and ipf.enum_id = l.interest_period_frequency_enum -left join r_enum_value im on im.enum_name = ""interest_method_enum"" +left join r_enum_value im on im.enum_name = ""interest_method_enum"" and im.enum_id = l.interest_method_enum -left join r_enum_value tf on tf.enum_name = ""term_period_frequency_enum"" +left join r_enum_value tf on tf.enum_name = ""term_period_frequency_enum"" and tf.enum_id = l.term_period_frequency_enum -left join r_enum_value icp on icp.enum_name = ""interest_calculated_in_period_enum"" +left join r_enum_value icp on icp.enum_name = ""interest_calculated_in_period_enum"" and icp.enum_id = l.interest_calculated_in_period_enum -left join r_enum_value rf on rf.enum_name = ""repayment_period_frequency_enum"" +left join r_enum_value rf on rf.enum_name = ""repayment_period_frequency_enum"" and rf.enum_id = l.repayment_period_frequency_enum -left join r_enum_value am on am.enum_name = ""amortization_method_enum"" +left join r_enum_value am on am.enum_name = ""amortization_method_enum"" and am.enum_id = l.amortization_method_enum left join m_code_value purp on purp.id = l.loanpurpose_cv_id left join m_currency cur on cur.code = l.currency_code diff --git a/mifosng-db/migrations/core_db/V26__add-support-for-withdrawal-fees-on-savings.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V26__add-support-for-withdrawal-fees-on-savings.sql similarity index 84% rename from mifosng-db/migrations/core_db/V26__add-support-for-withdrawal-fees-on-savings.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V26__add-support-for-withdrawal-fees-on-savings.sql index f5aeba923..6fea52bbc 100644 --- a/mifosng-db/migrations/core_db/V26__add-support-for-withdrawal-fees-on-savings.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V26__add-support-for-withdrawal-fees-on-savings.sql @@ -1,12 +1,12 @@ -ALTER TABLE `m_savings_product` +ALTER TABLE `m_savings_product` ADD COLUMN `withdrawal_fee_amount` DECIMAL(19,6) NULL DEFAULT NULL AFTER `lockin_period_frequency_enum`, ADD COLUMN `withdrawal_fee_type_enum` SMALLINT(5) NULL DEFAULT NULL AFTER `withdrawal_fee_amount`; -ALTER TABLE `m_savings_account` +ALTER TABLE `m_savings_account` ADD COLUMN `withdrawal_fee_amount` DECIMAL(19,6) NULL DEFAULT NULL AFTER `lockin_period_frequency_enum`, ADD COLUMN `withdrawal_fee_type_enum` SMALLINT(5) NULL DEFAULT NULL AFTER `withdrawal_fee_amount`; -ALTER TABLE `m_savings_account` +ALTER TABLE `m_savings_account` ADD COLUMN `total_withdrawal_fees_derived` DECIMAL(19,6) NULL DEFAULT NULL AFTER `total_withdrawals_derived`; \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V27__add-loan-type-column-to-loan-table.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V27__add-loan-type-column-to-loan-table.sql similarity index 100% rename from mifosng-db/migrations/core_db/V27__add-loan-type-column-to-loan-table.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V27__add-loan-type-column-to-loan-table.sql diff --git a/mifosng-db/migrations/core_db/V28__accounting-abstractions-and-autoposting.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V28__accounting-abstractions-and-autoposting.sql similarity index 99% rename from mifosng-db/migrations/core_db/V28__accounting-abstractions-and-autoposting.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V28__accounting-abstractions-and-autoposting.sql index e60a648c4..8861af9e2 100755 --- a/mifosng-db/migrations/core_db/V28__accounting-abstractions-and-autoposting.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V28__accounting-abstractions-and-autoposting.sql @@ -44,4 +44,3 @@ CREATE TABLE `acc_auto_posting` ( ) COLLATE='utf8_general_ci' ENGINE=InnoDB; - diff --git a/mifosng-db/migrations/core_db/V29__add-support-for-annual-fees-on-savings.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V29__add-support-for-annual-fees-on-savings.sql similarity index 92% rename from mifosng-db/migrations/core_db/V29__add-support-for-annual-fees-on-savings.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V29__add-support-for-annual-fees-on-savings.sql index 14c209cc6..a47192043 100644 --- a/mifosng-db/migrations/core_db/V29__add-support-for-annual-fees-on-savings.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V29__add-support-for-annual-fees-on-savings.sql @@ -1,4 +1,4 @@ -ALTER TABLE `m_savings_product` +ALTER TABLE `m_savings_product` ADD COLUMN `annual_fee_amount` DECIMAL(19,6) NULL DEFAULT NULL AFTER `withdrawal_fee_type_enum`, ADD COLUMN `annual_fee_on_month` SMALLINT(5) NULL DEFAULT NULL AFTER `annual_fee_amount`, ADD COLUMN `annual_fee_on_day` SMALLINT(5) NULL DEFAULT NULL AFTER `annual_fee_on_month`; @@ -9,5 +9,5 @@ ADD COLUMN `annual_fee_on_month` SMALLINT(5) NULL DEFAULT NULL AFTER `annual_fee ADD COLUMN `annual_fee_on_day` SMALLINT(5) NULL DEFAULT NULL AFTER `annual_fee_on_month`, ADD COLUMN `annual_fee_next_due_date` DATE NULL DEFAULT NULL AFTER `annual_fee_on_day`; -ALTER TABLE `m_savings_account` +ALTER TABLE `m_savings_account` ADD COLUMN `total_annual_fees_derived` DECIMAL(19,6) NULL DEFAULT NULL AFTER `total_withdrawal_fees_derived`; \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V2__mifosx-base-reference-data-utf8.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V2__mifosx-base-reference-data-utf8.sql similarity index 92% rename from mifosng-db/migrations/core_db/V2__mifosx-base-reference-data-utf8.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V2__mifosx-base-reference-data-utf8.sql index 1393ea946..73d4bfea4 100644 --- a/mifosng-db/migrations/core_db/V2__mifosx-base-reference-data-utf8.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V2__mifosx-base-reference-data-utf8.sql @@ -10,11 +10,11 @@ VALUES INSERT INTO `c_configuration` (`name`, `enabled`) -VALUES +VALUES ('maker-checker', 0); -INSERT INTO `r_enum_value` -VALUES +INSERT INTO `r_enum_value` +VALUES ('amortization_method_enum',0,'Equal principle payments','Equal principle payments'), ('amortization_method_enum',1,'Equal installments','Equal installments'), ('interest_calculated_in_period_enum',0,'Daily','Daily'), @@ -48,42 +48,42 @@ VALUES ('term_period_frequency_enum',2,'Months','Months'), ('term_period_frequency_enum',3,'Years','Years'); -INSERT INTO `r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) +INSERT INTO `r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) VALUES ('transaction_type_enum', '1', 'Disbursement', 'Disbursement'); -INSERT INTO `r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) +INSERT INTO `r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) VALUES ('transaction_type_enum', '2', 'Repayment', 'Repayment'); -INSERT INTO `r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) +INSERT INTO `r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) VALUES ('transaction_type_enum', '3', 'Contra', 'Contra'); -INSERT INTO `r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) +INSERT INTO `r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) VALUES ('transaction_type_enum', '4', 'Waive Interest', 'Waive Interest'); -INSERT INTO `r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) +INSERT INTO `r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) VALUES ('transaction_type_enum', '5', 'Repayment At Disbursement', 'Repayment At Disbursement'); -INSERT INTO `r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) +INSERT INTO `r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) VALUES ('transaction_type_enum', '6', 'Write-Off', 'Write-Off'); -INSERT INTO `r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) +INSERT INTO `r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) VALUES ('transaction_type_enum', '7', 'Marked for Rescheduling', 'Marked for Rescheduling'); -INSERT INTO `r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) +INSERT INTO `r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) VALUES ('transaction_type_enum', '8', 'Recovery Repayment', 'Recovery Repayment'); -INSERT INTO `r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) +INSERT INTO `r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) VALUES ('transaction_type_enum', '9', 'Waive Charges', 'Waive Charges'); -INSERT INTO `r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) +INSERT INTO `r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) VALUES ('transaction_type_enum', '10', 'Apply Charges', 'Apply Charges'); -INSERT INTO `r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) +INSERT INTO `r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`) VALUES ('transaction_type_enum', '11', 'Apply Interest', 'Apply Interest'); INSERT INTO `m_currency` (`id`,`code`,`decimal_places`,`display_symbol`,`name`, `internationalized_name_code`) -VALUES +VALUES (1,'AED',2,NULL,'UAE Dirham','currency.AED'), (2,'AFN',2,NULL,'Afghanistan Afghani','currency.AFN'), (3,'ALL',2,NULL,'Albanian Lek','currency.ALL'), @@ -249,24 +249,24 @@ VALUES (163,'ZWD',2,NULL,'Zimbabwe Dollar','currency.ZWD'); -- ======== end of currencies == -INSERT INTO `m_organisation_currency` (`id`, `code`, `decimal_places`, `name`, `display_symbol`, `internationalized_name_code`) +INSERT INTO `m_organisation_currency` (`id`, `code`, `decimal_places`, `name`, `display_symbol`, `internationalized_name_code`) VALUES (21,'USD',2,'US Dollar','$','currency.USD'); -INSERT INTO `m_office` (`id`, `parent_id`, `hierarchy`, `external_id`, `name`, `opening_date`) -VALUES +INSERT INTO `m_office` (`id`, `parent_id`, `hierarchy`, `external_id`, `name`, `opening_date`) +VALUES (1,NULL,'.','1','Head Office','2009-01-01'); -INSERT INTO `m_group_level` (`id`, `parent_id`, `super_parent`, `level_name`, `recursable`, `can_have_clients`) +INSERT INTO `m_group_level` (`id`, `parent_id`, `super_parent`, `level_name`, `recursable`, `can_have_clients`) VALUES (1, NULL, 1, 'Center', 1, 0); -INSERT INTO `m_group_level` (`id`, `parent_id`, `super_parent`, `level_name`, `recursable`, `can_have_clients`) +INSERT INTO `m_group_level` (`id`, `parent_id`, `super_parent`, `level_name`, `recursable`, `can_have_clients`) VALUES (2, 1, 0, 'Group', 0, 1); -- create single code and code value for client identifiers INSERT INTO `m_code` -(`code_name`, `is_system_defined`) -VALUES +(`code_name`, `is_system_defined`) +VALUES ('Customer Identifier',1), ('LoanCollateral',1), ('LoanPurpose',1), @@ -295,27 +295,27 @@ from m_code mc where mc.`code_name` = "Customer Identifier"; -- Adding a few Default Guarantor Relationships -insert into m_code_value (code_id,code_value,order_position) - select id,"Spouse",0 - from m_code +insert into m_code_value (code_id,code_value,order_position) + select id,"Spouse",0 + from m_code where m_code.code_name="GuarantorRelationship"; -insert into m_code_value (code_id,code_value,order_position) - select id,"Parent",0 - from m_code +insert into m_code_value (code_id,code_value,order_position) + select id,"Parent",0 + from m_code where m_code.code_name="GuarantorRelationship"; -insert into m_code_value (code_id,code_value,order_position) - select id,"Sibling",0 - from m_code +insert into m_code_value (code_id,code_value,order_position) + select id,"Sibling",0 + from m_code where m_code.code_name="GuarantorRelationship"; -insert into m_code_value (code_id,code_value,order_position) - select id,"Business Associate",0 - from m_code +insert into m_code_value (code_id,code_value,order_position) + select id,"Business Associate",0 + from m_code where m_code.code_name="GuarantorRelationship"; -insert into m_code_value (code_id,code_value,order_position) - select id,"Other",0 - from m_code +insert into m_code_value (code_id,code_value,order_position) + select id,"Other",0 + from m_code where m_code.code_name="GuarantorRelationship"; \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V30__add-referenceNumber-to-acc_gl_journal_entry.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V30__add-referenceNumber-to-acc_gl_journal_entry.sql similarity index 64% rename from mifosng-db/migrations/core_db/V30__add-referenceNumber-to-acc_gl_journal_entry.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V30__add-referenceNumber-to-acc_gl_journal_entry.sql index c37eedf76..2e77fda93 100644 --- a/mifosng-db/migrations/core_db/V30__add-referenceNumber-to-acc_gl_journal_entry.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V30__add-referenceNumber-to-acc_gl_journal_entry.sql @@ -1,2 +1,2 @@ -alter table `acc_gl_journal_entry` +alter table `acc_gl_journal_entry` add column `ref_num` varchar(100) default NULL AFTER `reversed`; \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V31__drop-autopostings.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V31__drop-autopostings.sql similarity index 91% rename from mifosng-db/migrations/core_db/V31__drop-autopostings.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V31__drop-autopostings.sql index 3a0205bd5..f2e361823 100755 --- a/mifosng-db/migrations/core_db/V31__drop-autopostings.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V31__drop-autopostings.sql @@ -1,3 +1 @@ drop table `acc_auto_posting`; - - diff --git a/mifosng-db/migrations/core_db/V32__associate-disassociate-clients-from-group-permissions.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V32__associate-disassociate-clients-from-group-permissions.sql similarity index 100% rename from mifosng-db/migrations/core_db/V32__associate-disassociate-clients-from-group-permissions.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V32__associate-disassociate-clients-from-group-permissions.sql diff --git a/mifosng-db/migrations/core_db/V33__drop_unique_check_on_stretchy_report_parameter.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V33__drop_unique_check_on_stretchy_report_parameter.sql similarity index 100% rename from mifosng-db/migrations/core_db/V33__drop_unique_check_on_stretchy_report_parameter.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V33__drop_unique_check_on_stretchy_report_parameter.sql diff --git a/mifosng-db/migrations/core_db/V34__add_unique_check_on_stretchy_report_parameter.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V34__add_unique_check_on_stretchy_report_parameter.sql similarity index 50% rename from mifosng-db/migrations/core_db/V34__add_unique_check_on_stretchy_report_parameter.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V34__add_unique_check_on_stretchy_report_parameter.sql index d58790b60..eec244f9f 100644 --- a/mifosng-db/migrations/core_db/V34__add_unique_check_on_stretchy_report_parameter.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V34__add_unique_check_on_stretchy_report_parameter.sql @@ -1,3 +1,2 @@ -ALTER TABLE stretchy_report_parameter - ADD UNIQUE INDEX `report_parameter_unique` (`report_id` ASC, `parameter_id` ASC) ; - +ALTER TABLE stretchy_report_parameter + ADD UNIQUE INDEX `report_parameter_unique` (`report_id` ASC, `parameter_id` ASC) ; diff --git a/mifosng-db/migrations/core_db/V35__add_hierarchy_column_for_acc_gl_account.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V35__add_hierarchy_column_for_acc_gl_account.sql similarity index 100% rename from mifosng-db/migrations/core_db/V35__add_hierarchy_column_for_acc_gl_account.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V35__add_hierarchy_column_for_acc_gl_account.sql diff --git a/mifosng-db/migrations/core_db/V36__add_tag_id_column_for_acc_gl_account.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V36__add_tag_id_column_for_acc_gl_account.sql similarity index 100% rename from mifosng-db/migrations/core_db/V36__add_tag_id_column_for_acc_gl_account.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V36__add_tag_id_column_for_acc_gl_account.sql diff --git a/mifosng-db/migrations/core_db/V37__add-center-group-collection-sheet-permissions.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V37__add-center-group-collection-sheet-permissions.sql similarity index 100% rename from mifosng-db/migrations/core_db/V37__add-center-group-collection-sheet-permissions.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V37__add-center-group-collection-sheet-permissions.sql diff --git a/mifosng-db/migrations/core_db/V38__add-group-summary-details-report.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V38__add-group-summary-details-report.sql similarity index 84% rename from mifosng-db/migrations/core_db/V38__add-group-summary-details-report.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V38__add-group-summary-details-report.sql index 5b020ad18..467c197af 100644 --- a/mifosng-db/migrations/core_db/V38__add-group-summary-details-report.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V38__add-group-summary-details-report.sql @@ -1,25 +1,25 @@ -INSERT INTO `stretchy_report` (`report_name`, `report_type`, `core_report`, `use_report`, `description`, `report_sql`) +INSERT INTO `stretchy_report` (`report_name`, `report_type`, `core_report`, `use_report`, `description`, `report_sql`) VALUES ('GroupSummaryDetails', 'Table', true, false, 'Utility query for getting group summary details for a group_id', "/* -Active Client is a client linked to the 'group' via m_group_client +Active Client is a client linked to the 'group' via m_group_client and with an active status_enum (not sure what it means if the group is inactive) Active Borrowers - Borrow may be a client or a 'group' Currency is an outstanding issue -Couldn't set up group savings for a client +Couldn't set up group savings for a client (as opposed to opening a individual clients savings account) */ select x.* from m_office o, m_group g, -(select a.activeClients, -(b.activeClientLoans + c.activeGroupLoans) as activeLoans, +(select a.activeClients, +(b.activeClientLoans + c.activeGroupLoans) as activeLoans, b.activeClientLoans, c.activeGroupLoans, (b.activeClientBorrowers + c.activeGroupBorrowers) as activeBorrowers, b.activeClientBorrowers, c.activeGroupBorrowers, d.*, @@ -30,23 +30,23 @@ from m_group topgroup join m_group g on g.hierarchy like concat(topgroup.hierarchy, '%') join m_group_client gc on gc.group_id = g.id join m_client c on c.id = gc.client_id -where topgroup.id = ${groupId} +where topgroup.id = ${groupId} and c.status_enum = 300) a, -(select count(*) as activeClientLoans, +(select count(*) as activeClientLoans, count(distinct(l.client_id)) as activeClientBorrowers from m_group topgroup join m_group g on g.hierarchy like concat(topgroup.hierarchy, '%') join m_loan l on l.group_id = g.id and l.client_id is not null -where topgroup.id = ${groupId} +where topgroup.id = ${groupId} and l.loan_status_id = 300) b, -(select count(*) as activeGroupLoans, +(select count(*) as activeGroupLoans, count(distinct(l.group_id)) as activeGroupBorrowers from m_group topgroup join m_group g on g.hierarchy like concat(topgroup.hierarchy, '%') join m_loan l on l.group_id = g.id and l.client_id is null -where topgroup.id = ${groupId} +where topgroup.id = ${groupId} and l.loan_status_id = 300) c, (select ifnull(sum(l.principal_disbursed_derived),0) as totalDisbursedAmount, @@ -66,6 +66,5 @@ and o.hierarchy like concat('${currentUserHierarchy}', '%')"); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'READ_GroupSummaryDetails', 'GroupSummaryDetails', 'READ', 0); - diff --git a/mifosng-db/migrations/core_db/V39__payment-channels-updates.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V39__payment-channels-updates.sql similarity index 92% rename from mifosng-db/migrations/core_db/V39__payment-channels-updates.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V39__payment-channels-updates.sql index ba6f956ce..5ca90f9a7 100755 --- a/mifosng-db/migrations/core_db/V39__payment-channels-updates.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V39__payment-channels-updates.sql @@ -1,4 +1,4 @@ -INSERT INTO `m_code` (`code_name`, `is_system_defined`) VALUES +INSERT INTO `m_code` (`code_name`, `is_system_defined`) VALUES ('PaymentType',1); /*Update payment detail to add foreign key relationship to user defined Code Value*/ diff --git a/mifosng-db/migrations/core_db/V3__mifosx-permissions-and-authorisation-utf8.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V3__mifosx-permissions-and-authorisation-utf8.sql similarity index 98% rename from mifosng-db/migrations/core_db/V3__mifosx-permissions-and-authorisation-utf8.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V3__mifosx-permissions-and-authorisation-utf8.sql index aaf726ab1..589056bcb 100644 --- a/mifosng-db/migrations/core_db/V3__mifosx-permissions-and-authorisation-utf8.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V3__mifosx-permissions-and-authorisation-utf8.sql @@ -14,7 +14,7 @@ If you had other roles set up with specific permissions you will have to set up -- truncate `x_registered_table`; INSERT INTO `m_permission` -(`grouping`,`code`,`entity_name`,`action_name`,`can_maker_checker`) VALUES +(`grouping`,`code`,`entity_name`,`action_name`,`can_maker_checker`) VALUES ('special','ALL_FUNCTIONS',NULL,NULL,0), ('special','ALL_FUNCTIONS_READ',NULL,NULL,0), ('special', 'CHECKER_SUPER_USER', NULL, NULL, '0'), @@ -277,19 +277,19 @@ INSERT INTO `m_permission` ('transaction_savings', 'CALCULATEINTEREST_SAVINGSACCOUNT_CHECKER', 'SAVINGSACCOUNT', 'CALCULATEINTEREST', '0'); -- == accounting related permissions -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('accounting', 'CREATE_GLACCOUNT', 'GLACCOUNT', 'CREATE', 1), ('accounting', 'UPDATE_GLACCOUNT', 'GLACCOUNT', 'UPDATE', 1), ('accounting', 'DELETE_GLACCOUNT', 'GLACCOUNT', 'DELETE', 1), ('accounting', 'CREATE_GLCLOSURE', 'GLCLOSURE', 'CREATE', 1), ('accounting', 'UPDATE_GLCLOSURE', 'GLCLOSURE', 'UPDATE', 1), -('accounting', 'DELETE_GLCLOSURE', 'GLCLOSURE', 'DELETE', 1), +('accounting', 'DELETE_GLCLOSURE', 'GLCLOSURE', 'DELETE', 1), ('accounting', 'CREATE_JOURNALENTRY', 'JOURNALENTRY', 'CREATE', 1), ('accounting', 'REVERSE_JOURNALENTRY', 'JOURNALENTRY', 'REVERSE', 1); -INSERT INTO `m_role` (`id`, `name`, `description`) -VALUES +INSERT INTO `m_role` (`id`, `name`, `description`) +VALUES (1,'Super user','This role provides all application permissions.'); /* role 1 is super user, give it ALL_FUNCTIONS */ @@ -298,9 +298,9 @@ select 1, id from m_permission where code = 'ALL_FUNCTIONS'; -INSERT INTO `m_appuser` (`id`, `office_id`, `username`, `firstname`, `lastname`, `password`, `email`, -`firsttime_login_remaining`, `nonexpired`, `nonlocked`, `nonexpired_credentials`, `enabled`) -VALUES +INSERT INTO `m_appuser` (`id`, `office_id`, `username`, `firstname`, `lastname`, `password`, `email`, +`firsttime_login_remaining`, `nonexpired`, `nonlocked`, `nonexpired_credentials`, `enabled`) +VALUES (1,1,'mifos','App','Administrator','5787039480429368bf94732aacc771cd0a3ea02bcf504ffe1185ab94213bc63a','demomfi@mifos.org','\0','','','',''); diff --git a/mifosng-db/migrations/core_db/V40__add_permissions_for_accounting_rule.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V40__add_permissions_for_accounting_rule.sql similarity index 100% rename from mifosng-db/migrations/core_db/V40__add_permissions_for_accounting_rule.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V40__add_permissions_for_accounting_rule.sql diff --git a/mifosng-db/migrations/core_db/V41__group-summary-reports.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V41__group-summary-reports.sql similarity index 87% rename from mifosng-db/migrations/core_db/V41__group-summary-reports.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V41__group-summary-reports.sql index 2928539f9..91c17afeb 100644 --- a/mifosng-db/migrations/core_db/V41__group-summary-reports.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V41__group-summary-reports.sql @@ -3,12 +3,12 @@ DELETE FROM `stretchy_report` where report_name = 'GroupSummaryDetails'; DELETE FROM `m_permission` where entity_name = 'GroupSummaryDetails'; -INSERT INTO `stretchy_report` (`report_name`, `report_type`, `core_report`, `use_report`, `description`, `report_sql`) +INSERT INTO `stretchy_report` (`report_name`, `report_type`, `core_report`, `use_report`, `description`, `report_sql`) VALUES ('GroupSummaryCounts', 'Table', true, false, 'Utility query for getting group summary count details for a group_id', " /* -Active Client is a client linked to the 'group' via m_group_client +Active Client is a client linked to the 'group' via m_group_client and with an active 'status_enum'.) Active Borrowers - Borrower may be a client or a 'group' */ @@ -16,8 +16,8 @@ select x.* from m_office o, m_group g, -(select a.activeClients, -(b.activeClientLoans + c.activeGroupLoans) as activeLoans, +(select a.activeClients, +(b.activeClientLoans + c.activeGroupLoans) as activeLoans, b.activeClientLoans, c.activeGroupLoans, (b.activeClientBorrowers + c.activeGroupBorrowers) as activeBorrowers, b.activeClientBorrowers, c.activeGroupBorrowers, @@ -29,27 +29,27 @@ from m_group topgroup join m_group g on g.hierarchy like concat(topgroup.hierarchy, '%') join m_group_client gc on gc.group_id = g.id join m_client c on c.id = gc.client_id -where topgroup.id = ${groupId} +where topgroup.id = ${groupId} and c.status_enum = 300) a, -(select count(*) as activeClientLoans, +(select count(*) as activeClientLoans, count(distinct(l.client_id)) as activeClientBorrowers, ifnull(sum(if(laa.loan_id is not null, 1, 0)), 0) as overdueClientLoans from m_group topgroup join m_group g on g.hierarchy like concat(topgroup.hierarchy, '%') join m_loan l on l.group_id = g.id and l.client_id is not null left join m_loan_arrears_aging laa on laa.loan_id = l.id -where topgroup.id = ${groupId} +where topgroup.id = ${groupId} and l.loan_status_id = 300) b, -(select count(*) as activeGroupLoans, +(select count(*) as activeGroupLoans, count(distinct(l.group_id)) as activeGroupBorrowers, ifnull(sum(if(laa.loan_id is not null, 1, 0)), 0) as overdueGroupLoans from m_group topgroup join m_group g on g.hierarchy like concat(topgroup.hierarchy, '%') join m_loan l on l.group_id = g.id and l.client_id is null left join m_loan_arrears_aging laa on laa.loan_id = l.id -where topgroup.id = ${groupId} +where topgroup.id = ${groupId} and l.loan_status_id = 300) c ) x @@ -58,12 +58,12 @@ and o.id = g.office_id and o.hierarchy like concat('${currentUserHierarchy}', '%') "); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'READ_GroupSummaryCounts', 'GroupSummaryCounts', 'READ', 0); -INSERT INTO `stretchy_report` (`report_name`, `report_type`, `core_report`, `use_report`, `description`, `report_sql`) +INSERT INTO `stretchy_report` (`report_name`, `report_type`, `core_report`, `use_report`, `description`, `report_sql`) VALUES ('GroupSummaryAmounts', 'Table', true, false, 'Utility query for getting group summary currency amount details for a group_id', " @@ -85,6 +85,5 @@ group by l.currency_code -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'READ_GroupSummaryAmounts', 'GroupSummaryAmounts', 'READ', 0); - diff --git a/mifosng-db/migrations/core_db/V42__Add_default_value_for_id_for_acc_accounting_rule.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V42__Add_default_value_for_id_for_acc_accounting_rule.sql similarity index 100% rename from mifosng-db/migrations/core_db/V42__Add_default_value_for_id_for_acc_accounting_rule.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V42__Add_default_value_for_id_for_acc_accounting_rule.sql diff --git a/mifosng-db/migrations/core_db/V43__accounting-for-savings.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V43__accounting-for-savings.sql similarity index 99% rename from mifosng-db/migrations/core_db/V43__accounting-for-savings.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V43__accounting-for-savings.sql index 10cdcc046..cf2e1ce7d 100755 --- a/mifosng-db/migrations/core_db/V43__accounting-for-savings.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V43__accounting-for-savings.sql @@ -9,4 +9,3 @@ update m_savings_product set accounting_type=1; ALTER TABLE `m_savings_account_transaction` ADD COLUMN `payment_detail_id` BIGINT(20) NULL DEFAULT NULL AFTER `savings_account_id`, ADD CONSTRAINT `FK_m_savings_account_transaction_m_payment_detail` FOREIGN KEY (`payment_detail_id`) REFERENCES `m_payment_detail` (`id`); - diff --git a/mifosng-db/migrations/core_db/V44__document-increase-size-of-column-type.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V44__document-increase-size-of-column-type.sql similarity index 100% rename from mifosng-db/migrations/core_db/V44__document-increase-size-of-column-type.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V44__document-increase-size-of-column-type.sql diff --git a/mifosng-db/migrations/core_db/V45__create_acc_rule_tags_table.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V45__create_acc_rule_tags_table.sql similarity index 100% rename from mifosng-db/migrations/core_db/V45__create_acc_rule_tags_table.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V45__create_acc_rule_tags_table.sql diff --git a/mifosng-db/migrations/core_db/V46__extend_datatables_api.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V46__extend_datatables_api.sql similarity index 99% rename from mifosng-db/migrations/core_db/V46__extend_datatables_api.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V46__extend_datatables_api.sql index 5bd0a585e..8a90512fd 100644 --- a/mifosng-db/migrations/core_db/V46__extend_datatables_api.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V46__extend_datatables_api.sql @@ -7,4 +7,3 @@ INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `c ('configuration', 'UPDATE_DATATABLE_CHECKER', 'DATATABLE', 'UPDATE', 0), ('configuration', 'DELETE_DATATABLE', 'DATATABLE', 'DELETE', 0), ('configuration', 'DELETE_DATATABLE_CHECKER', 'DATATABLE', 'DELETE', 0); - diff --git a/mifosng-db/migrations/core_db/V47__staff-hierarchy-link-to-users.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V47__staff-hierarchy-link-to-users.sql similarity index 90% rename from mifosng-db/migrations/core_db/V47__staff-hierarchy-link-to-users.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V47__staff-hierarchy-link-to-users.sql index 1531b04d1..9a220bd80 100644 --- a/mifosng-db/migrations/core_db/V47__staff-hierarchy-link-to-users.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V47__staff-hierarchy-link-to-users.sql @@ -1,4 +1,4 @@ -ALTER TABLE `m_appuser` +ALTER TABLE `m_appuser` ADD COLUMN `staff_id` BIGINT(20) NULL DEFAULT NULL AFTER `office_id` ; ALTER TABLE m_appuser @@ -9,6 +9,6 @@ ON DELETE NO ACTION ON UPDATE NO ACTION ,ADD INDEX `fk_m_appuser_002x` (`staff_id` ASC); -ALTER TABLE `m_staff` +ALTER TABLE `m_staff` ADD COLUMN `organisational_role_enum` SMALLINT NULL DEFAULT NULL AFTER `external_id`, ADD COLUMN `organisational_role_parent_staff_id` BIGINT(20) NULL DEFAULT NULL AFTER `organisational_role_enum`; diff --git a/mifosng-db/migrations/core_db/V48__adding-S3-Support.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V48__adding-S3-Support.sql similarity index 92% rename from mifosng-db/migrations/core_db/V48__adding-S3-Support.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V48__adding-S3-Support.sql index 912598592..5df104db7 100755 --- a/mifosng-db/migrations/core_db/V48__adding-S3-Support.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V48__adding-S3-Support.sql @@ -43,19 +43,19 @@ DECLARE prev_image INT DEFAULT 0; SELECT COUNT(*) FROM m_client INTO num_of_clients; SET @curr_client := 0; while v_counter < num_of_clients do - SET @s = CONCAT('INSERT INTO m_image(`location`,`storage_type_enum`) select image_key, 1 FROM m_client where image_key is not null LIMIT ', v_counter , ', ', 1); - PREPARE stmt1 FROM @s; - EXECUTE stmt1; + SET @s = CONCAT('INSERT INTO m_image(`location`,`storage_type_enum`) select image_key, 1 FROM m_client where image_key is not null LIMIT ', v_counter , ', ', 1); + PREPARE stmt1 FROM @s; + EXECUTE stmt1; DEALLOCATE PREPARE stmt1; select ifnull(max(`id`),0) from m_image INTO curr_image; - SET @z = CONCAT('select id INTO @curr_client FROM m_client where image_key is not null limit ', v_counter , ', ', 1); - PREPARE stmt2 FROM @z; - EXECUTE stmt2; + SET @z = CONCAT('select id INTO @curr_client FROM m_client where image_key is not null limit ', v_counter , ', ', 1); + PREPARE stmt2 FROM @z; + EXECUTE stmt2; IF (prev_image != curr_image) THEN UPDATE m_client set image_id = curr_image where id=@curr_client; END IF; - + set prev_image=curr_image; set v_counter=v_counter+1; end while; @@ -75,4 +75,3 @@ ALTER TABLE `m_client` DROP COLUMN `image_key`; /*Add storage type for m_document table and update existing documents to file storage*/ ALTER TABLE m_document ADD COLUMN storage_type_enum SMALLINT(5); UPDATE m_document set storage_type_enum=1; - diff --git a/mifosng-db/migrations/core_db/V49__track-loan-charge-payment-transactions.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V49__track-loan-charge-payment-transactions.sql similarity index 99% rename from mifosng-db/migrations/core_db/V49__track-loan-charge-payment-transactions.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V49__track-loan-charge-payment-transactions.sql index 206e0f909..3e6a9833c 100755 --- a/mifosng-db/migrations/core_db/V49__track-loan-charge-payment-transactions.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V49__track-loan-charge-payment-transactions.sql @@ -11,4 +11,3 @@ CREATE TABLE `m_loan_charge_paid_by` ( ) COLLATE='utf8_general_ci' ENGINE=InnoDB; - diff --git a/mifosng-db/migrations/core_db/V4__mifosx-core-reports-utf8.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V4__mifosx-core-reports-utf8.sql similarity index 99% rename from mifosng-db/migrations/core_db/V4__mifosx-core-reports-utf8.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V4__mifosx-core-reports-utf8.sql index b6a728bd3..999500560 100644 --- a/mifosng-db/migrations/core_db/V4__mifosx-core-reports-utf8.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V4__mifosx-core-reports-utf8.sql @@ -9,4 +9,3 @@ INSERT INTO `stretchy_report_parameter` VALUES (1,5,NULL),(2,5,NULL),(2,6,NULL), insert into m_permission(grouping, `code`, entity_name, action_name, can_maker_checker) select 'report', concat('READ_', r.report_name), r.report_name, 'READ', false from stretchy_report r; - diff --git a/mifosng-db/migrations/core_db/V50__add-grace-settings-to-loan-product.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V50__add-grace-settings-to-loan-product.sql similarity index 92% rename from mifosng-db/migrations/core_db/V50__add-grace-settings-to-loan-product.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V50__add-grace-settings-to-loan-product.sql index bef3665d4..96f23e92c 100644 --- a/mifosng-db/migrations/core_db/V50__add-grace-settings-to-loan-product.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V50__add-grace-settings-to-loan-product.sql @@ -1,9 +1,9 @@ -ALTER TABLE `m_product_loan` +ALTER TABLE `m_product_loan` ADD COLUMN `grace_on_principal_periods` SMALLINT(5) NULL DEFAULT NULL AFTER `max_number_of_repayments`, ADD COLUMN `grace_on_interest_periods` SMALLINT(5) NULL DEFAULT NULL AFTER `grace_on_principal_periods`, ADD COLUMN `grace_interest_free_periods` SMALLINT(5) NULL DEFAULT NULL AFTER `grace_on_interest_periods`; -ALTER TABLE `m_loan` +ALTER TABLE `m_loan` ADD COLUMN `grace_on_principal_periods` SMALLINT(5) NULL DEFAULT NULL AFTER `number_of_repayments`, ADD COLUMN `grace_on_interest_periods` SMALLINT(5) NULL DEFAULT NULL AFTER `grace_on_principal_periods`, ADD COLUMN `grace_interest_free_periods` SMALLINT(5) NULL DEFAULT NULL AFTER `grace_on_interest_periods`; \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V51__track-additional-details-related-to-installment-performance.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V51__track-additional-details-related-to-installment-performance.sql similarity index 73% rename from mifosng-db/migrations/core_db/V51__track-additional-details-related-to-installment-performance.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V51__track-additional-details-related-to-installment-performance.sql index a383eec13..a59e5ec6a 100644 --- a/mifosng-db/migrations/core_db/V51__track-additional-details-related-to-installment-performance.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V51__track-additional-details-related-to-installment-performance.sql @@ -1,5 +1,5 @@ -ALTER TABLE `m_loan_repayment_schedule` +ALTER TABLE `m_loan_repayment_schedule` ADD COLUMN `obligations_met_on_date` DATE NULL DEFAULT NULL AFTER `completed_derived`; -ALTER TABLE `m_loan_repayment_schedule` +ALTER TABLE `m_loan_repayment_schedule` CHANGE COLUMN `interest_waived_derived` `interest_waived_derived` DECIMAL(19,6) NULL DEFAULT NULL AFTER `interest_writtenoff_derived` ; \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V52__add_boolean_support_cols_to_acc_accounting_rule.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V52__add_boolean_support_cols_to_acc_accounting_rule.sql similarity index 81% rename from mifosng-db/migrations/core_db/V52__add_boolean_support_cols_to_acc_accounting_rule.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V52__add_boolean_support_cols_to_acc_accounting_rule.sql index 55041d7d2..f042770a4 100644 --- a/mifosng-db/migrations/core_db/V52__add_boolean_support_cols_to_acc_accounting_rule.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V52__add_boolean_support_cols_to_acc_accounting_rule.sql @@ -1,6 +1,6 @@ -ALTER TABLE `acc_accounting_rule` +ALTER TABLE `acc_accounting_rule` ADD COLUMN `allow_multiple_debits` TINYINT(1) NOT NULL DEFAULT '0' AFTER `debit_account_id`, ADD COLUMN `allow_multiple_credits` TINYINT(1) NOT NULL DEFAULT '0' AFTER `credit_account_id`; -ALTER TABLE acc_rule_tags +ALTER TABLE acc_rule_tags ADD UNIQUE KEY `UNIQUE_ACCOUNT_RULE_TAGS` (`acc_rule_id`,`tag_id`,`acc_type_enum`); \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V53__track-advance-and-late-payments-on-installment.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V53__track-advance-and-late-payments-on-installment.sql similarity index 100% rename from mifosng-db/migrations/core_db/V53__track-advance-and-late-payments-on-installment.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V53__track-advance-and-late-payments-on-installment.sql diff --git a/mifosng-db/migrations/core_db/V54__charge-to-income-account-mappings.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V54__charge-to-income-account-mappings.sql similarity index 100% rename from mifosng-db/migrations/core_db/V54__charge-to-income-account-mappings.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V54__charge-to-income-account-mappings.sql diff --git a/mifosng-db/migrations/core_db/V55__add-additional-transaction-processing-strategies.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V55__add-additional-transaction-processing-strategies.sql similarity index 65% rename from mifosng-db/migrations/core_db/V55__add-additional-transaction-processing-strategies.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V55__add-additional-transaction-processing-strategies.sql index ea34e561a..48c10f6a3 100644 --- a/mifosng-db/migrations/core_db/V55__add-additional-transaction-processing-strategies.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V55__add-additional-transaction-processing-strategies.sql @@ -1,12 +1,12 @@ -ALTER TABLE `ref_loan_transaction_processing_strategy` -DROP COLUMN `lastmodified_date` , -DROP COLUMN `lastmodifiedby_id` , -DROP COLUMN `created_date` , +ALTER TABLE `ref_loan_transaction_processing_strategy` +DROP COLUMN `lastmodified_date` , +DROP COLUMN `lastmodifiedby_id` , +DROP COLUMN `created_date` , DROP COLUMN `createdby_id` ; -INSERT INTO `ref_loan_transaction_processing_strategy` (`id`, `code`, `name`) VALUES +INSERT INTO `ref_loan_transaction_processing_strategy` (`id`, `code`, `name`) VALUES (5,'principal-interest-penalties-fees-order-strategy', 'Principal Interest Penalties Fees Order'); -INSERT INTO `ref_loan_transaction_processing_strategy` (`id`,`code`, `name`) +INSERT INTO `ref_loan_transaction_processing_strategy` (`id`,`code`, `name`) VALUES (6,'interest-principal-penalties-fees-order-strategy', 'Interest Principal Penalties Fees Order'); \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V56__track-overpaid-amount-on-loans.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V56__track-overpaid-amount-on-loans.sql similarity index 82% rename from mifosng-db/migrations/core_db/V56__track-overpaid-amount-on-loans.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V56__track-overpaid-amount-on-loans.sql index ab9f5e4bc..99a235e2c 100644 --- a/mifosng-db/migrations/core_db/V56__track-overpaid-amount-on-loans.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V56__track-overpaid-amount-on-loans.sql @@ -1,2 +1,2 @@ -ALTER TABLE `m_loan` +ALTER TABLE `m_loan` ADD COLUMN `total_overpaid_derived` DECIMAL(19,6) NULL DEFAULT NULL AFTER `total_outstanding_derived`; \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V57__add_default_values_to_debit_and_credit_accounts_acc_accounting_rule.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V57__add_default_values_to_debit_and_credit_accounts_acc_accounting_rule.sql similarity index 100% rename from mifosng-db/migrations/core_db/V57__add_default_values_to_debit_and_credit_accounts_acc_accounting_rule.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V57__add_default_values_to_debit_and_credit_accounts_acc_accounting_rule.sql diff --git a/mifosng-db/migrations/core_db/V58__create-holiday-tables_changed.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V58__create-holiday-tables_changed.sql similarity index 100% rename from mifosng-db/migrations/core_db/V58__create-holiday-tables_changed.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V58__create-holiday-tables_changed.sql diff --git a/mifosng-db/migrations/core_db/V59__add_group_roles_schema_and_permissions.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V59__add_group_roles_schema_and_permissions.sql similarity index 100% rename from mifosng-db/migrations/core_db/V59__add_group_roles_schema_and_permissions.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V59__add_group_roles_schema_and_permissions.sql diff --git a/mifosng-db/migrations/core_db/V5__update-savings-product-and-account-tables.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V5__update-savings-product-and-account-tables.sql similarity index 59% rename from mifosng-db/migrations/core_db/V5__update-savings-product-and-account-tables.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V5__update-savings-product-and-account-tables.sql index b8c72d9c9..a97eab70f 100644 --- a/mifosng-db/migrations/core_db/V5__update-savings-product-and-account-tables.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V5__update-savings-product-and-account-tables.sql @@ -1,11 +1,11 @@ -ALTER TABLE `m_savings_product` +ALTER TABLE `m_savings_product` DROP COLUMN `nominal_interest_rate_period_frequency_enum`, -CHANGE COLUMN `nominal_interest_rate_per_period` `nominal_annual_interest_rate` DECIMAL(19,6) NOT NULL, +CHANGE COLUMN `nominal_interest_rate_per_period` `nominal_annual_interest_rate` DECIMAL(19,6) NOT NULL, CHANGE COLUMN `interest_period_enum` `interest_compounding_period_enum` SMALLINT(5) NOT NULL; -ALTER TABLE `m_savings_account` -DROP COLUMN `annual_nominal_interest_rate`, -DROP COLUMN `nominal_interest_rate_period_frequency_enum`, -CHANGE COLUMN `nominal_interest_rate_per_period` `nominal_annual_interest_rate` DECIMAL(19,6) NOT NULL, +ALTER TABLE `m_savings_account` +DROP COLUMN `annual_nominal_interest_rate`, +DROP COLUMN `nominal_interest_rate_period_frequency_enum`, +CHANGE COLUMN `nominal_interest_rate_per_period` `nominal_annual_interest_rate` DECIMAL(19,6) NOT NULL, CHANGE COLUMN `interest_period_enum` `interest_compounding_period_enum` SMALLINT(5) NOT NULL; \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V60__quipo_dashboard_reports.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V60__quipo_dashboard_reports.sql similarity index 92% rename from mifosng-db/migrations/core_db/V60__quipo_dashboard_reports.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V60__quipo_dashboard_reports.sql index e1fe17ae3..22d79e808 100644 --- a/mifosng-db/migrations/core_db/V60__quipo_dashboard_reports.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V60__quipo_dashboard_reports.sql @@ -1,6 +1,6 @@ /* Leaving as out-of-box (but non-core reports) for now could be removed later if people think too many non-generic -reports are being added +reports are being added used in quipo TEVI dashboard (landing pages) */ DELETE FROM `stretchy_report` where report_name = 'FieldAgentStats'; @@ -22,7 +22,7 @@ DELETE FROM `m_permission` where entity_name = 'ProgramDirectorStats'; DELETE FROM `m_permission` where entity_name = 'ProgramStats'; -INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) +INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) VALUES ('FieldAgentStats', 'Table', 'Quipo', false, false, 'Field Agent Statistics', " @@ -54,7 +54,7 @@ join m_office o on o.id = fa.office_id join m_group pgm on pgm.staff_id = fa.id join m_loan l on l.group_id = pgm.id and l.client_id is not null left join m_currency cur on cur.code = l.currency_code -left join m_loan_arrears_aging laa on laa.loan_id = l.id +left join m_loan_arrears_aging laa on laa.loan_id = l.id join m_client c on c.id = l.client_id where fa.id = ${staffId} and l.loan_status_id = 300 @@ -62,25 +62,25 @@ group by l.currency_code "); -INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) +INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) VALUES ('FieldAgentPrograms', 'Table', 'Quipo', false, false, 'List of Field Agent Programs', -" +" select pgm.id, pgm.display_name as `name`, sts.enum_message_property as status - from m_group pgm + from m_group pgm join m_office o on o.id = pgm.office_id - and o.hierarchy like concat('${currentUserHierarchy}', '%') + and o.hierarchy like concat('${currentUserHierarchy}', '%') left join r_enum_value sts on sts.enum_name = 'status_enum' and sts.enum_id = pgm.status_enum - where pgm.staff_id = ${staffId} + where pgm.staff_id = ${staffId} "); -INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) +INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) VALUES ('ProgramDetails', 'Table', 'Quipo', false, false, 'List of Loans in a Program', " select l.id as loanId, l.account_no as loanAccountNo, c.id as clientId, c.account_no as clientAccountNo, - pgm.display_name as programName, + pgm.display_name as programName, (select count(*) from m_loan cy @@ -91,9 +91,9 @@ c.display_name as clientDisplayName, ifnull(cur.display_symbol, l.currency_code) as Currency, ifnull(l.principal_repaid_derived,0.0) as loanRepaidAmount, ifnull(l.principal_outstanding_derived, 0.0) as loanOutstandingAmount, - '???' as loanInAdvanceAmount, + '???' as loanInAdvanceAmount, -ifnull(laa.principal_overdue_derived, 0.0) as loanInArrearsAmount, +ifnull(laa.principal_overdue_derived, 0.0) as loanInArrearsAmount, if(ifnull(laa.principal_overdue_derived, 0.00) > 0, 'Yes', 'No') as inDefault, if(date_sub(curdate(), interval 28 day) > ifnull(laa.overdue_since_date_derived, curdate()), @@ -101,7 +101,7 @@ if(date_sub(curdate(), interval 28 day) > ifnull(laa.overdue_since_date_derived, from m_group pgm join m_office o on o.id = pgm.office_id - and o.hierarchy like concat('${currentUserHierarchy}', '%') + and o.hierarchy like concat('${currentUserHierarchy}', '%') join m_loan l on l.group_id = pgm.id and l.client_id is not null left join m_currency cur on cur.code = l.currency_code join m_client c on c.id = l.client_id @@ -109,25 +109,25 @@ if(date_sub(curdate(), interval 28 day) > ifnull(laa.overdue_since_date_derived, where pgm.id = ${programId} and l.loan_status_id = 300 order by c.display_name, l.account_no - + "); -INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) +INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) VALUES ('ChildrenStaffList', 'Table', 'Quipo', false, false, 'Get Next Level Down Staff', " - select s.id, s.display_name, -s.firstname, s.lastname, s.organisational_role_enum, -s.organisational_role_parent_staff_id, -sp.display_name as `organisational_role_parent_staff_display_name` -from m_staff s -join m_staff sp on s.organisational_role_parent_staff_id = sp.id + select s.id, s.display_name, +s.firstname, s.lastname, s.organisational_role_enum, +s.organisational_role_parent_staff_id, +sp.display_name as `organisational_role_parent_staff_display_name` +from m_staff s +join m_staff sp on s.organisational_role_parent_staff_id = sp.id where s.organisational_role_parent_staff_id = ${staffId} "); -INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) +INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) VALUES ('CoordinatorStats', 'Table', 'Quipo', false, false, 'Coordinator Statistics', " @@ -160,7 +160,7 @@ join m_office o on o.id = fa.office_id join m_group pgm on pgm.staff_id = fa.id join m_loan l on l.group_id = pgm.id and l.client_id is not null left join m_currency cur on cur.code = l.currency_code -left join m_loan_arrears_aging laa on laa.loan_id = l.id +left join m_loan_arrears_aging laa on laa.loan_id = l.id join m_client c on c.id = l.client_id where coord.id = ${staffId} and l.loan_status_id = 300 @@ -168,7 +168,7 @@ group by l.currency_code "); -INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) +INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) VALUES ('BranchManagerStats', 'Table', 'Quipo', false, false, 'Branch Manager Statistics', " @@ -202,7 +202,7 @@ join m_office o on o.id = fa.office_id join m_group pgm on pgm.staff_id = fa.id join m_loan l on l.group_id = pgm.id and l.client_id is not null left join m_currency cur on cur.code = l.currency_code -left join m_loan_arrears_aging laa on laa.loan_id = l.id +left join m_loan_arrears_aging laa on laa.loan_id = l.id join m_client c on c.id = l.client_id where bm.id = ${staffId} and l.loan_status_id = 300 @@ -210,7 +210,7 @@ group by l.currency_code "); -INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) +INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) VALUES ('ProgramDirectorStats', 'Table', 'Quipo', false, false, 'Program DirectorStatistics', " @@ -245,7 +245,7 @@ join m_office o on o.id = fa.office_id join m_group pgm on pgm.staff_id = fa.id join m_loan l on l.group_id = pgm.id and l.client_id is not null left join m_currency cur on cur.code = l.currency_code -left join m_loan_arrears_aging laa on laa.loan_id = l.id +left join m_loan_arrears_aging laa on laa.loan_id = l.id join m_client c on c.id = l.client_id where pd.id = ${staffId} and l.loan_status_id = 300 @@ -253,7 +253,7 @@ group by l.currency_code "); -INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) +INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) VALUES ('ProgramStats', 'Table', 'Quipo', false, false, 'Program Statistics', " @@ -284,7 +284,7 @@ join m_office o on o.id = pgm.office_id and o.hierarchy like concat('${currentUserHierarchy}', '%') join m_loan l on l.group_id = pgm.id and l.client_id is not null left join m_currency cur on cur.code = l.currency_code -left join m_loan_arrears_aging laa on laa.loan_id = l.id +left join m_loan_arrears_aging laa on laa.loan_id = l.id join m_client c on c.id = l.client_id where pgm.id = ${programId} and l.loan_status_id = 300 @@ -293,28 +293,26 @@ group by l.currency_code -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'READ_FieldAgentStats', 'FieldAgentStats', 'READ', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'READ_FieldAgentPrograms', 'FieldAgentPrograms', 'READ', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'READ_ProgramDetails', 'ProgramDetails', 'READ', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'READ_ChildrenStaffList', 'ChildrenStaffList', 'READ', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'READ_CoordinatorStats', 'CoordinatorStats', 'READ', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'READ_BranchManagerStats', 'BranchManagerStats', 'READ', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'READ_ProgramDirectorStats', 'ProgramDirectorStats', 'READ', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'READ_ProgramStats', 'ProgramStats', 'READ', 0); - - diff --git a/mifosng-db/migrations/core_db/V61__txn_running_balance_example.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V61__txn_running_balance_example.sql similarity index 85% rename from mifosng-db/migrations/core_db/V61__txn_running_balance_example.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V61__txn_running_balance_example.sql index e6a75f82c..4a13da002 100644 --- a/mifosng-db/migrations/core_db/V61__txn_running_balance_example.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V61__txn_running_balance_example.sql @@ -1,7 +1,7 @@ /* Leaving as out-of-box (but non-core report) for now could be removed later if people think too many non-generic -reports are being added +reports are being added similar example used in small MFI Elevate Africa */ @@ -13,8 +13,8 @@ DELETE FROM `stretchy_report` where report_name = 'TxnRunningBalances'; DELETE FROM `m_permission` where entity_name = 'TxnRunningBalances'; -INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) -VALUES ('TxnRunningBalances', 'Table', 'Transaction', false, false, +INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) +VALUES ('TxnRunningBalances', 'Table', 'Transaction', false, false, "Running Balance Txn report for Individual Lending. Suitable for small MFI's. Larger could use it using the branch or other parameters. Basically, suck it and see if its quick enough for you out-of-te box or whether it needs performance work in your situation. @@ -22,28 +22,28 @@ Basically, suck it and see if its quick enough for you out-of-te box or whether " select date('${startDate}') as 'Transaction Date', 'Opening Balance' as `Transaction Type`, null as Office, - null as 'Loan Officer', null as `Loan Account No`, null as `Loan Product`, null as `Currency`, - null as `Client Account No`, null as Client, + null as 'Loan Officer', null as `Loan Account No`, null as `Loan Product`, null as `Currency`, + null as `Client Account No`, null as Client, null as Amount, null as Principal, null as Interest, -@totalOutstandingPrincipal := +@totalOutstandingPrincipal := ifnull(round(sum( if (txn.transaction_type_enum = 1 /* disbursement */, - ifnull(txn.amount,0.00), - ifnull(txn.principal_portion_derived,0.00) * -1)) + ifnull(txn.amount,0.00), + ifnull(txn.principal_portion_derived,0.00) * -1)) ,2),0.00) as 'Outstanding Principal', -@totalInterestIncome := +@totalInterestIncome := ifnull(round(sum( if (txn.transaction_type_enum in (2,5,8) /* repayment, repayment at disbursal, recovery repayment */, - ifnull(txn.interest_portion_derived,0.00), + ifnull(txn.interest_portion_derived,0.00), 0)) ,2),0.00) as 'Interest Income', @totalWriteOff := ifnull(round(sum( if (txn.transaction_type_enum = 6 /* write-off */, - ifnull(txn.principal_portion_derived,0.00), - 0)) + ifnull(txn.principal_portion_derived,0.00), + 0)) ,2),0.00) as 'Principal Write Off' from m_office o join m_office ounder on ounder.hierarchy like concat(o.hierarchy, '%') @@ -53,37 +53,37 @@ join m_loan l on l.client_id = c.id join m_product_loan lp on lp.id = l.product_id join m_loan_transaction txn on txn.loan_id = l.id left join m_currency cur on cur.code = l.currency_code -where txn.is_reversed = false +where txn.is_reversed = false and txn.transaction_type_enum not in (10,11) and o.id = ${officeId} and txn.transaction_date < date('${startDate}') union all -select x.`Transaction Date`, x.`Transaction Type`, x.Office, x.`Loan Officer`, x.`Loan Account No`, x.`Loan Product`, x.`Currency`, +select x.`Transaction Date`, x.`Transaction Type`, x.Office, x.`Loan Officer`, x.`Loan Account No`, x.`Loan Product`, x.`Currency`, x.`Client Account No`, x.Client, x.Amount, x.Principal, x.Interest, -cast(round( +cast(round( if (x.transaction_type_enum = 1 /* disbursement */, - @totalOutstandingPrincipal := @totalOutstandingPrincipal + x.`Amount`, - @totalOutstandingPrincipal := @totalOutstandingPrincipal - x.`Principal`) + @totalOutstandingPrincipal := @totalOutstandingPrincipal + x.`Amount`, + @totalOutstandingPrincipal := @totalOutstandingPrincipal - x.`Principal`) ,2) as decimal(19,2)) as 'Outstanding Principal', cast(round( if (x.transaction_type_enum in (2,5,8) /* repayment, repayment at disbursal, recovery repayment */, - @totalInterestIncome := @totalInterestIncome + x.`Interest`, - @totalInterestIncome) + @totalInterestIncome := @totalInterestIncome + x.`Interest`, + @totalInterestIncome) ,2) as decimal(19,2)) as 'Interest Income', cast(round( if (x.transaction_type_enum = 6 /* write-off */, - @totalWriteOff := @totalWriteOff + x.`Principal`, - @totalWriteOff) + @totalWriteOff := @totalWriteOff + x.`Principal`, + @totalWriteOff) ,2) as decimal(19,2)) as 'Principal Write Off' from -(select txn.transaction_type_enum, txn.id as txn_id, txn.transaction_date as 'Transaction Date', +(select txn.transaction_type_enum, txn.id as txn_id, txn.transaction_date as 'Transaction Date', cast( - ifnull(re.enum_message_property, concat('Unknown Transaction Type Value: ' , txn.transaction_type_enum)) + ifnull(re.enum_message_property, concat('Unknown Transaction Type Value: ' , txn.transaction_type_enum)) as char) as 'Transaction Type', ounder.`name` as Office, lo.display_name as 'Loan Officer', -l.account_no as 'Loan Account No', lp.`name` as 'Loan Product', +l.account_no as 'Loan Account No', lp.`name` as 'Loan Product', ifnull(cur.display_symbol, l.currency_code) as Currency, c.account_no as 'Client Account No', c.display_name as 'Client', ifnull(txn.amount,0.00) as Amount, @@ -100,7 +100,7 @@ join m_loan_transaction txn on txn.loan_id = l.id left join m_currency cur on cur.code = l.currency_code left join r_enum_value re on re.enum_name = 'transaction_type_enum' and re.enum_id = txn.transaction_type_enum -where txn.is_reversed = false +where txn.is_reversed = false and txn.transaction_type_enum not in (10,11) and (ifnull(l.loan_officer_id, -10) = '${loanOfficerId}' or '-1' = '${loanOfficerId}') and o.id = ${officeId} @@ -111,7 +111,7 @@ order by txn.transaction_date, txn.id) x -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'READ_TxnRunningBalances', 'TxnRunningBalances', 'READ', 0); @@ -120,5 +120,5 @@ select r.id, p.id from stretchy_report r, stretchy_parameter p where r.report_name = 'TxnRunningBalances' -and p.parameter_name in ('startDateSelect', 'endDateSelect', 'OfficeIdSelectOne', +and p.parameter_name in ('startDateSelect', 'endDateSelect', 'OfficeIdSelectOne', 'loanOfficerIdSelectAll'); \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V62__add_staff_id_to_m_client_changed.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V62__add_staff_id_to_m_client_changed.sql similarity index 100% rename from mifosng-db/migrations/core_db/V62__add_staff_id_to_m_client_changed.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V62__add_staff_id_to_m_client_changed.sql diff --git a/mifosng-db/migrations/core_db/V63__add_sync_disbursement_with_meeting_column_to_loan.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V63__add_sync_disbursement_with_meeting_column_to_loan.sql similarity index 100% rename from mifosng-db/migrations/core_db/V63__add_sync_disbursement_with_meeting_column_to_loan.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V63__add_sync_disbursement_with_meeting_column_to_loan.sql diff --git a/mifosng-db/migrations/core_db/V64__add_permission_for_assign_staff.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V64__add_permission_for_assign_staff.sql similarity index 100% rename from mifosng-db/migrations/core_db/V64__add_permission_for_assign_staff.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V64__add_permission_for_assign_staff.sql diff --git a/mifosng-db/migrations/core_db/V65__fix_rupee_symbol_issues.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V65__fix_rupee_symbol_issues.sql similarity index 100% rename from mifosng-db/migrations/core_db/V65__fix_rupee_symbol_issues.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V65__fix_rupee_symbol_issues.sql diff --git a/mifosng-db/migrations/core_db/V66__client_close_functionality.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V66__client_close_functionality.sql similarity index 99% rename from mifosng-db/migrations/core_db/V66__client_close_functionality.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V66__client_close_functionality.sql index 5212fea32..9c548170e 100644 --- a/mifosng-db/migrations/core_db/V66__client_close_functionality.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V66__client_close_functionality.sql @@ -5,4 +5,3 @@ ADD COLUMN `closedon_date` DATE NULL DEFAULT NULL, ADD CONSTRAINT `FK_m_client_m_code` FOREIGN KEY (`closure_reason_cv_id`) REFERENCES `m_code_value` (`id`); INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`) VALUES ('portfolio', 'CLOSE_CLIENT', 'CLIENT', 'CLOSE'); - diff --git a/mifosng-db/migrations/core_db/V67__loans_in_advance_table.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V67__loans_in_advance_table.sql similarity index 99% rename from mifosng-db/migrations/core_db/V67__loans_in_advance_table.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V67__loans_in_advance_table.sql index 6a6ac1f33..d6c60d7fd 100644 --- a/mifosng-db/migrations/core_db/V67__loans_in_advance_table.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V67__loans_in_advance_table.sql @@ -10,5 +10,3 @@ CREATE TABLE `m_loan_paid_in_advance` ( PRIMARY KEY (`loan_id`), CONSTRAINT `m_loan_paid_in_advance_ibfk_1` FOREIGN KEY (`loan_id`) REFERENCES `m_loan` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - diff --git a/mifosng-db/migrations/core_db/V68__quipo_dashboard_reports_updated.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V68__quipo_dashboard_reports_updated.sql similarity index 91% rename from mifosng-db/migrations/core_db/V68__quipo_dashboard_reports_updated.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V68__quipo_dashboard_reports_updated.sql index ef24d1988..7326448bb 100644 --- a/mifosng-db/migrations/core_db/V68__quipo_dashboard_reports_updated.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V68__quipo_dashboard_reports_updated.sql @@ -1,6 +1,6 @@ /* Leaving as out-of-box (but non-core reports) for now could be removed later if people think too many non-generic -reports are being added +reports are being added used in quipo TEVI dashboard (landing pages) */ DELETE FROM `stretchy_report` where report_name = 'FieldAgentStats'; @@ -22,7 +22,7 @@ DELETE FROM `m_permission` where entity_name = 'ProgramDirectorStats'; DELETE FROM `m_permission` where entity_name = 'ProgramStats'; -INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) +INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) VALUES ('FieldAgentStats', 'Table', 'Quipo', false, false, 'Field Agent Statistics', " @@ -54,8 +54,8 @@ join m_office o on o.id = fa.office_id join m_group pgm on pgm.staff_id = fa.id join m_loan l on l.group_id = pgm.id and l.client_id is not null left join m_currency cur on cur.code = l.currency_code -left join m_loan_arrears_aging laa on laa.loan_id = l.id -left join m_loan_paid_in_advance lpa on lpa.loan_id = l.id +left join m_loan_arrears_aging laa on laa.loan_id = l.id +left join m_loan_paid_in_advance lpa on lpa.loan_id = l.id join m_client c on c.id = l.client_id where fa.id = ${staffId} and l.loan_status_id = 300 @@ -63,25 +63,25 @@ group by l.currency_code "); -INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) +INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) VALUES ('FieldAgentPrograms', 'Table', 'Quipo', false, false, 'List of Field Agent Programs', -" +" select pgm.id, pgm.display_name as `name`, sts.enum_message_property as status - from m_group pgm + from m_group pgm join m_office o on o.id = pgm.office_id - and o.hierarchy like concat('${currentUserHierarchy}', '%') + and o.hierarchy like concat('${currentUserHierarchy}', '%') left join r_enum_value sts on sts.enum_name = 'status_enum' and sts.enum_id = pgm.status_enum - where pgm.staff_id = ${staffId} + where pgm.staff_id = ${staffId} "); -INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) +INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) VALUES ('ProgramDetails', 'Table', 'Quipo', false, false, 'List of Loans in a Program', " select l.id as loanId, l.account_no as loanAccountNo, c.id as clientId, c.account_no as clientAccountNo, - pgm.display_name as programName, + pgm.display_name as programName, (select count(*) from m_loan cy @@ -94,7 +94,7 @@ ifnull(l.principal_repaid_derived,0.0) as loanRepaidAmount, ifnull(l.principal_outstanding_derived, 0.0) as loanOutstandingAmount, sum(ifnull(lpa.principal_in_advance_derived,0.0)) as LoanPaidInAdvance, -ifnull(laa.principal_overdue_derived, 0.0) as loanInArrearsAmount, +ifnull(laa.principal_overdue_derived, 0.0) as loanInArrearsAmount, if(ifnull(laa.principal_overdue_derived, 0.00) > 0, 'Yes', 'No') as inDefault, if(date_sub(curdate(), interval 28 day) > ifnull(laa.overdue_since_date_derived, curdate()), @@ -102,34 +102,34 @@ if(date_sub(curdate(), interval 28 day) > ifnull(laa.overdue_since_date_derived, from m_group pgm join m_office o on o.id = pgm.office_id - and o.hierarchy like concat('${currentUserHierarchy}', '%') + and o.hierarchy like concat('${currentUserHierarchy}', '%') join m_loan l on l.group_id = pgm.id and l.client_id is not null left join m_currency cur on cur.code = l.currency_code join m_client c on c.id = l.client_id left join m_loan_arrears_aging laa on laa.loan_id = l.id - left join m_loan_paid_in_advance lpa on lpa.loan_id = l.id + left join m_loan_paid_in_advance lpa on lpa.loan_id = l.id where pgm.id = ${programId} and l.loan_status_id = 300 order by c.display_name, l.account_no - + "); -INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) +INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) VALUES ('ChildrenStaffList', 'Table', 'Quipo', false, false, 'Get Next Level Down Staff', " - select s.id, s.display_name, -s.firstname, s.lastname, s.organisational_role_enum, -s.organisational_role_parent_staff_id, -sp.display_name as `organisational_role_parent_staff_display_name` -from m_staff s -join m_staff sp on s.organisational_role_parent_staff_id = sp.id + select s.id, s.display_name, +s.firstname, s.lastname, s.organisational_role_enum, +s.organisational_role_parent_staff_id, +sp.display_name as `organisational_role_parent_staff_display_name` +from m_staff s +join m_staff sp on s.organisational_role_parent_staff_id = sp.id where s.organisational_role_parent_staff_id = ${staffId} "); -INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) +INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) VALUES ('CoordinatorStats', 'Table', 'Quipo', false, false, 'Coordinator Statistics', " @@ -162,8 +162,8 @@ join m_office o on o.id = fa.office_id join m_group pgm on pgm.staff_id = fa.id join m_loan l on l.group_id = pgm.id and l.client_id is not null left join m_currency cur on cur.code = l.currency_code -left join m_loan_arrears_aging laa on laa.loan_id = l.id -left join m_loan_paid_in_advance lpa on lpa.loan_id = l.id +left join m_loan_arrears_aging laa on laa.loan_id = l.id +left join m_loan_paid_in_advance lpa on lpa.loan_id = l.id join m_client c on c.id = l.client_id where coord.id = ${staffId} and l.loan_status_id = 300 @@ -171,7 +171,7 @@ group by l.currency_code "); -INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) +INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) VALUES ('BranchManagerStats', 'Table', 'Quipo', false, false, 'Branch Manager Statistics', " @@ -205,8 +205,8 @@ join m_office o on o.id = fa.office_id join m_group pgm on pgm.staff_id = fa.id join m_loan l on l.group_id = pgm.id and l.client_id is not null left join m_currency cur on cur.code = l.currency_code -left join m_loan_arrears_aging laa on laa.loan_id = l.id -left join m_loan_paid_in_advance lpa on lpa.loan_id = l.id +left join m_loan_arrears_aging laa on laa.loan_id = l.id +left join m_loan_paid_in_advance lpa on lpa.loan_id = l.id join m_client c on c.id = l.client_id where bm.id = ${staffId} and l.loan_status_id = 300 @@ -214,7 +214,7 @@ group by l.currency_code "); -INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) +INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) VALUES ('ProgramDirectorStats', 'Table', 'Quipo', false, false, 'Program DirectorStatistics', " @@ -249,8 +249,8 @@ join m_office o on o.id = fa.office_id join m_group pgm on pgm.staff_id = fa.id join m_loan l on l.group_id = pgm.id and l.client_id is not null left join m_currency cur on cur.code = l.currency_code -left join m_loan_arrears_aging laa on laa.loan_id = l.id -left join m_loan_paid_in_advance lpa on lpa.loan_id = l.id +left join m_loan_arrears_aging laa on laa.loan_id = l.id +left join m_loan_paid_in_advance lpa on lpa.loan_id = l.id join m_client c on c.id = l.client_id where pd.id = ${staffId} and l.loan_status_id = 300 @@ -258,7 +258,7 @@ group by l.currency_code "); -INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) +INSERT INTO `stretchy_report` (`report_name`, `report_type`, `report_category`, `core_report`, `use_report`, `description`, `report_sql`) VALUES ('ProgramStats', 'Table', 'Quipo', false, false, 'Program Statistics', " @@ -289,8 +289,8 @@ join m_office o on o.id = pgm.office_id and o.hierarchy like concat('${currentUserHierarchy}', '%') join m_loan l on l.group_id = pgm.id and l.client_id is not null left join m_currency cur on cur.code = l.currency_code -left join m_loan_arrears_aging laa on laa.loan_id = l.id -left join m_loan_paid_in_advance lpa on lpa.loan_id = l.id +left join m_loan_arrears_aging laa on laa.loan_id = l.id +left join m_loan_paid_in_advance lpa on lpa.loan_id = l.id join m_client c on c.id = l.client_id where pgm.id = ${programId} and l.loan_status_id = 300 @@ -299,28 +299,26 @@ group by l.currency_code -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'READ_FieldAgentStats', 'FieldAgentStats', 'READ', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'READ_FieldAgentPrograms', 'FieldAgentPrograms', 'READ', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'READ_ProgramDetails', 'ProgramDetails', 'READ', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'READ_ChildrenStaffList', 'ChildrenStaffList', 'READ', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'READ_CoordinatorStats', 'CoordinatorStats', 'READ', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'READ_BranchManagerStats', 'BranchManagerStats', 'READ', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'READ_ProgramDirectorStats', 'ProgramDirectorStats', 'READ', 0); -INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) +INSERT INTO `m_permission` (`grouping`, `code`, `entity_name`, `action_name`, `can_maker_checker`) VALUES ('report', 'READ_ProgramStats', 'ProgramStats', 'READ', 0); - - diff --git a/mifosng-db/migrations/core_db/V69__loans_in_advance_initialise.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V69__loans_in_advance_initialise.sql similarity index 83% rename from mifosng-db/migrations/core_db/V69__loans_in_advance_initialise.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V69__loans_in_advance_initialise.sql index 9f3cb3ef8..1341d7729 100644 --- a/mifosng-db/migrations/core_db/V69__loans_in_advance_initialise.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V69__loans_in_advance_initialise.sql @@ -2,18 +2,18 @@ truncate m_loan_paid_in_advance; -INSERT INTO m_loan_paid_in_advance(loan_id, principal_in_advance_derived, interest_in_advance_derived, +INSERT INTO m_loan_paid_in_advance(loan_id, principal_in_advance_derived, interest_in_advance_derived, fee_charges_in_advance_derived, penalty_charges_in_advance_derived, total_in_advance_derived) select ml.id as loanId,SUM(ifnull(mr.principal_completed_derived, 0)) as principal_in_advance_derived, SUM(ifnull(mr.interest_completed_derived, 0)) as interest_in_advance_derived, SUM(ifnull(mr.fee_charges_completed_derived, 0)) as fee_charges_in_advance_derived, SUM(ifnull(mr.penalty_charges_completed_derived, 0)) as penalty_charges_in_advance_derived, -(SUM(ifnull(mr.principal_completed_derived, 0)) + SUM(ifnull(mr.interest_completed_derived, 0)) + +(SUM(ifnull(mr.principal_completed_derived, 0)) + SUM(ifnull(mr.interest_completed_derived, 0)) + SUM(ifnull(mr.fee_charges_completed_derived, 0)) + SUM(ifnull(mr.penalty_charges_completed_derived, 0))) as total_in_advance_derived -FROM m_loan ml -INNER JOIN m_loan_repayment_schedule mr on mr.loan_id = ml.id -WHERE ml.loan_status_id = 300 and mr.duedate >= CURDATE() +FROM m_loan ml +INNER JOIN m_loan_repayment_schedule mr on mr.loan_id = ml.id +WHERE ml.loan_status_id = 300 and mr.duedate >= CURDATE() GROUP BY ml.id HAVING (SUM(ifnull(mr.principal_completed_derived, 0)) + SUM(ifnull(mr.interest_completed_derived, 0)) + SUM(ifnull(mr.fee_charges_completed_derived, 0)) + SUM(ifnull(mr.penalty_charges_completed_derived, 0))) > 0.0 \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V6__add_min_max_principal_column_to_loan.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V6__add_min_max_principal_column_to_loan.sql similarity index 93% rename from mifosng-db/migrations/core_db/V6__add_min_max_principal_column_to_loan.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V6__add_min_max_principal_column_to_loan.sql index 399724860..4a5c527e1 100644 --- a/mifosng-db/migrations/core_db/V6__add_min_max_principal_column_to_loan.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V6__add_min_max_principal_column_to_loan.sql @@ -1,7 +1,7 @@ ALTER TABLE `m_product_loan` ADD COLUMN `min_principal_amount` DECIMAL(19,6) NOT NULL AFTER `principal_amount`, ADD COLUMN `max_principal_amount` DECIMAL(19,6) NOT NULL AFTER `min_principal_amount`; - + ALTER TABLE `m_loan` ADD COLUMN `min_principal_amount` DECIMAL(19,6) NOT NULL AFTER `principal_amount`, - ADD COLUMN `max_principal_amount` DECIMAL(19,6) NOT NULL AFTER `min_principal_amount`; \ No newline at end of file + ADD COLUMN `max_principal_amount` DECIMAL(19,6) NOT NULL AFTER `min_principal_amount`; \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V70__quipo_program_detail_query_fix.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V70__quipo_program_detail_query_fix.sql similarity index 87% rename from mifosng-db/migrations/core_db/V70__quipo_program_detail_query_fix.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V70__quipo_program_detail_query_fix.sql index 79477636a..dcf295233 100644 --- a/mifosng-db/migrations/core_db/V70__quipo_program_detail_query_fix.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V70__quipo_program_detail_query_fix.sql @@ -1,9 +1,9 @@ update stretchy_report -set report_sql = +set report_sql = " select l.id as loanId, l.account_no as loanAccountNo, c.id as clientId, c.account_no as clientAccountNo, - pgm.display_name as programName, + pgm.display_name as programName, (select count(*) from m_loan cy @@ -16,7 +16,7 @@ ifnull(l.principal_repaid_derived,0.0) as loanRepaidAmount, ifnull(l.principal_outstanding_derived, 0.0) as loanOutstandingAmount, ifnull(lpa.principal_in_advance_derived,0.0) as LoanPaidInAdvance, -ifnull(laa.principal_overdue_derived, 0.0) as loanInArrearsAmount, +ifnull(laa.principal_overdue_derived, 0.0) as loanInArrearsAmount, if(ifnull(laa.principal_overdue_derived, 0.00) > 0, 'Yes', 'No') as inDefault, if(date_sub(curdate(), interval 28 day) > ifnull(laa.overdue_since_date_derived, curdate()), @@ -24,15 +24,15 @@ if(date_sub(curdate(), interval 28 day) > ifnull(laa.overdue_since_date_derived, from m_group pgm join m_office o on o.id = pgm.office_id - and o.hierarchy like concat('${currentUserHierarchy}', '%') + and o.hierarchy like concat('${currentUserHierarchy}', '%') join m_loan l on l.group_id = pgm.id and l.client_id is not null left join m_currency cur on cur.code = l.currency_code join m_client c on c.id = l.client_id left join m_loan_arrears_aging laa on laa.loan_id = l.id - left join m_loan_paid_in_advance lpa on lpa.loan_id = l.id + left join m_loan_paid_in_advance lpa on lpa.loan_id = l.id where pgm.id = ${programId} and l.loan_status_id = 300 order by c.display_name, l.account_no - + " where report_name = 'ProgramDetails'; diff --git a/mifosng-db/migrations/core_db/V71__insert_reschedule_repayment_to_configuration.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V71__insert_reschedule_repayment_to_configuration.sql similarity index 100% rename from mifosng-db/migrations/core_db/V71__insert_reschedule_repayment_to_configuration.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V71__insert_reschedule_repayment_to_configuration.sql diff --git a/mifosng-db/migrations/core_db/V72__add_m_loan_counter_changes.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V72__add_m_loan_counter_changes.sql similarity index 96% rename from mifosng-db/migrations/core_db/V72__add_m_loan_counter_changes.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V72__add_m_loan_counter_changes.sql index ffee4856e..3cd450c6c 100644 --- a/mifosng-db/migrations/core_db/V72__add_m_loan_counter_changes.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V72__add_m_loan_counter_changes.sql @@ -1,6 +1,6 @@ -ALTER TABLE m_product_loan +ALTER TABLE m_product_loan ADD COLUMN `include_in_borrower_cycle` TINYINT(1) NOT NULL DEFAULT '0'; - + CREATE TABLE `m_client_loan_counter` ( `id` BIGINT(20) NOT NULL AUTO_INCREMENT, `client_id` BIGINT(20) NOT NULL, diff --git a/mifosng-db/migrations/core_db/V73__add_repayments_rescheduled_to_and_processed_column_to_holiday.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V73__add_repayments_rescheduled_to_and_processed_column_to_holiday.sql similarity index 100% rename from mifosng-db/migrations/core_db/V73__add_repayments_rescheduled_to_and_processed_column_to_holiday.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V73__add_repayments_rescheduled_to_and_processed_column_to_holiday.sql diff --git a/mifosng-db/migrations/core_db/V74__alter_m_loan_counter_table_add_group.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V74__alter_m_loan_counter_table_add_group.sql similarity index 100% rename from mifosng-db/migrations/core_db/V74__alter_m_loan_counter_table_add_group.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V74__alter_m_loan_counter_table_add_group.sql diff --git a/mifosng-db/migrations/core_db/V75__add_reschedule-repayments-on-holidays_to_configuration.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V75__add_reschedule-repayments-on-holidays_to_configuration.sql similarity index 100% rename from mifosng-db/migrations/core_db/V75__add_reschedule-repayments-on-holidays_to_configuration.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V75__add_reschedule-repayments-on-holidays_to_configuration.sql diff --git a/mifosng-db/migrations/core_db/V76__rename_permission_grouping.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V76__rename_permission_grouping.sql similarity index 100% rename from mifosng-db/migrations/core_db/V76__rename_permission_grouping.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V76__rename_permission_grouping.sql diff --git a/mifosng-db/migrations/core_db/V77__alter_m_product_loan_changes.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V77__alter_m_product_loan_changes.sql similarity index 100% rename from mifosng-db/migrations/core_db/V77__alter_m_product_loan_changes.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V77__alter_m_product_loan_changes.sql diff --git a/mifosng-db/migrations/core_db/V78__breakdown_portfolio_grouping.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V78__breakdown_portfolio_grouping.sql similarity index 100% rename from mifosng-db/migrations/core_db/V78__breakdown_portfolio_grouping.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V78__breakdown_portfolio_grouping.sql diff --git a/mifosng-db/migrations/core_db/V79__schedule_jobs_tables.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V79__schedule_jobs_tables.sql similarity index 99% rename from mifosng-db/migrations/core_db/V79__schedule_jobs_tables.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V79__schedule_jobs_tables.sql index 130b632bb..a53af3354 100755 --- a/mifosng-db/migrations/core_db/V79__schedule_jobs_tables.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V79__schedule_jobs_tables.sql @@ -39,7 +39,3 @@ INSERT INTO `scheduled_jobs` (`job_name`, `job_display_name`, `cron_expression`, INSERT INTO `scheduled_jobs` (`job_name`, `job_display_name`, `cron_expression`, `create_time`, `task_priority`, `group_name`, `previous_run_start_time`, `next_run_time`, `trigger_key`, `job_initializing_errorlog`, `is_active`) VALUES ('Update Loan Paid In Advance', 'Update Loan Paid In Advance', '0 5 0 1/1 * ? *', now(), 5, NULL, NULL, NULL, NULL, NULL, 1); INSERT INTO `scheduled_jobs` (`job_name`, `job_display_name`, `cron_expression`, `create_time`, `task_priority`, `group_name`, `previous_run_start_time`, `next_run_time`, `trigger_key`, `job_initializing_errorlog`, `is_active`) VALUES ('Apply Annual Fee For Savings', 'Apply Annual Fee For Savings', '0 20 22 1/1 * ? *', now(), 5, NULL, NULL, NULL, NULL, NULL, 1); INSERT INTO `scheduled_jobs` (`job_name`, `job_display_name`, `cron_expression`, `create_time`, `task_priority`, `group_name`, `previous_run_start_time`, `next_run_time`, `trigger_key`, `job_initializing_errorlog`, `is_active`) VALUES ('Apply Holidays To Loans', 'Apply Holidays To Loans', '0 0 12 * * ?', now(), 5, NULL, NULL, NULL, NULL, NULL, 1); - - - - diff --git a/mifosng-db/migrations/core_db/V7__remove_read_makerchecker_permission.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V7__remove_read_makerchecker_permission.sql similarity index 67% rename from mifosng-db/migrations/core_db/V7__remove_read_makerchecker_permission.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V7__remove_read_makerchecker_permission.sql index 62f6e4b97..8a507e4bc 100644 --- a/mifosng-db/migrations/core_db/V7__remove_read_makerchecker_permission.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V7__remove_read_makerchecker_permission.sql @@ -3,13 +3,12 @@ Remove READ_MAKERCHECKER permission as no longer used. */ -delete from m_role_permission +delete from m_role_permission where exists -(select 'f' from m_permission p +(select 'f' from m_permission p where p.id = m_role_permission.permission_id and p.code = 'READ_MAKERCHECKER'); -delete from m_permission +delete from m_permission where code = 'READ_MAKERCHECKER'; - \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V80__schedule_jobs_tables_updates.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V80__schedule_jobs_tables_updates.sql similarity index 100% rename from mifosng-db/migrations/core_db/V80__schedule_jobs_tables_updates.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V80__schedule_jobs_tables_updates.sql diff --git a/mifosng-db/migrations/core_db/V81__savings_related_changes.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V81__savings_related_changes.sql similarity index 93% rename from mifosng-db/migrations/core_db/V81__savings_related_changes.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V81__savings_related_changes.sql index ee81e1a56..b36b4ae8d 100644 --- a/mifosng-db/migrations/core_db/V81__savings_related_changes.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V81__savings_related_changes.sql @@ -1,11 +1,11 @@ -ALTER TABLE `m_note` +ALTER TABLE `m_note` ADD COLUMN `savings_account_id` BIGINT(20) NULL DEFAULT NULL AFTER `loan_transaction_id`, ADD COLUMN `savings_account_transaction_id` BIGINT(20) NULL DEFAULT NULL AFTER `savings_account_id`; ALTER TABLE `m_note` ADD CONSTRAINT `FK_savings_account_id` FOREIGN KEY (`savings_account_id` ) REFERENCES `m_savings_account` (`id` ) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD INDEX `FK_savings_account_id` (`savings_account_id` ASC) ; -ALTER TABLE `m_savings_account_transaction` +ALTER TABLE `m_savings_account_transaction` CHANGE COLUMN `is_reversed` `is_reversed` TINYINT(1) NOT NULL AFTER `transaction_type_enum`, CHANGE COLUMN `balance_end_date_derived` `balance_end_date_derived` DATE NULL DEFAULT NULL AFTER `amount`, CHANGE COLUMN `balance_number_of_days_derived` `balance_number_of_days_derived` INT(11) NULL DEFAULT NULL AFTER `balance_end_date_derived`; @@ -21,7 +21,7 @@ ADD COLUMN `rejectedon_userid` bigint(20) DEFAULT NULL AFTER `rejectedon_date`, ADD COLUMN `withdrawnon_date` DATE DEFAULT NULL AFTER `rejectedon_userid`, ADD COLUMN `withdrawnon_userid` bigint(20) DEFAULT NULL AFTER `withdrawnon_date`; -ALTER TABLE `m_savings_account` +ALTER TABLE `m_savings_account` CHANGE COLUMN `activation_date` `activatedon_date` DATE NULL DEFAULT NULL AFTER `withdrawnon_userid`; ALTER TABLE `m_savings_account` @@ -29,9 +29,9 @@ ADD COLUMN `activatedon_userid` bigint(20) DEFAULT NULL AFTER `activatedon_date` ADD COLUMN `closedon_date` DATE DEFAULT NULL AFTER `activatedon_userid`, ADD COLUMN `closedon_userid` bigint(20) DEFAULT NULL AFTER `closedon_date`; -UPDATE `m_savings_account` -SET -`submittedon_date`=`activatedon_date`, +UPDATE `m_savings_account` +SET +`submittedon_date`=`activatedon_date`, `approvedon_date`=`activatedon_date`; @@ -54,7 +54,7 @@ VALUES ('transaction_savings', 'CLOSE_SAVINGSACCOUNT_CHECKER', 'SAVINGSACCOUNT', 'CLOSE', 0); --- Remove permissions with 'in the past' permissions +-- Remove permissions with 'in the past' permissions DELETE FROM `m_permission` WHERE `id`='210'; diff --git a/mifosng-db/migrations/core_db/V82__schedule_jobs_tables_updates_for_running_status.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V82__schedule_jobs_tables_updates_for_running_status.sql similarity index 98% rename from mifosng-db/migrations/core_db/V82__schedule_jobs_tables_updates_for_running_status.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V82__schedule_jobs_tables_updates_for_running_status.sql index 385ce7f3a..e540dcad6 100755 --- a/mifosng-db/migrations/core_db/V82__schedule_jobs_tables_updates_for_running_status.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V82__schedule_jobs_tables_updates_for_running_status.sql @@ -1,5 +1,5 @@ ALTER TABLE `job` ADD COLUMN `currently_running` TINYINT(1) NOT NULL DEFAULT '0' AFTER `is_active`; - + ALTER TABLE `job` CHANGE COLUMN `trigger_key` `job_key` VARCHAR(500) NULL DEFAULT NULL; \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V83__non-working-days-table.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V83__non-working-days-table.sql similarity index 100% rename from mifosng-db/migrations/core_db/V83__non-working-days-table.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V83__non-working-days-table.sql diff --git a/mifosng-db/migrations/core_db/V84__undo_savings_transaction_permission.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V84__undo_savings_transaction_permission.sql similarity index 100% rename from mifosng-db/migrations/core_db/V84__undo_savings_transaction_permission.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V84__undo_savings_transaction_permission.sql diff --git a/mifosng-db/migrations/core_db/V85__product_mix_related_changes.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V85__product_mix_related_changes.sql similarity index 100% rename from mifosng-db/migrations/core_db/V85__product_mix_related_changes.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V85__product_mix_related_changes.sql diff --git a/mifosng-db/migrations/core_db/V86__update-working-days.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V86__update-working-days.sql similarity index 100% rename from mifosng-db/migrations/core_db/V86__update-working-days.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V86__update-working-days.sql diff --git a/mifosng-db/migrations/core_db/V87__add_permission_for_scheduler.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V87__add_permission_for_scheduler.sql similarity index 100% rename from mifosng-db/migrations/core_db/V87__add_permission_for_scheduler.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V87__add_permission_for_scheduler.sql diff --git a/mifosng-db/migrations/core_db/V88__added_update_constrain_for_scheduler_jobs.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V88__added_update_constrain_for_scheduler_jobs.sql similarity index 100% rename from mifosng-db/migrations/core_db/V88__added_update_constrain_for_scheduler_jobs.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V88__added_update_constrain_for_scheduler_jobs.sql diff --git a/mifosng-db/migrations/core_db/V89__added_scheduler_group.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V89__added_scheduler_group.sql similarity index 100% rename from mifosng-db/migrations/core_db/V89__added_scheduler_group.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V89__added_scheduler_group.sql diff --git a/mifosng-db/migrations/core_db/V8__deposit-transaction-permissions-if-they-exist.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V8__deposit-transaction-permissions-if-they-exist.sql similarity index 98% rename from mifosng-db/migrations/core_db/V8__deposit-transaction-permissions-if-they-exist.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V8__deposit-transaction-permissions-if-they-exist.sql index 1dac91ef6..db403223d 100644 --- a/mifosng-db/migrations/core_db/V8__deposit-transaction-permissions-if-they-exist.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V8__deposit-transaction-permissions-if-they-exist.sql @@ -1,3 +1,2 @@ delete from m_permission where grouping = 'transaction_deposit'; - \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V90__client_performance_history_reports.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V90__client_performance_history_reports.sql similarity index 100% rename from mifosng-db/migrations/core_db/V90__client_performance_history_reports.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V90__client_performance_history_reports.sql diff --git a/mifosng-db/migrations/core_db/V91_1__configuration_settings_for_holiday_and_non_workingday.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V91_1__configuration_settings_for_holiday_and_non_workingday.sql similarity index 100% rename from mifosng-db/migrations/core_db/V91_1__configuration_settings_for_holiday_and_non_workingday.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V91_1__configuration_settings_for_holiday_and_non_workingday.sql diff --git a/mifosng-db/migrations/core_db/V91__apply_annual_fees_permission.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V91__apply_annual_fees_permission.sql similarity index 100% rename from mifosng-db/migrations/core_db/V91__apply_annual_fees_permission.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V91__apply_annual_fees_permission.sql diff --git a/mifosng-db/migrations/core_db/V92__group_center_assign_staff_permission.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V92__group_center_assign_staff_permission.sql similarity index 100% rename from mifosng-db/migrations/core_db/V92__group_center_assign_staff_permission.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V92__group_center_assign_staff_permission.sql diff --git a/mifosng-db/migrations/core_db/V93__loan_transaction_external_id.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V93__loan_transaction_external_id.sql similarity index 71% rename from mifosng-db/migrations/core_db/V93__loan_transaction_external_id.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V93__loan_transaction_external_id.sql index 1e5cfdfc6..e5b136c13 100644 --- a/mifosng-db/migrations/core_db/V93__loan_transaction_external_id.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V93__loan_transaction_external_id.sql @@ -1,3 +1,3 @@ -ALTER TABLE m_loan_transaction -ADD COLUMN `external_id` VARCHAR(100) NULL DEFAULT NULL AFTER `is_reversed` , +ALTER TABLE m_loan_transaction +ADD COLUMN `external_id` VARCHAR(100) NULL DEFAULT NULL AFTER `is_reversed` , ADD UNIQUE INDEX `external_id_UNIQUE` (`external_id` ASC) ; \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V94__added_savings_accont type.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V94__added_savings_accont type.sql similarity index 100% rename from mifosng-db/migrations/core_db/V94__added_savings_accont type.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V94__added_savings_accont type.sql diff --git a/mifosng-db/migrations/core_db/V95__batch_job_postInterest.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V95__batch_job_postInterest.sql similarity index 100% rename from mifosng-db/migrations/core_db/V95__batch_job_postInterest.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V95__batch_job_postInterest.sql diff --git a/mifosng-db/migrations/core_db/V96__savings_accounts_transfers_table.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V96__savings_accounts_transfers_table.sql similarity index 100% rename from mifosng-db/migrations/core_db/V96__savings_accounts_transfers_table.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V96__savings_accounts_transfers_table.sql diff --git a/mifosng-db/migrations/core_db/V97__add_permission_for_adjust_savings_transaction.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V97__add_permission_for_adjust_savings_transaction.sql similarity index 100% rename from mifosng-db/migrations/core_db/V97__add_permission_for_adjust_savings_transaction.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V97__add_permission_for_adjust_savings_transaction.sql diff --git a/mifosng-db/migrations/core_db/V98__added_currency_roundof_for_multipleof.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V98__added_currency_roundof_for_multipleof.sql similarity index 93% rename from mifosng-db/migrations/core_db/V98__added_currency_roundof_for_multipleof.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V98__added_currency_roundof_for_multipleof.sql index 571335a04..2c14cf97f 100644 --- a/mifosng-db/migrations/core_db/V98__added_currency_roundof_for_multipleof.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V98__added_currency_roundof_for_multipleof.sql @@ -5,8 +5,8 @@ ALTER TABLE `m_savings_product` ALTER TABLE `m_loan` ADD COLUMN `currency_multiplesof` SMALLINT(5) NULL AFTER `currency_digits`; ALTER TABLE `m_product_loan` - ADD COLUMN `currency_multiplesof` SMALLINT(5) NULL AFTER `currency_digits`; + ADD COLUMN `currency_multiplesof` SMALLINT(5) NULL AFTER `currency_digits`; ALTER TABLE `m_currency` - ADD COLUMN `currency_multiplesof` SMALLINT(5) NULL AFTER `decimal_places`; + ADD COLUMN `currency_multiplesof` SMALLINT(5) NULL AFTER `decimal_places`; ALTER TABLE `m_organisation_currency` - ADD COLUMN `currency_multiplesof` SMALLINT(5) NULL AFTER `decimal_places`; \ No newline at end of file + ADD COLUMN `currency_multiplesof` SMALLINT(5) NULL AFTER `decimal_places`; \ No newline at end of file diff --git a/mifosng-db/migrations/core_db/V9__add_min_max_constraint_column_to_loan_loanproduct.sql b/mifosng-provider/src/main/resources/sql/migrations/core_db/V9__add_min_max_constraint_column_to_loan_loanproduct.sql similarity index 96% rename from mifosng-db/migrations/core_db/V9__add_min_max_constraint_column_to_loan_loanproduct.sql rename to mifosng-provider/src/main/resources/sql/migrations/core_db/V9__add_min_max_constraint_column_to_loan_loanproduct.sql index 0e864a568..ae955a2d7 100644 --- a/mifosng-db/migrations/core_db/V9__add_min_max_constraint_column_to_loan_loanproduct.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/core_db/V9__add_min_max_constraint_column_to_loan_loanproduct.sql @@ -3,13 +3,13 @@ ALTER TABLE `m_product_loan` ADD COLUMN `max_nominal_interest_rate_per_period` DECIMAL(19,6) NOT NULL AFTER `min_nominal_interest_rate_per_period`, ADD COLUMN `min_number_of_repayments` SMALLINT(5) NOT NULL AFTER `number_of_repayments`, ADD COLUMN `max_number_of_repayments` SMALLINT(5) NOT NULL AFTER `min_number_of_repayments`; - + ALTER TABLE `m_loan` ADD COLUMN `min_nominal_interest_rate_per_period` DECIMAL(19,6) NOT NULL AFTER `nominal_interest_rate_per_period`, ADD COLUMN `max_nominal_interest_rate_per_period` DECIMAL(19,6) NOT NULL AFTER `min_nominal_interest_rate_per_period`, ADD COLUMN `min_number_of_repayments` SMALLINT(5) NOT NULL AFTER `number_of_repayments`, - ADD COLUMN `max_number_of_repayments` SMALLINT(5) NOT NULL AFTER `min_number_of_repayments`; - + ADD COLUMN `max_number_of_repayments` SMALLINT(5) NOT NULL AFTER `min_number_of_repayments`; + ALTER TABLE `m_loan` ALTER `min_principal_amount` DROP DEFAULT, ALTER `max_principal_amount` DROP DEFAULT; @@ -19,8 +19,8 @@ ALTER TABLE `m_loan` CHANGE COLUMN `min_nominal_interest_rate_per_period` `min_nominal_interest_rate_per_period` DECIMAL(19,6) NULL AFTER `nominal_interest_rate_per_period`, CHANGE COLUMN `max_nominal_interest_rate_per_period` `max_nominal_interest_rate_per_period` DECIMAL(19,6) NULL AFTER `min_nominal_interest_rate_per_period`, CHANGE COLUMN `min_number_of_repayments` `min_number_of_repayments` SMALLINT(5) NULL AFTER `number_of_repayments`, - CHANGE COLUMN `max_number_of_repayments` `max_number_of_repayments` SMALLINT(5) NULL AFTER `min_number_of_repayments`; - + CHANGE COLUMN `max_number_of_repayments` `max_number_of_repayments` SMALLINT(5) NULL AFTER `min_number_of_repayments`; + ALTER TABLE `m_product_loan` ALTER `min_principal_amount` DROP DEFAULT, ALTER `max_principal_amount` DROP DEFAULT, diff --git a/mifosng-db/migrations/list_db/V1__mifos-platform-shared-tenants.sql b/mifosng-provider/src/main/resources/sql/migrations/list_db/V1__mifos-platform-shared-tenants.sql similarity index 100% rename from mifosng-db/migrations/list_db/V1__mifos-platform-shared-tenants.sql rename to mifosng-provider/src/main/resources/sql/migrations/list_db/V1__mifos-platform-shared-tenants.sql diff --git a/mifosng-db/migrations/list_db/V2__externalize-connection-properties.sql b/mifosng-provider/src/main/resources/sql/migrations/list_db/V2__externalize-connection-properties.sql similarity index 98% rename from mifosng-db/migrations/list_db/V2__externalize-connection-properties.sql rename to mifosng-provider/src/main/resources/sql/migrations/list_db/V2__externalize-connection-properties.sql index 5bd7857e6..63129a968 100644 --- a/mifosng-db/migrations/list_db/V2__externalize-connection-properties.sql +++ b/mifosng-provider/src/main/resources/sql/migrations/list_db/V2__externalize-connection-properties.sql @@ -1,14 +1,14 @@ -ALTER TABLE `tenants` - ADD COLUMN `pool_initial_size` int(5) DEFAULT 5 AFTER `auto_update`, - ADD COLUMN `pool_validation_interval` int(11) DEFAULT 30000, - ADD COLUMN `pool_remove_abandoned` tinyint(1) DEFAULT 1, - ADD COLUMN `pool_remove_abandoned_timeout` int(5) DEFAULT 60, - ADD COLUMN `pool_log_abandoned` tinyint(1) DEFAULT 1, - ADD COLUMN `pool_abandon_when_percentage_full` int(5) DEFAULT 50, - ADD COLUMN `pool_test_on_borrow` tinyint(1) DEFAULT 1, - ADD COLUMN `pool_max_active` int(5) DEFAULT 40, - ADD COLUMN `pool_min_idle` int(5) DEFAULT 20, - ADD COLUMN `pool_max_idle` int(5) DEFAULT 10, - ADD COLUMN `pool_suspect_timeout` int(5) DEFAULT 60, - ADD COLUMN `pool_time_between_eviction_runs_millis` int(11) DEFAULT 34000, +ALTER TABLE `tenants` + ADD COLUMN `pool_initial_size` int(5) DEFAULT 5 AFTER `auto_update`, + ADD COLUMN `pool_validation_interval` int(11) DEFAULT 30000, + ADD COLUMN `pool_remove_abandoned` tinyint(1) DEFAULT 1, + ADD COLUMN `pool_remove_abandoned_timeout` int(5) DEFAULT 60, + ADD COLUMN `pool_log_abandoned` tinyint(1) DEFAULT 1, + ADD COLUMN `pool_abandon_when_percentage_full` int(5) DEFAULT 50, + ADD COLUMN `pool_test_on_borrow` tinyint(1) DEFAULT 1, + ADD COLUMN `pool_max_active` int(5) DEFAULT 40, + ADD COLUMN `pool_min_idle` int(5) DEFAULT 20, + ADD COLUMN `pool_max_idle` int(5) DEFAULT 10, + ADD COLUMN `pool_suspect_timeout` int(5) DEFAULT 60, + ADD COLUMN `pool_time_between_eviction_runs_millis` int(11) DEFAULT 34000, ADD COLUMN `pool_min_evictable_idle_time_millis` int(11) DEFAULT 60000; \ No newline at end of file diff --git a/mifosng-db/migrations/sample_data/load_sample_data.sql b/mifosng-provider/src/main/resources/sql/migrations/sample_data/load_sample_data.sql similarity index 100% rename from mifosng-db/migrations/sample_data/load_sample_data.sql rename to mifosng-provider/src/main/resources/sql/migrations/sample_data/load_sample_data.sql diff --git a/mifosng-provider/src/main/webapp/WEB-INF/web.xml b/mifosng-provider/src/main/webapp/WEB-INF/web.xml index e1400fde7..05e8c0711 100644 --- a/mifosng-provider/src/main/webapp/WEB-INF/web.xml +++ b/mifosng-provider/src/main/webapp/WEB-INF/web.xml @@ -2,59 +2,30 @@ - + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" + id="mifosng-platform-provider" version="3.0"> Mifos Platform A provider of microfinance services which applications can consume once authenticated and authorized. + + + + + - - contextConfigLocation - classpath*:META-INF/spring/jndi.xml classpath*:META-INF/spring/appContext.xml - - - - springSecurityFilterChain - org.springframework.web.filter.DelegatingFilterProxy - - - - springSecurityFilterChain - /* - - - - org.springframework.web.context.ContextLoaderListener - - - - jersey-servlet - com.sun.jersey.spi.spring.container.servlet.SpringServlet - - com.sun.jersey.api.json.POJOMappingFeature - true - - - - - com.sun.jersey.spi.container.ContainerResponseFilters - org.mifosplatform.infrastructure.core.filters.ResponseCorsFilter - - 1 - - - - jersey-servlet - /api/v1/* - \ No newline at end of file diff --git a/mifosng-provider/src/test/java/org/mifosplatform/common/RestAssuredFixture.java b/mifosng-provider/src/test/java/org/mifosplatform/common/RestAssuredFixture.java new file mode 100644 index 000000000..7566dc5a9 --- /dev/null +++ b/mifosng-provider/src/test/java/org/mifosplatform/common/RestAssuredFixture.java @@ -0,0 +1,56 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.mifosplatform.common; + +import com.google.common.base.Preconditions; +import com.jayway.restassured.RestAssured; +import com.jayway.restassured.builder.RequestSpecBuilder; +import com.jayway.restassured.builder.ResponseSpecBuilder; +import com.jayway.restassured.http.ContentType; +import com.jayway.restassured.specification.RequestSpecification; +import com.jayway.restassured.specification.ResponseSpecification; + +/** + * REST integration tests helper. Intended to encapsulate the current + * RestAssured-based implementation as private. May be REST integration tests + * should instead be written using e.g. Spring's TestRestTemplate or Square's + * Retrofit (already used in the Mifos X Android client). + */ +public class RestAssuredFixture { + + private final int httpPort; + + private ResponseSpecification responseSpec; + private RequestSpecification requestSpec; + + public RestAssuredFixture(int httpPort) { + super(); + this.httpPort = httpPort; + Utils.initializeRESTAssured(); + RestAssured.port = httpPort; + this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); + this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey()); + this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build(); + } + + public T httpGet(String apiPath, String jsonAttributeToGetBack) { + return Utils.performServerGet(this.requestSpec, this.responseSpec, getApiPath(apiPath), jsonAttributeToGetBack); + } + + public T httpGet(String apiPath) { + return httpGet(apiPath, ""); + } + + private String getApiPath(String apiPath) { + Preconditions.checkArgument(apiPath.startsWith("/"), "trailingApiUrl must start with slash: " + apiPath); + return "/mifosng-provider/api/v1" + apiPath + "?tenantIdentifier=default"; + } + + protected String getApiUrl(String apiPath) { + return "http://localhost:" + httpPort + getApiPath(apiPath); + } + +} diff --git a/mifosng-provider/src/test/java/org/mifosplatform/common/Utils.java b/mifosng-provider/src/test/java/org/mifosplatform/common/Utils.java index e13139940..9c0ec6b60 100644 --- a/mifosng-provider/src/test/java/org/mifosplatform/common/Utils.java +++ b/mifosng-provider/src/test/java/org/mifosplatform/common/Utils.java @@ -24,29 +24,35 @@ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Random; +/** + * Util for RestAssured tests. This class here in src/test is copy/pasted :( + * from and identical to the one in src/integrationTest; please keep it in sync. + * The cunning plan is that, now that we have Spring Boot + MariaDB4j, eventually + * do completely away with src/integrationTest and have only src/test.. can you help? ;) + */ @SuppressWarnings("unchecked") public class Utils { - private static final String LOGIN_URL = "/mifosng-provider/api/v1/authentication?username=mifos&password=password&tenantIdentifier=default"; + public static final String TENANT_IDENTIFIER = "tenantIdentifier=default"; + private static final String LOGIN_URL = "/mifosng-provider/api/v1/authentication?username=mifos&password=password&" + TENANT_IDENTIFIER; public static void initializeRESTAssured() { - RestAssured.baseURI ="https://localhost"; + RestAssured.baseURI = "https://localhost"; RestAssured.port = 8443; - RestAssured.keystore("../keystore.jks", "openmf"); + RestAssured.keystore("src/main/resources/keystore.jks", "openmf"); } public static String loginIntoServerAndGetBase64EncodedAuthenticationKey() { try { System.out.println("-----------------------------------LOGIN-----------------------------------------"); - String json = RestAssured.post(LOGIN_URL).asString(); + final String json = RestAssured.post(LOGIN_URL).asString(); assertThat("Failed to login into mifosx platform", StringUtils.isBlank(json), is(false)); return JsonPath.with(json).get("base64EncodedAuthenticationKey"); - } - catch (Exception e) { + } catch (final Exception e) { if (e instanceof HttpHostConnectException) { - HttpHostConnectException hh = (HttpHostConnectException) e; - fail("Failed to connect to mifosx platform:"+hh.getMessage()); + final HttpHostConnectException hh = (HttpHostConnectException) e; + fail("Failed to connect to mifosx platform:" + hh.getMessage()); } throw new RuntimeException(e); @@ -55,44 +61,60 @@ public class Utils { public static T performServerGet(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final String getURL, final String jsonAttributeToGetBack) { - String json = given().spec(requestSpec) - .expect().spec(responseSpec).log().ifError() - .when().get(getURL).andReturn().asString(); + final String json = given().spec(requestSpec).expect().spec(responseSpec).log().ifError().when().get(getURL).andReturn().asString(); return (T) from(json).get(jsonAttributeToGetBack); } public static T performServerPost(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final String postURL, final String jsonBodyToSend, final String jsonAttributeToGetBack) { - String json = given().spec(requestSpec).body(jsonBodyToSend) - .expect().spec(responseSpec).log().ifError() - .when().post(postURL) + final String json = given().spec(requestSpec).body(jsonBodyToSend).expect().spec(responseSpec).log().ifError().when().post(postURL) + .andReturn().asString(); + if (jsonAttributeToGetBack == null) { return (T) json; } + return (T) from(json).get(jsonAttributeToGetBack); + } + + public static T performServerPut(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, + final String putURL, final String jsonBodyToSend, final String jsonAttributeToGetBack) { + final String json = given().spec(requestSpec).body(jsonBodyToSend).expect().spec(responseSpec).log().ifError().when().put(putURL) .andReturn().asString(); return (T) from(json).get(jsonAttributeToGetBack); } + public static T performServerDelete(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, + final String deleteURL, final String jsonAttributeToGetBack) { + final String json = given().spec(requestSpec).expect().spec(responseSpec).log().ifError().when().delete(deleteURL).andReturn() + .asString(); + return (T) from(json).get(jsonAttributeToGetBack); + } - public static String convertDateToURLFormat(String dateToBeConvert){ - SimpleDateFormat oldFormat = new SimpleDateFormat("dd MMMMMM yyyy"); - SimpleDateFormat newFormat = new SimpleDateFormat("yyyy-MM-dd"); - String reformattedStr=""; + public static String convertDateToURLFormat(final String dateToBeConvert) { + final SimpleDateFormat oldFormat = new SimpleDateFormat("dd MMMMMM yyyy"); + final SimpleDateFormat newFormat = new SimpleDateFormat("yyyy-MM-dd"); + String reformattedStr = ""; try { reformattedStr = newFormat.format(oldFormat.parse(dateToBeConvert)); - } catch (ParseException e) { + } catch (final ParseException e) { e.printStackTrace(); } return reformattedStr; } public static String randomStringGenerator(final String prefix, final int len, final String sourceSetString) { - int lengthOfSource = sourceSetString.length(); - Random rnd = new Random(); - StringBuilder sb = new StringBuilder(len); - for (int i = 0; i < len; i++) + final int lengthOfSource = sourceSetString.length(); + final Random rnd = new Random(); + final StringBuilder sb = new StringBuilder(len); + for (int i = 0; i < len; i++) { sb.append((sourceSetString).charAt(rnd.nextInt(lengthOfSource))); + } return (prefix + (sb.toString())); } public static String randomStringGenerator(final String prefix, final int len) { return randomStringGenerator(prefix, len, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"); } + + public static String randomNameGenerator(final String prefix, final int lenOfRandomSuffix) { + return randomStringGenerator(prefix, lenOfRandomSuffix); + } + } diff --git a/mifosng-provider/src/test/java/org/mifosplatform/infrastructure/configuration/spring/SpringConfigurationTest.java b/mifosng-provider/src/test/java/org/mifosplatform/infrastructure/configuration/spring/SpringConfigurationTest.java index 2ccfad2ce..86bffef4a 100644 --- a/mifosng-provider/src/test/java/org/mifosplatform/infrastructure/configuration/spring/SpringConfigurationTest.java +++ b/mifosng-provider/src/test/java/org/mifosplatform/infrastructure/configuration/spring/SpringConfigurationTest.java @@ -14,6 +14,13 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; * This integration test ensure that the "production" Spring XML configuration * files (appContext.xml & Co.) are valid. It does not need any database for * that. + * + * Note: For a simple test like this, contrary to + * AbstractSpringBootWithMariaDB4jIntegrationTest, there is no need to use + * Boot's SpringApplicationConfiguration here, instead the simpler classic Sring + * core ContextConfiguration is sufficient (as long as the + * TestsWithoutDatabaseAndNoJobsConfiguration used extends + * AbstractApplicationConfiguration). */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = TestsWithoutDatabaseAndNoJobsConfiguration.class) diff --git a/mifosng-provider/src/test/java/org/mifosplatform/infrastructure/configuration/spring/TestsWithoutDatabaseAndNoJobsConfiguration.java b/mifosng-provider/src/test/java/org/mifosplatform/infrastructure/configuration/spring/TestsWithoutDatabaseAndNoJobsConfiguration.java index 2ce46408f..5bcc12e13 100644 --- a/mifosng-provider/src/test/java/org/mifosplatform/infrastructure/configuration/spring/TestsWithoutDatabaseAndNoJobsConfiguration.java +++ b/mifosng-provider/src/test/java/org/mifosplatform/infrastructure/configuration/spring/TestsWithoutDatabaseAndNoJobsConfiguration.java @@ -7,13 +7,11 @@ package org.mifosplatform.infrastructure.configuration.spring; import javax.sql.DataSource; +import org.mifosplatform.infrastructure.core.boot.AbstractApplicationConfiguration; import org.mifosplatform.infrastructure.core.service.TenantDatabaseUpgradeService; import org.mifosplatform.infrastructure.jobs.service.JobRegisterService; -import org.mockito.Answers; import org.mockito.Mockito; import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.ImportResource; /** * Spring @Configuration which does not require a running database. It also does @@ -21,10 +19,7 @@ import org.springframework.context.annotation.ImportResource; * background jobs. For some integration tests, this may be perfectly sufficient * (and faster to run such tests). */ -@Configuration -// We do NOT want the testContext.xml here, but the real one! -@ImportResource("classpath*:META-INF/spring/appContext.xml") -public class TestsWithoutDatabaseAndNoJobsConfiguration { +public class TestsWithoutDatabaseAndNoJobsConfiguration extends AbstractApplicationConfiguration { /** * Override TenantDatabaseUpgradeService binding, because the real one has a @PostConstruct @@ -32,8 +27,7 @@ public class TestsWithoutDatabaseAndNoJobsConfiguration { */ @Bean public TenantDatabaseUpgradeService tenantDatabaseUpgradeService() { - return new TenantDatabaseUpgradeService(null) { - + return new TenantDatabaseUpgradeService(null, null, null) { @Override public void upgradeAllTenants() { // NOOP @@ -60,4 +54,4 @@ public class TestsWithoutDatabaseAndNoJobsConfiguration { DataSource mockDataSource = Mockito.mock(DataSource.class, Mockito.RETURNS_MOCKS); return mockDataSource; } -} \ No newline at end of file +} diff --git a/mifosng-provider/src/test/java/org/mifosplatform/infrastructure/core/boot/tests/AbstractSpringBootWithMariaDB4jIntegrationTest.java b/mifosng-provider/src/test/java/org/mifosplatform/infrastructure/core/boot/tests/AbstractSpringBootWithMariaDB4jIntegrationTest.java new file mode 100644 index 000000000..5d3160208 --- /dev/null +++ b/mifosng-provider/src/test/java/org/mifosplatform/infrastructure/core/boot/tests/AbstractSpringBootWithMariaDB4jIntegrationTest.java @@ -0,0 +1,25 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.mifosplatform.infrastructure.core.boot.tests; + +import org.junit.runner.RunWith; +import org.mifosplatform.ServerWithMariaDB4jApplication; +import org.springframework.boot.test.IntegrationTest; +import org.springframework.boot.test.SpringApplicationConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +@RunWith(SpringJUnit4ClassRunner.class) +@SpringApplicationConfiguration(classes = ServerWithMariaDB4jApplication.Configuration.class) +@WebAppConfiguration +@IntegrationTest({ "server.port=0", "management.port=0", "mariaDB4j.port=0", "mariaDB4j.dataDir=null" }) +public abstract class AbstractSpringBootWithMariaDB4jIntegrationTest { + + // do NOT put any helper methods here! + // it's much better to use composition instead of inheritance + // so write a test util ("fixture") and use it as a field in your test + +} \ No newline at end of file diff --git a/mifosng-provider/src/test/java/org/mifosplatform/infrastructure/core/boot/tests/EmbeddedTomcatWithSSLConfigurationTest.java b/mifosng-provider/src/test/java/org/mifosplatform/infrastructure/core/boot/tests/EmbeddedTomcatWithSSLConfigurationTest.java new file mode 100644 index 000000000..524870bd9 --- /dev/null +++ b/mifosng-provider/src/test/java/org/mifosplatform/infrastructure/core/boot/tests/EmbeddedTomcatWithSSLConfigurationTest.java @@ -0,0 +1,43 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.mifosplatform.infrastructure.core.boot.tests; + +import static org.junit.Assert.*; + +import java.io.File; +import java.io.IOException; + +import org.junit.Test; +import org.mifosplatform.infrastructure.core.boot.EmbeddedTomcatWithSSLConfiguration; +import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.Resource; + +public class EmbeddedTomcatWithSSLConfigurationTest { + + @Test + public void testGetFileWithFileResource() throws IOException { + // Test class probably isn't in a JAR + checkClassResource(getClass()); + } + + @Test + public void testGetFileWithClasspathResource() throws IOException { + // Spring Resource class probably is in a JAR + File f1 = checkClassResource(Resource.class); + f1.delete(); + checkClassResource(Resource.class); + } + + protected File checkClassResource(Class clazz) throws IOException { + String testClasspathResourcePath = clazz.getCanonicalName().replace('.', '/') + ".class"; + Resource r = new ClassPathResource(testClasspathResourcePath); + File f = new EmbeddedTomcatWithSSLConfiguration().getFile(r); + assertTrue(f.exists()); + f = new EmbeddedTomcatWithSSLConfiguration().getFile(r); + assertTrue(f.exists()); + return f; + } +} diff --git a/mifosng-provider/src/test/java/org/mifosplatform/infrastructure/core/boot/tests/SpringBootServerLoginTest.java b/mifosng-provider/src/test/java/org/mifosplatform/infrastructure/core/boot/tests/SpringBootServerLoginTest.java new file mode 100644 index 000000000..1301d5bcb --- /dev/null +++ b/mifosng-provider/src/test/java/org/mifosplatform/infrastructure/core/boot/tests/SpringBootServerLoginTest.java @@ -0,0 +1,34 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.mifosplatform.infrastructure.core.boot.tests; + +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertThat; + +import java.util.List; +import java.util.Map; + +import org.junit.Test; +import org.mifosplatform.ServerApplication; +import org.mifosplatform.common.RestAssuredFixture; + +/** + * This is an integration test for the Spring Boot launch stuff. + * + * @see ServerApplication + */ +public class SpringBootServerLoginTest extends AbstractSpringBootWithMariaDB4jIntegrationTest { + + protected RestAssuredFixture util; + + @Test + public void hasMifosPlatformStarted() { + util = new RestAssuredFixture(8443); + List> response = util.httpGet("/users"); + assertThat(response.get(0).get("username"), is("mifos")); + } + +} \ No newline at end of file