Skip to content

Commit

Permalink
feature/#355 DB Model Changes Implementation (#87)
Browse files Browse the repository at this point in the history
* Temp sidecar and token fix
* Delete deprecated and update first 3 scripts
* Migration scripts 9-11
* Migration scripts 12-14
* Migration scripts 15-16
* Migration scripts 22-24
* Migration scripts 17-21
* Migration scripts 17-21
* Migration scripts 17-21
* Migration scripts 25-27
* Migration scripts 34 and review fixes to ilpPacket
* Migration scripts 29
* fixed ilpCondition spelling error
* Migration scripts 31
* Migration scripts 28, 30
* Migration scripts 32-33
* Corrections and cleanup
* npm run migrate FIXES
* Fix /participant; Remove /charge, /party, /role, /fee
* Refactor: Move from domain to model & camelCase
* domain/transfer/models to models/transfer, seeds
* Changed transfer facade getById
* Transfer Prepare
* Transfer Commit
* Pre- tests clean
* Test files maintenance
* Additional clean up
* added unit test cases
* fixed dependancies into few tests
* Adding placeholder unit test files
* Fixed admin/index.js unit test
* Added tests for transferFulfilment and transferParticipant
* Tests for transferFulfilment
* Sinon.createSandbox
* Unit testing for transferExtension
* added test cases
* Unit tests for ilpPacket
* Unit tests for transfer/facade init - WIP
* added test cases
* fixes for tests and tweaks (#1)
* merged projections
* merged projections second attempt
* Feature/db model changes georgi (#2)
* fixes for tests and tweaks
* removed unused test and fixed position test
* some fixes but still broken tests
* Standard fixes
* Disable failing test scripts
* projection fixed
* deleted transform.test.js
* unit/models/transfer/facade.test.js
* fixed testPI2/unit/domain/participant/index.test.js
* testPI2/unit/handlers/transfers/handler.test.js
* unit/handlers/transfers/handler.test.js
* Integration tests fix Part 1
* Fix & merge rmothilal
* Disable broken integration tests
* Feature/db model changes georgi (#5)
* fixes for tests and tweaks
* removed unused test and fixed position test
* some fixes but still broken tests
* fixes for producer and consumer. need to test properly
* add producer to list
made some addons
* updated dependencies
* Feature/db model changes georgi (#3)
* fixes for tests and tweaks
* removed unused test and fixed position test
* some fixes but still broken tests
* fixes for producer and consumer
* add producer to list
* updated dependencies
* positions model layer
* updating migration scripts to new knex standards for table creation
* disconnect topicName
* Feature/#355integrations
@vgenev integration tests fixes
* Cleaning up code and renaming integration test file names
* Changes according to rmothilal PR review
  • Loading branch information
ggrg authored Jul 16, 2018
1 parent fb9ad51 commit 4059951
Show file tree
Hide file tree
Showing 304 changed files with 4,433 additions and 5,040 deletions.
18 changes: 18 additions & 0 deletions migrations/100100_event.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use strict'

exports.up = async (knex, Promise) => {
return await knex.schema.hasTable('event').then(function(exists) {
if (!exists) {
return knex.schema.createTable('event', (t) => {
t.increments('eventId').primary().notNullable()
t.string('name', 128).notNullable()
t.string('description', 512).defaultTo(null).nullable()
t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable()
})
}
})
}

exports.down = function (knex, Promise) {
return knex.schema.dropTableIfExists('event')
}
19 changes: 19 additions & 0 deletions migrations/110100_contactType.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict'

exports.up = async (knex, Promise) => {
return await knex.schema.hasTable('contactType').then(function(exists) {
if (!exists) {
return knex.schema.createTable('contactType', (t) => {
t.increments('contactTypeId').primary().notNullable()
t.string('name', 50).notNullable()
t.string('description', 512).defaultTo(null).nullable()
t.boolean('isActive').defaultTo(true).notNullable()
t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable()
})
}
})
}

exports.down = function (knex, Promise) {
return knex.schema.dropTableIfExists('contactType')
}
File renamed without changes.
18 changes: 18 additions & 0 deletions migrations/110200_currency.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use strict'

exports.up = async (knex, Promise) => {
return await knex.schema.hasTable('currency').then(function(exists) {
if (!exists) {
return knex.schema.createTable('currency', (t) => {
t.string('currencyId', 3).primary().notNullable()
t.string('name', 128).defaultTo(null).nullable()
t.boolean('isActive').defaultTo(true).notNullable()
t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable()
})
}
})
}

exports.down = function (knex, Promise) {
return knex.schema.dropTableIfExists('currency')
}
19 changes: 19 additions & 0 deletions migrations/110300_endpointType.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict'

exports.up = async (knex, Promise) => {
return await knex.schema.hasTable('endpointType').then(function(exists) {
if (!exists) {
return knex.schema.createTable('endpointType', (t) => {
t.increments('endpointTypeId').primary().notNullable()
t.string('name', 50).notNullable()
t.string('description', 512).defaultTo(null).nullable()
t.boolean('isActive').defaultTo(true).notNullable()
t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable()
})
}
})
}

exports.down = function (knex, Promise) {
return knex.schema.dropTableIfExists('endpointType')
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
'use strict'

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

exports.down = function (knex, Promise) {
return knex.schema.table('partyType', (t) => {
return knex.schema.table('endpointType', (t) => {
t.dropUnique('name')
})
}
19 changes: 19 additions & 0 deletions migrations/110400_ledgerEntryType.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict'

exports.up = async (knex, Promise) => {
return await knex.schema.hasTable('ledgerEntryType').then(function(exists) {
if (!exists) {
return knex.schema.createTable('ledgerEntryType', (t) => {
t.increments('ledgerEntryTypeId').primary().notNullable()
t.string('name', 50).notNullable()
t.string('description', 512).defaultTo(null).nullable()
t.boolean('isActive').defaultTo(true).notNullable()
t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable()
})
}
})
}

exports.down = function (knex, Promise) {
return knex.schema.dropTableIfExists('ledgerEntryType')
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
'use strict'

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

exports.down = function (knex, Promise) {
return knex.schema.table('currency', (t) => {
return knex.schema.table('ledgerEntryType', (t) => {
t.dropUnique('name')
})
}
19 changes: 19 additions & 0 deletions migrations/110500_participantLimitType.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict'

exports.up = async (knex, Promise) => {
return await knex.schema.hasTable('participantLimitType').then(function(exists) {
if (!exists) {
return knex.schema.createTable('participantLimitType', (t) => {
t.increments('participantLimitTypeId').primary().notNullable()
t.string('name', 50).notNullable()
t.string('description', 512).defaultTo(null).nullable()
t.boolean('isActive').defaultTo(true).notNullable()
t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable()
})
}
})
}

exports.down = function (knex, Promise) {
return knex.schema.dropTableIfExists('participantLimitType')
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
'use strict'

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

exports.down = function (knex, Promise) {
return knex.schema.table('partyIdentifierType', (t) => {
return knex.schema.table('participantLimitType', (t) => {
t.dropUnique('name')
})
}
19 changes: 19 additions & 0 deletions migrations/110600_transferParticipantRoleType.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict'

exports.up = async (knex, Promise) => {
return await knex.schema.hasTable('transferParticipantRoleType').then(function(exists) {
if (!exists) {
return knex.schema.createTable('transferParticipantRoleType', (t) => {
t.increments('transferParticipantRoleTypeId').primary().notNullable()
t.string('name', 50).notNullable()
t.string('description', 512).defaultTo(null).nullable()
t.boolean('isActive').defaultTo(true).notNullable()
t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable()
})
}
})
}

exports.down = function (knex, Promise) {
return knex.schema.dropTableIfExists('transferParticipantRoleType')
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
'use strict'

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

exports.down = function (knex, Promise) {
return knex.schema.table('role', (t) => {
return knex.schema.table('transferParticipantRoleType', (t) => {
t.dropUnique('name')
})
}
19 changes: 19 additions & 0 deletions migrations/110700_transferState.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict'

exports.up = async (knex, Promise) => {
return await knex.schema.hasTable('transferState').then(function(exists) {
if (!exists) {
return knex.schema.createTable('transferState', (t) => {
t.string('transferStateId', 50).primary().notNullable()
t.string('enumeration', 50).notNullable().comment('transferState associated to the Mojaloop API')
t.string('description', 512).defaultTo(null).nullable()
t.boolean('isActive').defaultTo(true).notNullable()
t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable()
})
}
})
}

exports.down = function (knex, Promise) {
return knex.schema.dropTableIfExists('transferState')
}
20 changes: 20 additions & 0 deletions migrations/200100_participant.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict'

exports.up = async (knex, Promise) => {
return await knex.schema.hasTable('participant').then(function(exists) {
if (!exists) {
return knex.schema.createTable('participant', (t) => {
t.increments('participantId').primary().notNullable()
t.string('name', 256).notNullable()
t.string('description', 512).defaultTo(null).nullable()
t.boolean('isActive').defaultTo(true).notNullable()
t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable()
t.string('createdBy', 128).notNullable()
})
}
})
}

exports.down = function (knex, Promise) {
return knex.schema.dropTableIfExists('participant')
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

exports.up = function (knex, Promise) {
return knex.schema.table('participant', (t) => {
t.index('currencyId')
t.unique(['currencyId', 'name'])
t.unique('name')
})
}

exports.down = function (knex, Promise) {
return knex.schema.table('participant', (t) => {
t.dropIndex('currencyId')
t.dropUnique(['currencyId', 'name'])
t.dropUnique('name')
})
}
24 changes: 24 additions & 0 deletions migrations/200200_participantContact.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use strict'

exports.up = async (knex, Promise) => {
return await knex.schema.hasTable('participantContact').then(function(exists) {
if (!exists) {
return knex.schema.createTable('participantContact', (t) => {
t.increments('participantContactId').primary().notNullable()
t.integer('participantId').unsigned().notNullable()
t.foreign('participantId').references('participantId').inTable('participant')
t.integer('contactTypeId').unsigned().notNullable()
t.foreign('contactTypeId').references('contactTypeId').inTable('contactType')
t.string('value', 256).notNullable()
t.integer('priorityPreference').defaultTo(9).notNullable()
t.boolean('isActive').defaultTo(true).notNullable()
t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable()
t.string('createdBy', 128).notNullable()
})
}
})
}

exports.down = function (knex, Promise) {
return knex.schema.dropTableIfExists('participantContact')
}
23 changes: 23 additions & 0 deletions migrations/200300_participantEndpoint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use strict'

exports.up = async (knex, Promise) => {
return await knex.schema.hasTable('participantEndpoint').then(function(exists) {
if (!exists) {
return knex.schema.createTable('participantEndpoint', (t) => {
t.increments('participantEndpointId').primary().notNullable()
t.integer('participantId').unsigned().notNullable()
t.foreign('participantId').references('participantId').inTable('participant')
t.integer('endpointTypeId').unsigned().notNullable()
t.foreign('endpointTypeId').references('endpointTypeId').inTable('endpointType')
t.string('value', 512).notNullable()
t.boolean('isActive').defaultTo(true).notNullable()
t.dateTime('createdDate').defaultTo(knex.fn.now()).notNullable()
t.string('createdBy', 128).notNullable()
})
}
})
}

exports.down = function (knex, Promise) {
return knex.schema.dropTableIfExists('participantEndpoint')
}
15 changes: 15 additions & 0 deletions migrations/200301_participantEndpoint-indexes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
'use strict'

exports.up = function (knex, Promise) {
return knex.schema.table('participantEndpoint', (t) => {
t.index('participantId')
t.index('endpointTypeId')
})
}

exports.down = function (knex, Promise) {
return knex.schema.table('participantEndpoint', (t) => {
t.dropIndex('participantId')
t.dropIndex('endpointTypeId')
})
}
18 changes: 18 additions & 0 deletions migrations/200400_participantParty.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use strict'

exports.up = async (knex, Promise) => {
return await knex.schema.hasTable('participantParty').then(function(exists) {
if (!exists) {
return knex.schema.createTable('participantParty', (t) => {
t.bigIncrements('participantPartyId').primary().notNullable()
t.integer('participantId').unsigned().notNullable()
t.foreign('participantId').references('participantId').inTable('participant')
t.bigInteger('partyId').unsigned().notNullable()
})
}
})
}

exports.down = function (knex, Promise) {
return knex.schema.dropTableIfExists('participantParty')
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@
exports.up = function (knex, Promise) {
return knex.schema.table('participantParty', (t) => {
t.index('participantId')
t.index('partyId')
t.unique(['participantId', 'partyId'])
})
}

exports.down = function (knex, Promise) {
return knex.schema.table('participantParty', (t) => {
t.dropIndex('participantId')
t.dropIndex('partyId')
t.dropUnique(['participantId', 'partyId'])
})
}
19 changes: 19 additions & 0 deletions migrations/200500_participantSettlement.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict'

exports.up = async (knex, Promise) => {
return await knex.schema.hasTable('participantSettlement').then(function(exists) {
if (!exists) {
return knex.schema.createTable('participantSettlement', (t) => {
t.bigIncrements('participantSettlementId').primary().notNullable()
t.integer('participantId').unsigned().notNullable()
t.foreign('participantId').references('participantId').inTable('participant')
t.string('participantNumber', 16).notNullable()
t.string('routingNumber', 16).notNullable()
})
}
})
}

exports.down = function (knex, Promise) {
return knex.schema.dropTableIfExists('participantSettlement')
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
exports.up = function (knex, Promise) {
return knex.schema.table('participantSettlement', (t) => {
t.index('participantId')
t.unique('participantId')
})
}

exports.down = function (knex, Promise) {
return knex.schema.table('participantSettlement', (t) => {
t.dropIndex('participantId')
t.dropUnique('participantId')
})
}
Loading

0 comments on commit 4059951

Please sign in to comment.