"mysql2": "^3.10.0",
"sequelize": "^6.37.3",
"umzug": "^3.8.1"
node version v20.10.0
We have migrations written in typescript like
import { MigrationParams } from "@local-types";
import { DataTypes } from "sequelize";
export const up = async ({ context: sequelize }: MigrationParams) => {
await sequelize.addColumn(
// some code
);
};
export const down = async ({ context: sequelize }: MigrationParams) => {
await sequelize.removeColumn(
// some code
);
};
which gets compiled to .js files and is run through nodejs lambda
The error is happening randomly without any concurrent pattern seen.
FYI: we have few files like random_file.ts.ts in between as tech debt but couldnt reproduce with them as well
also this is how i am initializing umzug
import fs from "fs";
import path from "path";
import { Sequelize } from "sequelize";
import { Umzug, SequelizeStorage } from "umzug";
interface Props {
databaseName: string;
}
export const getUmzug = (
sequelize: Sequelize,
props?: Props,
migrationsGlob?: string
) => {
return new Umzug({
migrations: {
glob: "build/migrations/*.{ts,js}",
resolve: ({ name, path, context }) => {
const migration = require(path);
return {
name: name.replace(/\.js$/, ".ts"),
up: async () =>
migration.up({
context,
...(props && { databaseName: props.databaseName })
}),
down: async () => migration.down({ context })
};
}
},
context: sequelize.getQueryInterface(),
storage: new SequelizeStorage({
sequelize: sequelize,
tableName: process.env.DB_META_TABLE_NAME || "SequelizeMeta"
}),
logger: console,
create: {
folder: "src/migrations",
template: filePath => [
[
filePath,
fs.readFileSync(
path.join(__dirname, "template", "sample-migration.ts"),
"utf-8"
)
]
]
}
});
};
"mysql2": "^3.10.0",
"sequelize": "^6.37.3",
"umzug": "^3.8.1"
node version v20.10.0
We have migrations written in typescript like
which gets compiled to .js files and is run through nodejs lambda
The error is happening randomly without any concurrent pattern seen.
FYI: we have few files like random_file.ts.ts in between as tech debt but couldnt reproduce with them as well
also this is how i am initializing umzug