Skip to content

Commit

Permalink
Merge pull request #1 from gistia/redshift_support
Browse files Browse the repository at this point in the history
Adding support to AWS Redshift
  • Loading branch information
felipeik authored Sep 13, 2024
2 parents e2afa3e + f950b5f commit 2df335e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/migration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export class Migration implements RunMigration {

case this.up: {
this.logger.info(`### MIGRATION ${this.name} (UP) ###`);
return `INSERT INTO "${schema}"."${migrationsTable}" (name, run_on) VALUES ('${name}', NOW());`;
return `INSERT INTO "${schema}"."${migrationsTable}" (name, run_on) VALUES ('${name}', CURRENT_TIMESTAMP);`;
}

default: {
Expand Down
3 changes: 2 additions & 1 deletion src/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ async function ensureMigrationsTable(
);
}
} else {
const type = options.isRedshift ? 'INT IDENTITY(1, 1)' : 'SERIAL';
await db.query(
`CREATE TABLE ${fullTableName} (${idColumn} SERIAL PRIMARY KEY, ${nameColumn} varchar(255) NOT NULL, ${runOnColumn} timestamp NOT NULL)`
`CREATE TABLE ${fullTableName} (${idColumn} ${type} PRIMARY KEY, ${nameColumn} varchar(255) NOT NULL, ${runOnColumn} timestamp NOT NULL)`
);
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down
2 changes: 2 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,8 @@ export interface RunnerOptionConfig {
* Print all debug messages like DB queries run (if you switch it on, it will disable `logger.debug` method).
*/
verbose?: boolean;

isRedshift?: boolean;
}

export interface RunnerOptionUrl {
Expand Down

0 comments on commit 2df335e

Please sign in to comment.