Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Commit

Permalink
Migrate payroll service from MariaDB to PostgreSQL
Browse files Browse the repository at this point in the history
  • Loading branch information
Izakey committed May 9, 2019
1 parent 9f53efc commit 3527df3
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 24 deletions.
2 changes: 1 addition & 1 deletion NOTICE.txt
@@ -1,5 +1,5 @@
Apache Fineract CN Payroll
Copyright [2017-2018] The Apache Software Foundation
Copyright [2017-2019] The Apache Software Foundation

This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
Expand Up @@ -18,7 +18,6 @@
*/
package org.apache.fineract.cn.payroll;


import org.apache.fineract.cn.payroll.api.v1.EventConstants;
import org.apache.fineract.cn.payroll.api.v1.client.PayrollManager;
import org.apache.fineract.cn.payroll.service.PayrollServiceConfiguration;
Expand Down Expand Up @@ -74,8 +73,7 @@ public TestConfiguration() {

@ClassRule
public final static TenantDataStoreContextTestRule tenantDataStoreContext =
TenantDataStoreContextTestRule.forRandomTenantName(SuiteTestEnvironment.cassandraInitializer,
SuiteTestEnvironment.mariaDBInitializer);
TenantDataStoreContextTestRule.forRandomTenantName(cassandraInitializer, postgreSQLInitializer);

@Rule
public final TenantApplicationSecurityEnvironmentTestRule tenantApplicationSecurityEnvironment
Expand Down
Expand Up @@ -20,7 +20,7 @@

import org.apache.fineract.cn.test.env.TestEnvironment;
import org.apache.fineract.cn.test.fixture.cassandra.CassandraInitializer;
import org.apache.fineract.cn.test.fixture.mariadb.MariaDBInitializer;
import org.apache.fineract.cn.test.fixture.postgresql.PostgreSQLInitializer;
import org.junit.ClassRule;
import org.junit.rules.RuleChain;
import org.junit.rules.RunExternalResourceOnce;
Expand All @@ -38,11 +38,11 @@ public class SuiteTestEnvironment {

static final TestEnvironment testEnvironment = new TestEnvironment(APP_NAME);
static final CassandraInitializer cassandraInitializer = new CassandraInitializer();
static final MariaDBInitializer mariaDBInitializer = new MariaDBInitializer();
static final PostgreSQLInitializer postgreSQLInitializer = new PostgreSQLInitializer();

@ClassRule
public static TestRule orderClassRules = RuleChain
.outerRule(new RunExternalResourceOnce(testEnvironment))
.around(new RunExternalResourceOnce(cassandraInitializer))
.around(new RunExternalResourceOnce(mariaDBInitializer));
.around(new RunExternalResourceOnce(postgreSQLInitializer));
}
2 changes: 1 addition & 1 deletion service/build.gradle
Expand Up @@ -56,7 +56,7 @@ dependencies {
[group: 'org.apache.fineract.cn', name: 'lang', version: versions.frameworklang],
[group: 'org.apache.fineract.cn', name: 'async', version: versions.frameworkasync],
[group: 'org.apache.fineract.cn', name: 'cassandra', version: versions.frameworkcassandra],
[group: 'org.apache.fineract.cn', name: 'mariadb', version: versions.frameworkmariadb],
[group: 'org.apache.fineract.cn', name: 'postgresql', version: versions.frameworkpostgresql],
[group: 'org.apache.fineract.cn', name: 'command', version: versions.frameworkcommand],
[group: 'org.hibernate', name: 'hibernate-validator', version: versions.validator]
)
Expand Down
Expand Up @@ -26,7 +26,7 @@
import org.apache.fineract.cn.customer.api.v1.client.CustomerManager;
import org.apache.fineract.cn.lang.config.EnableServiceException;
import org.apache.fineract.cn.lang.config.EnableTenantContext;
import org.apache.fineract.cn.mariadb.config.EnableMariaDB;
import org.apache.fineract.cn.postgresql.config.EnablePostgreSQL;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
Expand All @@ -46,7 +46,7 @@
@EnableAsync
@EnableTenantContext
@EnableCassandra
@EnableMariaDB
@EnablePostgreSQL
@EnableCommandProcessing
@EnableAnubis
@EnableServiceException
Expand Down
Expand Up @@ -25,7 +25,7 @@
import org.apache.fineract.cn.command.annotation.CommandHandler;
import org.apache.fineract.cn.command.annotation.EventEmitter;
import org.apache.fineract.cn.lang.ApplicationName;
import org.apache.fineract.cn.mariadb.domain.FlywayFactoryBean;
import org.apache.fineract.cn.postgresql.domain.FlywayFactoryBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

Expand Down
Expand Up @@ -26,7 +26,7 @@
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.fineract.cn.mariadb.util.LocalDateTimeConverter;
import org.apache.fineract.cn.postgresql.util.LocalDateTimeConverter;

@Entity
@Table(name = "meketre_payroll_collections")
Expand Down
Expand Up @@ -26,7 +26,7 @@
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.fineract.cn.mariadb.util.LocalDateTimeConverter;
import org.apache.fineract.cn.postgresql.util.LocalDateTimeConverter;

@Entity
@Table(name = "meketre_payroll_configurations")
Expand Down
15 changes: 10 additions & 5 deletions service/src/main/resources/application.yml
Expand Up @@ -23,6 +23,11 @@ spring:
enabled: false
config:
enabled: false
datasource:
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://localhost:5432/playground
username: postgres
password: postgres

eureka:
client:
Expand All @@ -42,13 +47,13 @@ cassandra:
write: LOCAL_QUORUM
delete: LOCAL_QUORUM

mariadb:
driverClass: org.mariadb.jdbc.Driver
postgresql:
driverClass: org.postgresql.Driver
database: seshat
host: localhost
port: 3306
user: root
password: mysql
port: 5432
user: postgres
password: postgres

bonecp:
idleMaxAgeInMinutes: 240
Expand Down
Expand Up @@ -18,7 +18,7 @@
--

CREATE TABLE meketre_payroll_configurations (
id BIGINT NOT NULL AUTO_INCREMENT,
id BIGSERIAL NOT NULL,
customer_identifier VARCHAR(32) NOT NULL,
main_account_number VARCHAR(34) NOT NULL,
created_by VARCHAR(32) NOT NULL,
Expand All @@ -30,7 +30,7 @@ CREATE TABLE meketre_payroll_configurations (
);

CREATE TABLE meketre_payroll_allocations (
id BIGINT NOT NULL AUTO_INCREMENT,
id BIGSERIAL NOT NULL,
payroll_configuration_id BIGINT NOT NULL,
account_number VARCHAR(34) NOT NULL,
amount NUMERIC(15,5) NOT NULL,
Expand All @@ -41,7 +41,7 @@ CREATE TABLE meketre_payroll_allocations (
);

CREATE TABLE meketre_payroll_collections (
id BIGINT NOT NULL AUTO_INCREMENT,
id BIGSERIAL NOT NULL,
identifier VARCHAR(32) NOT NULL,
source_account_number VARCHAR(34) NOT NULL,
created_by VARCHAR(32) NOT NULL,
Expand All @@ -51,7 +51,7 @@ CREATE TABLE meketre_payroll_collections (
);

CREATE TABLE meketre_payroll_payments (
id BIGINT NOT NULL AUTO_INCREMENT,
id BIGSERIAL NOT NULL,
payroll_collection_id BIGINT NOT NULL,
customer_identifier VARCHAR(32) NOT NULL,
employer VARCHAR(256) NOT NULL,
Expand Down
5 changes: 3 additions & 2 deletions shared.gradle
Expand Up @@ -23,7 +23,7 @@ ext.versions = [
frameworklang : '0.1.0-BUILD-SNAPSHOT',
frameworkasync : '0.1.0-BUILD-SNAPSHOT',
frameworkcassandra : '0.1.0-BUILD-SNAPSHOT',
frameworkmariadb : '0.1.0-BUILD-SNAPSHOT',
frameworkpostgresql : '0.1.0-BUILD-SNAPSHOT',
frameworkcommand : '0.1.0-BUILD-SNAPSHOT',
frameworktest: '0.1.0-BUILD-SNAPSHOT',
frameworkanubis: '0.1.0-BUILD-SNAPSHOT',
Expand Down Expand Up @@ -62,7 +62,8 @@ ext['spring-data-releasetrain.version'] = 'Gosling-SR2A'

dependencies {
compile(
[group: 'com.google.code.findbugs', name: 'jsr305']
[group: 'com.google.code.findbugs', name: 'jsr305'],
[group: 'org.apache.fineract.cn', name: 'postgresql', version: versions.frameworkpostgresql]
)

testCompile(
Expand Down

0 comments on commit 3527df3

Please sign in to comment.