-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #121 from bitfinexcom/beta
Update beta with master
- Loading branch information
Showing
16 changed files
with
360 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
'use strict' | ||
|
||
process.versions.electron = process.env.ELECTRON_VERSION | ||
|
||
module.exports = require('bfx-svc-boot-js') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
workers/loc.api/sync/dao/db-migrations/sqlite-migrations/migration.v14.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
'use strict' | ||
|
||
const AbstractMigration = require('./abstract.migration') | ||
const { getSqlArrToModifyColumns } = require('./helpers') | ||
|
||
class MigrationV14 extends AbstractMigration { | ||
/** | ||
* @override | ||
*/ | ||
up () { | ||
const sqlArr = [ | ||
'ALTER TABLE ledgers ADD COLUMN _category INT', | ||
|
||
/* | ||
Delete all data from ledgers to allow | ||
resync from scratch for adding categories | ||
*/ | ||
'DELETE FROM ledgers' | ||
] | ||
|
||
this.addSql(sqlArr) | ||
} | ||
|
||
/** | ||
* @override | ||
*/ | ||
beforeDown () { return this.dao.disableForeignKeys() } | ||
|
||
/** | ||
* @override | ||
*/ | ||
down () { | ||
const sqlArr = [ | ||
...getSqlArrToModifyColumns( | ||
'ledgers', | ||
{ | ||
_id: 'INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT', | ||
id: 'BIGINT', | ||
currency: 'VARCHAR(255)', | ||
mts: 'BIGINT', | ||
amount: 'DECIMAL(22,12)', | ||
amountUsd: 'DECIMAL(22,12)', | ||
balance: 'DECIMAL(22,12)', | ||
_nativeBalance: 'DECIMAL(22,12)', | ||
balanceUsd: 'DECIMAL(22,12)', | ||
_nativeBalanceUsd: 'DECIMAL(22,12)', | ||
description: 'TEXT', | ||
wallet: 'VARCHAR(255)', | ||
_isMarginFundingPayment: 'INT', | ||
_isAffiliateRebate: 'INT', | ||
_isStakingPayments: 'INT', | ||
_isBalanceRecalced: 'INT', | ||
subUserId: 'INT', | ||
user_id: 'INT NOT NULL', | ||
__constraints__: `CONSTRAINT #{tableName}_fk_user_id | ||
FOREIGN KEY (user_id) | ||
REFERENCES users(_id) | ||
ON UPDATE CASCADE | ||
ON DELETE CASCADE` | ||
} | ||
) | ||
] | ||
|
||
this.addSql(sqlArr) | ||
} | ||
|
||
/** | ||
* @override | ||
*/ | ||
afterDown () { return this.dao.enableForeignKeys() } | ||
} | ||
|
||
module.exports = MigrationV14 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.