Skip to content

Commit

Permalink
ft: change data type change for chainid
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilkumar1612 committed Nov 26, 2024
1 parent 1b02c76 commit dc96ec9
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 2 deletions.
45 changes: 45 additions & 0 deletions backend/migrations/20241126170930-change-chain-id-to-bigint.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
require('dotenv').config();
const { DataTypes } = require('sequelize');

async function up({ context: queryInterface }) {
await queryInterface.changeColumn(
{schema: process.env.DATABASE_SCHEMA_NAME, tableName: 'sponsorship_policies'},
'ENABLED_CHAINS',
{
type: DataTypes.ARRAY(DataTypes.BIGINT),
allowNull: true
}
);

await queryInterface.changeColumn(
{schema: process.env.DATABASE_SCHEMA_NAME, tableName: 'contract_whitelist'},
'CHAIN_ID',
{
type: DataTypes.BIGINT,
allowNull: false
}
);
}

async function down({ context: queryInterface }) {
await queryInterface.changeColumn(
{schema: process.env.DATABASE_SCHEMA_NAME, tableName: 'sponsorship_policies'},
'ENABLED_CHAINS',
{
type: DataTypes.ARRAY(DataTypes.INTEGER),
allowNull: true
}
);

await queryInterface.changeColumn(
{schema: process.env.DATABASE_SCHEMA_NAME, tableName: 'contract_whitelist'},
'CHAIN_ID',
{
type: DataTypes.INTEGER,
allowNull: false
}
);
}

/** @type {import('sequelize-cli').Migration} */
module.exports = {up, down};
2 changes: 1 addition & 1 deletion backend/src/models/contract-whitelist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function initializeContractWhitelistModel(sequelize: Sequelize, schema: s
field: 'ABI'
},
chainId: {
type: DataTypes.INTEGER,
type: DataTypes.BIGINT,
allowNull: false,
field: 'CHAIN_ID'
},
Expand Down
2 changes: 1 addition & 1 deletion backend/src/models/sponsorship-policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export function initializeSponsorshipPolicyModel(sequelize: Sequelize, schema: s
field: 'IS_APPLICABLE_TO_ALL_NETWORKS'
},
enabledChains: {
type: DataTypes.ARRAY(DataTypes.INTEGER),
type: DataTypes.ARRAY(DataTypes.BIGINT),
allowNull: true,
field: 'ENABLED_CHAINS'
},
Expand Down

0 comments on commit dc96ec9

Please sign in to comment.