From 50b882a896d19a55022ffa0bd168d3434e8a8e60 Mon Sep 17 00:00:00 2001 From: nmlinaric Date: Tue, 7 Apr 2020 14:04:47 +0200 Subject: [PATCH 1/2] Revert "Fixed columns types and size between sequelize and migrations" This reverts commit 52bb57bb69d071508b1f40d0689040cc99f12712. --- src/Migrations/20191110125455-create-user.js | 2 +- src/Migrations/20191224091606-create-node.js | 6 +++--- .../20200129194920-create-general-miner-info.js | 2 +- src/Models/GeneralMinerInfo.ts | 8 ++++---- src/Models/Node.ts | 4 ++-- src/Models/NodeDiskInformation.ts | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Migrations/20191110125455-create-user.js b/src/Migrations/20191110125455-create-user.js index 19f8c58..48ad9af 100644 --- a/src/Migrations/20191110125455-create-user.js +++ b/src/Migrations/20191110125455-create-user.js @@ -13,7 +13,7 @@ module.exports = { type: sequelize.STRING }, hash_password: { - type: sequelize.STRING(128) + type: sequelize.STRING }, createdAt: { allowNull: false, diff --git a/src/Migrations/20191224091606-create-node.js b/src/Migrations/20191224091606-create-node.js index 5afdef4..6e5c72b 100644 --- a/src/Migrations/20191224091606-create-node.js +++ b/src/Migrations/20191224091606-create-node.js @@ -10,13 +10,13 @@ module.exports = { type: sequelize.INTEGER }, url: { - type: sequelize.STRING(128) + type: sequelize.STRING }, token: { - type: sequelize.STRING(150) + type: sequelize.STRING }, address: { - type: sequelize.STRING(128) + type: sequelize.STRING }, userId: { type: sequelize.INTEGER, diff --git a/src/Migrations/20200129194920-create-general-miner-info.js b/src/Migrations/20200129194920-create-general-miner-info.js index e829ba4..8348b93 100644 --- a/src/Migrations/20200129194920-create-general-miner-info.js +++ b/src/Migrations/20200129194920-create-general-miner-info.js @@ -10,7 +10,7 @@ module.exports = { type: sequelize.INTEGER }, version: { - type: sequelize.STRING(25) + type: sequelize.STRING }, walletAddress: { type: sequelize.STRING diff --git a/src/Models/GeneralMinerInfo.ts b/src/Models/GeneralMinerInfo.ts index d757b23..4af3e52 100644 --- a/src/Models/GeneralMinerInfo.ts +++ b/src/Models/GeneralMinerInfo.ts @@ -14,7 +14,7 @@ export class GeneralMinerInfo extends Model { public static initialize(sequelize: Sequelize) { this.init({ version: { - type: DataTypes.STRING(25), + type: DataTypes.STRING(10), allowNull: false, }, walletAddress: { @@ -22,7 +22,7 @@ export class GeneralMinerInfo extends Model { allowNull: false }, sectorSize: { - type: DataTypes.BIGINT, + type: DataTypes.STRING, allowNull: false, }, numberOfSectors: { @@ -30,11 +30,11 @@ export class GeneralMinerInfo extends Model { allowNull: false }, minerPower: { - type: DataTypes.BIGINT, + type: DataTypes.STRING, allowNull: false, }, totalPower: { - type: DataTypes.BIGINT, + type: DataTypes.STRING, allowNull: false, }, } as ModelAttributes, diff --git a/src/Models/Node.ts b/src/Models/Node.ts index e84e8d7..e80e15e 100644 --- a/src/Models/Node.ts +++ b/src/Models/Node.ts @@ -29,7 +29,7 @@ export class Node extends Model implements INode { allowNull: false, }, token: { - type: DataTypes.STRING(150), + type: DataTypes.STRING(128), allowNull: false, }, address: { @@ -41,7 +41,7 @@ export class Node extends Model implements INode { allowNull: true }, description: { - type: DataTypes.TEXT, + type: DataTypes.STRING, allowNull: true }, hasEnabledNotifications: { diff --git a/src/Models/NodeDiskInformation.ts b/src/Models/NodeDiskInformation.ts index 9aee624..ea008a9 100644 --- a/src/Models/NodeDiskInformation.ts +++ b/src/Models/NodeDiskInformation.ts @@ -9,11 +9,11 @@ export class NodeDiskInformation extends Model { public static initialize(sequelize: Sequelize) { this.init({ freeSpace: { - type: DataTypes.BIGINT, + type: DataTypes.STRING, allowNull: false, }, takenSpace: { - type: DataTypes.BIGINT, + type: DataTypes.STRING, allowNull: false, }, } as ModelAttributes, From e160055dad97b45dd4d163c8e29e34d7b565eb07 Mon Sep 17 00:00:00 2001 From: nmlinaric Date: Tue, 7 Apr 2020 14:56:08 +0200 Subject: [PATCH 2/2] Fixed models to follow migrations column types --- src/Models/GeneralMinerInfo.ts | 8 ++++---- src/Models/Node.ts | 8 ++++---- src/Models/NodeDiskInformation.ts | 4 ++-- src/Models/UserModel.ts | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Models/GeneralMinerInfo.ts b/src/Models/GeneralMinerInfo.ts index 4af3e52..7a3b72a 100644 --- a/src/Models/GeneralMinerInfo.ts +++ b/src/Models/GeneralMinerInfo.ts @@ -14,7 +14,7 @@ export class GeneralMinerInfo extends Model { public static initialize(sequelize: Sequelize) { this.init({ version: { - type: DataTypes.STRING(10), + type: DataTypes.STRING, allowNull: false, }, walletAddress: { @@ -22,7 +22,7 @@ export class GeneralMinerInfo extends Model { allowNull: false }, sectorSize: { - type: DataTypes.STRING, + type: DataTypes.BIGINT, allowNull: false, }, numberOfSectors: { @@ -30,11 +30,11 @@ export class GeneralMinerInfo extends Model { allowNull: false }, minerPower: { - type: DataTypes.STRING, + type: DataTypes.BIGINT, allowNull: false, }, totalPower: { - type: DataTypes.STRING, + type: DataTypes.BIGINT, allowNull: false, }, } as ModelAttributes, diff --git a/src/Models/Node.ts b/src/Models/Node.ts index e80e15e..11f326e 100644 --- a/src/Models/Node.ts +++ b/src/Models/Node.ts @@ -25,15 +25,15 @@ export class Node extends Model implements INode { public static initialize(sequelize: Sequelize) { this.init({ url: { - type: DataTypes.STRING(128), + type: DataTypes.STRING, allowNull: false, }, token: { - type: DataTypes.STRING(128), + type: DataTypes.STRING, allowNull: false, }, address: { - type: DataTypes.STRING(128), + type: DataTypes.STRING, allowNull: false, }, name: { @@ -41,7 +41,7 @@ export class Node extends Model implements INode { allowNull: true }, description: { - type: DataTypes.STRING, + type: DataTypes.TEXT, allowNull: true }, hasEnabledNotifications: { diff --git a/src/Models/NodeDiskInformation.ts b/src/Models/NodeDiskInformation.ts index ea008a9..9aee624 100644 --- a/src/Models/NodeDiskInformation.ts +++ b/src/Models/NodeDiskInformation.ts @@ -9,11 +9,11 @@ export class NodeDiskInformation extends Model { public static initialize(sequelize: Sequelize) { this.init({ freeSpace: { - type: DataTypes.STRING, + type: DataTypes.BIGINT, allowNull: false, }, takenSpace: { - type: DataTypes.STRING, + type: DataTypes.BIGINT, allowNull: false, }, } as ModelAttributes, diff --git a/src/Models/UserModel.ts b/src/Models/UserModel.ts index 40b7eae..c00f67e 100644 --- a/src/Models/UserModel.ts +++ b/src/Models/UserModel.ts @@ -21,7 +21,7 @@ export class UserModel extends Model implements User { }, // eslint-disable-next-line hash_password: { - type: DataTypes.STRING(128), + type: DataTypes.STRING, allowNull: false, }, } as ModelAttributes,