update assets db types

This commit is contained in:
jejolare 2024-10-01 22:05:44 +07:00
parent fff79eca04
commit 40a408fcdd
3 changed files with 75 additions and 9 deletions

View file

@ -0,0 +1,68 @@
'use strict';
/** @type {import('sequelize-cli').Migration} */
module.exports = {
up: async (queryInterface, Sequelize) => {
await queryInterface.changeColumn('assets', 'logo', {
type: Sequelize.TEXT,
allowNull: true,
});
await queryInterface.changeColumn('assets', 'price_url', {
type: Sequelize.TEXT,
allowNull: true,
});
await queryInterface.changeColumn('assets', 'ticker', {
type: Sequelize.TEXT,
allowNull: true,
});
await queryInterface.changeColumn('assets', 'full_name', {
type: Sequelize.TEXT,
allowNull: true,
});
await queryInterface.changeColumn('assets', 'total_max_supply', {
type: Sequelize.TEXT,
allowNull: true,
});
await queryInterface.changeColumn('assets', 'current_supply', {
type: Sequelize.TEXT,
allowNull: true,
});
},
down: async (queryInterface, Sequelize) => {
await queryInterface.changeColumn('assets', 'logo', {
type: Sequelize.STRING,
allowNull: true,
});
await queryInterface.changeColumn('assets', 'price_url', {
type: Sequelize.STRING,
allowNull: true,
});
await queryInterface.changeColumn('assets', 'ticker', {
type: Sequelize.STRING,
allowNull: true,
});
await queryInterface.changeColumn('assets', 'full_name', {
type: Sequelize.STRING,
allowNull: true,
});
await queryInterface.changeColumn('assets', 'total_max_supply', {
type: Sequelize.STRING,
allowNull: true,
});
await queryInterface.changeColumn('assets', 'current_supply', {
type: Sequelize.STRING,
allowNull: true,
});
}
};

View file

@ -25,14 +25,14 @@ Asset.init(
id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true },
asset_id: { type: DataTypes.STRING, allowNull: true },
logo: { type: DataTypes.STRING, allowNull: true },
price_url: { type: DataTypes.STRING, allowNull: true },
ticker: { type: DataTypes.STRING, allowNull: true },
full_name: { type: DataTypes.STRING, allowNull: true },
total_max_supply: { type: DataTypes.STRING, allowNull: true },
current_supply: { type: DataTypes.STRING, allowNull: true },
logo: { type: DataTypes.TEXT, allowNull: true },
price_url: { type: DataTypes.TEXT, allowNull: true },
ticker: { type: DataTypes.TEXT, allowNull: true },
full_name: { type: DataTypes.TEXT, allowNull: true },
total_max_supply: { type: DataTypes.TEXT, allowNull: true },
current_supply: { type: DataTypes.TEXT, allowNull: true },
decimal_point: { type: DataTypes.INTEGER, allowNull: true },
meta_info: { type: DataTypes.STRING, allowNull: true },
meta_info: { type: DataTypes.TEXT, allowNull: true },
price: { type: DataTypes.INTEGER, allowNull: true }
},
{

View file

@ -403,8 +403,6 @@ const requestsLimiter = rateLimit({
raw: true,
});
fs.writeFileSync('charts.json', JSON.stringify(charts, null, 2));
if (!chart) {
return res.status(400).json({ error: 'Invalid parameters' });
}