Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

186
Views
postgrator return invalid pattern errror

I have tried to setup a data migration service using postgrator version 7.1.0. I have the following code

import Postgrator from "postgrator";
import pg from "pg";
import { dirname } from "path";
import { fileURLToPath } from "url";

const __dirname = dirname(fileURLToPath(import.meta.url));

async function doMigration() {
  // Create a client of your choice
  const client = new pg.Client({
    host: "0.0.0.1",
    port: 9075,
    database: "test",
    user: "test",
    password: "!testPwd",
  });

  

  try {
    // Establish a database connection
    await client.connect();

    // Create postgrator instance
    const postgrator = new Postgrator({
    migrationDirectory: __dirname + '/migration-scripts',
    driver: "pg",
    database: "test",
    schemaTable: "migration_version",
    execQuery: (query) => client.query(query),
    });

    
    
    await postgrator.migrate();
    console.log("schema migration completed successfully")
  } catch (error) {
    console.error(error); 
  }

  // Once done migrating, close your connection.
  await client.end();
}
doMigration();

But I got an error when running the above code

TypeError: invalid pattern
about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!