Skip to content

Commit

Permalink
feature/1093 Alter DB Schema for Settlements (#501)
Browse files Browse the repository at this point in the history
* Added migrations and seeds

* WIP

* Remove unused code (#504)

* Remove unused code

* Update dependencies

* Maintenance update (#505)

- Upgraded Event-SDK
- Version bump

* Upgraded central-services-stream for #1114KafkaErrorLocalQueuefull fix (#511)

* package.json and package-lock

* Changes following peer review

* Added settlementWindowContent.settlementId

Co-authored-by: Steven Oderayi <oderayi@gmail.com>
Co-authored-by: Miguel de Barros <miguel@debarros.me>
  • Loading branch information
3 people authored Jan 6, 2020
1 parent 76bc1f5 commit 2e21103
Show file tree
Hide file tree
Showing 166 changed files with 2,505 additions and 1,201 deletions.
15 changes: 6 additions & 9 deletions .env
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
POSTGRES_USER=central_ledger
POSTGRES_PASSWORD=cVq8iFqaLuHy8jjKuA
SIDE_SERVICE=central-ledger
SIDE_POSTGRES_USER=sidecar
SIDE_POSTGRES_PASSWORD=6dauAWcoeJuyRTFXH9
DB_HOST=postgres
DB_PORT=5432
DB_USER=kms
DB_PASSWORD=kms
DB_USER=central_ledger
DB_PASS=password
DB_NAME=central_ledger
DB_HOST=localhost
DB_PORT=3306
CLEDG_DATABASE_URI=mysql://$DB_USER:$DB_PASS@$DB_HOST:$DB_PORT/$DB_NAME
7 changes: 4 additions & 3 deletions migrations/100100_event.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
* Gates Foundation
- Name Surname <name.surname@gatesfoundation.com>
* Georgi Georgiev <georgi.georgiev@modusbox.com>
* ModusBox
- Georgi Georgiev <georgi.georgiev@modusbox.com>
--------------
******/

'use strict'

exports.up = async (knex, Promise) => {
exports.up = async (knex) => {
return await knex.schema.hasTable('event').then(function(exists) {
if (!exists) {
return knex.schema.createTable('event', (t) => {
Expand All @@ -37,6 +38,6 @@ exports.up = async (knex, Promise) => {
})
}

exports.down = function (knex, Promise) {
exports.down = function (knex) {
return knex.schema.dropTableIfExists('event')
}
7 changes: 4 additions & 3 deletions migrations/110100_contactType.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
* Gates Foundation
- Name Surname <name.surname@gatesfoundation.com>
* Georgi Georgiev <georgi.georgiev@modusbox.com>
* ModusBox
- Georgi Georgiev <georgi.georgiev@modusbox.com>
--------------
******/

'use strict'

exports.up = async (knex, Promise) => {
exports.up = async (knex) => {
return await knex.schema.hasTable('contactType').then(function(exists) {
if (!exists) {
return knex.schema.createTable('contactType', (t) => {
Expand All @@ -38,6 +39,6 @@ exports.up = async (knex, Promise) => {
})
}

exports.down = function (knex, Promise) {
exports.down = function (knex) {
return knex.schema.dropTableIfExists('contactType')
}
7 changes: 4 additions & 3 deletions migrations/110101_contactType-indexes.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@
* Gates Foundation
- Name Surname <name.surname@gatesfoundation.com>
* Georgi Georgiev <georgi.georgiev@modusbox.com>
* ModusBox
- Georgi Georgiev <georgi.georgiev@modusbox.com>
--------------
******/

'use strict'

exports.up = function (knex, Promise) {
exports.up = function (knex) {
return knex.schema.table('contactType', (t) => {
t.unique('name')
})
}

exports.down = function (knex, Promise) {
exports.down = function (knex) {
return knex.schema.table('contactType', (t) => {
t.dropUnique('name')
})
Expand Down
7 changes: 4 additions & 3 deletions migrations/110200_currency.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
* Gates Foundation
- Name Surname <name.surname@gatesfoundation.com>
* Georgi Georgiev <georgi.georgiev@modusbox.com>
* ModusBox
- Georgi Georgiev <georgi.georgiev@modusbox.com>
--------------
******/

'use strict'

exports.up = async (knex, Promise) => {
exports.up = async (knex) => {
return await knex.schema.hasTable('currency').then(function(exists) {
if (!exists) {
return knex.schema.createTable('currency', (t) => {
Expand All @@ -37,6 +38,6 @@ exports.up = async (knex, Promise) => {
})
}

exports.down = function (knex, Promise) {
exports.down = function (knex) {
return knex.schema.dropTableIfExists('currency')
}
7 changes: 4 additions & 3 deletions migrations/110201_currency-scale.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
* Gates Foundation
- Name Surname <name.surname@gatesfoundation.com>
* Georgi Georgiev <georgi.georgiev@modusbox.com>
* ModusBox
- Georgi Georgiev <georgi.georgiev@modusbox.com>
--------------
******/

'use strict'

exports.up = async (knex, Promise) => {
exports.up = async (knex) => {
return await knex.schema.hasTable('currency').then(function(exists) {
if (exists) {
return knex.schema.alterTable('currency', (t) => {
Expand All @@ -34,6 +35,6 @@ exports.up = async (knex, Promise) => {
})
}

exports.down = function (knex, Promise) {
exports.down = function (knex) {
return knex.schema.dropTableIfExists('currency')
}
7 changes: 4 additions & 3 deletions migrations/110300_endpointType.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
* Gates Foundation
- Name Surname <name.surname@gatesfoundation.com>
* Georgi Georgiev <georgi.georgiev@modusbox.com>
* ModusBox
- Georgi Georgiev <georgi.georgiev@modusbox.com>
--------------
******/

'use strict'

exports.up = async (knex, Promise) => {
exports.up = async (knex) => {
return await knex.schema.hasTable('endpointType').then(function(exists) {
if (!exists) {
return knex.schema.createTable('endpointType', (t) => {
Expand All @@ -38,6 +39,6 @@ exports.up = async (knex, Promise) => {
})
}

exports.down = function (knex, Promise) {
exports.down = function (knex) {
return knex.schema.dropTableIfExists('endpointType')
}
7 changes: 4 additions & 3 deletions migrations/110301_endpointType-indexes.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@
* Gates Foundation
- Name Surname <name.surname@gatesfoundation.com>
* Georgi Georgiev <georgi.georgiev@modusbox.com>
* ModusBox
- Georgi Georgiev <georgi.georgiev@modusbox.com>
--------------
******/

'use strict'

exports.up = function (knex, Promise) {
exports.up = function (knex) {
return knex.schema.table('endpointType', (t) => {
t.unique('name')
})
}

exports.down = function (knex, Promise) {
exports.down = function (knex) {
return knex.schema.table('endpointType', (t) => {
t.dropUnique('name')
})
Expand Down
7 changes: 4 additions & 3 deletions migrations/110400_ledgerEntryType.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
* Gates Foundation
- Name Surname <name.surname@gatesfoundation.com>
* Georgi Georgiev <georgi.georgiev@modusbox.com>
* ModusBox
- Georgi Georgiev <georgi.georgiev@modusbox.com>
--------------
******/

'use strict'

exports.up = async (knex, Promise) => {
exports.up = async (knex) => {
return await knex.schema.hasTable('ledgerEntryType').then(function(exists) {
if (!exists) {
return knex.schema.createTable('ledgerEntryType', (t) => {
Expand All @@ -38,6 +39,6 @@ exports.up = async (knex, Promise) => {
})
}

exports.down = function (knex, Promise) {
exports.down = function (knex) {
return knex.schema.dropTableIfExists('ledgerEntryType')
}
7 changes: 4 additions & 3 deletions migrations/110401_ledgerEntryType-indexes.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@
* Gates Foundation
- Name Surname <name.surname@gatesfoundation.com>
* Georgi Georgiev <georgi.georgiev@modusbox.com>
* ModusBox
- Georgi Georgiev <georgi.georgiev@modusbox.com>
--------------
******/

'use strict'

exports.up = function (knex, Promise) {
exports.up = function (knex) {
return knex.schema.table('ledgerEntryType', (t) => {
t.unique('name')
})
}

exports.down = function (knex, Promise) {
exports.down = function (knex) {
return knex.schema.table('ledgerEntryType', (t) => {
t.dropUnique('name')
})
Expand Down
7 changes: 4 additions & 3 deletions migrations/110450_ledgerAccountType.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
* Gates Foundation
- Name Surname <name.surname@gatesfoundation.com>
* Georgi Georgiev <georgi.georgiev@modusbox.com>
* ModusBox
- Georgi Georgiev <georgi.georgiev@modusbox.com>
--------------
******/

'use strict'

exports.up = async (knex, Promise) => {
exports.up = async (knex) => {
return await knex.schema.hasTable('ledgerAccountType').then(function(exists) {
if (!exists) {
return knex.schema.createTable('ledgerAccountType', (t) => {
Expand All @@ -38,6 +39,6 @@ exports.up = async (knex, Promise) => {
})
}

exports.down = function (knex, Promise) {
exports.down = function (knex) {
return knex.schema.dropTableIfExists('ledgerAccountType')
}
7 changes: 4 additions & 3 deletions migrations/110451_ledgerAccountType-indexes.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@
* Gates Foundation
- Name Surname <name.surname@gatesfoundation.com>
* Georgi Georgiev <georgi.georgiev@modusbox.com>
* ModusBox
- Georgi Georgiev <georgi.georgiev@modusbox.com>
--------------
******/

'use strict'

exports.up = function (knex, Promise) {
exports.up = function (knex) {
return knex.schema.table('ledgerAccountType', (t) => {
t.unique('name')
})
}

exports.down = function (knex, Promise) {
exports.down = function (knex) {
return knex.schema.table('ledgerAccountType', (t) => {
t.dropUnique('name')
})
Expand Down
7 changes: 4 additions & 3 deletions migrations/110500_participantLimitType.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
* Gates Foundation
- Name Surname <name.surname@gatesfoundation.com>
* Georgi Georgiev <georgi.georgiev@modusbox.com>
* ModusBox
- Georgi Georgiev <georgi.georgiev@modusbox.com>
--------------
******/

'use strict'

exports.up = async (knex, Promise) => {
exports.up = async (knex) => {
return await knex.schema.hasTable('participantLimitType').then(function(exists) {
if (!exists) {
return knex.schema.createTable('participantLimitType', (t) => {
Expand All @@ -38,6 +39,6 @@ exports.up = async (knex, Promise) => {
})
}

exports.down = function (knex, Promise) {
exports.down = function (knex) {
return knex.schema.dropTableIfExists('participantLimitType')
}
7 changes: 4 additions & 3 deletions migrations/110501_participantLimitType-indexes.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@
* Gates Foundation
- Name Surname <name.surname@gatesfoundation.com>
* Georgi Georgiev <georgi.georgiev@modusbox.com>
* ModusBox
- Georgi Georgiev <georgi.georgiev@modusbox.com>
--------------
******/

'use strict'

exports.up = function (knex, Promise) {
exports.up = function (knex) {
return knex.schema.table('participantLimitType', (t) => {
t.unique('name')
})
}

exports.down = function (knex, Promise) {
exports.down = function (knex) {
return knex.schema.table('participantLimitType', (t) => {
t.dropUnique('name')
})
Expand Down
7 changes: 4 additions & 3 deletions migrations/110600_transferParticipantRoleType.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
* Gates Foundation
- Name Surname <name.surname@gatesfoundation.com>
* Georgi Georgiev <georgi.georgiev@modusbox.com>
* ModusBox
- Georgi Georgiev <georgi.georgiev@modusbox.com>
--------------
******/

'use strict'

exports.up = async (knex, Promise) => {
exports.up = async (knex) => {
return await knex.schema.hasTable('transferParticipantRoleType').then(function(exists) {
if (!exists) {
return knex.schema.createTable('transferParticipantRoleType', (t) => {
Expand All @@ -38,6 +39,6 @@ exports.up = async (knex, Promise) => {
})
}

exports.down = function (knex, Promise) {
exports.down = function (knex) {
return knex.schema.dropTableIfExists('transferParticipantRoleType')
}
7 changes: 4 additions & 3 deletions migrations/110601_transferParticipantRoleType-indexes.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@
* Gates Foundation
- Name Surname <name.surname@gatesfoundation.com>
* Georgi Georgiev <georgi.georgiev@modusbox.com>
* ModusBox
- Georgi Georgiev <georgi.georgiev@modusbox.com>
--------------
******/

'use strict'

exports.up = function (knex, Promise) {
exports.up = function (knex) {
return knex.schema.table('transferParticipantRoleType', (t) => {
t.unique('name')
})
}

exports.down = function (knex, Promise) {
exports.down = function (knex) {
return knex.schema.table('transferParticipantRoleType', (t) => {
t.dropUnique('name')
})
Expand Down
Loading

0 comments on commit 2e21103

Please sign in to comment.