All checks were successful
Deploy Beta (NATIVE) / deploy (push) Successful in 44s
27 lines
1 KiB
JavaScript
27 lines
1 KiB
JavaScript
exports.up = async (knex) => {
|
|
const hasTable = await knex.schema.hasTable("aws_account");
|
|
if (hasTable) {
|
|
const isPostgres = knex.client.dialect === "postgresql" || knex.client.config.client === "pg";
|
|
if (isPostgres) {
|
|
await knex.raw('ALTER TABLE "aws_account" ALTER COLUMN "user_id" TYPE VARCHAR(255);');
|
|
} else {
|
|
try {
|
|
await knex.schema.alterTable("aws_account", (table) => {
|
|
table.string("user_id", 255).nullable().alter();
|
|
});
|
|
} catch (error) {
|
|
console.error("Error altering user_id column:", error.message);
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
exports.down = async (knex) => {
|
|
const hasTable = await knex.schema.hasTable("aws_account");
|
|
if (hasTable) {
|
|
const isPostgres = knex.client.dialect === "postgresql" || knex.client.config.client === "pg";
|
|
if (isPostgres) {
|
|
await knex.raw('ALTER TABLE "aws_account" ALTER COLUMN "user_id" TYPE INTEGER;');
|
|
}
|
|
}
|
|
};
|