Skip to content

Implementing on a new db #59

Open
Open
@erasmuswill

Description

@erasmuswill

I am attempting to use this library to bootstrap a developer environment with GitPod. However, when I run the one script that sets up the entire db, I am getting this error:

Migrations error Error: Migration failed. Reason: An error occurred running 'rolledUp'. Rolled back this migration. No further migrations were run. Reason: relation "migrations" does not exist
at /workspace/XXX/node_modules/postgres-migrations/dist/migrate.js:63:27
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async /workspace/XXX/node_modules/postgres-migrations/dist/with-lock.js:25:28
at async /workspace/XXX/node_modules/postgres-migrations/dist/with-connection.js:16:28
at async /workspace/XXX/src/migrate.js:52:9 {
cause: Error: An error occurred running 'rolledUp'. Rolled back this migration. No further migrations were run. Reason: relation "migrations" does not exist
at /workspace/XXX/node_modules/postgres-migrations/dist/run-migration.js:36:15
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async /workspace/XXX/node_modules/postgres-migrations/dist/migrate.js:54:32
at async /workspace/XXX/node_modules/postgres-migrations/dist/with-lock.js:25:28
at async /workspace/XXX/node_modules/postgres-migrations/dist/with-connection.js:16:28
at async /workspace/XXX/src/migrate.js:52:9
}

This is the code block where the error is originating:

const { createDb, migrate } = require("postgres-migrations");

        const database = 'XX';
        const cn = {
            database,
            user: "XXXX",
            password: "XXXXX",
            host: "localhost",
            port: 5432,
        };
    const dbConfig = { database, ...cn };

    try {
        await createDb(database, {
            ...dbConfig,
        })
        await migrate(dbConfig, "src/sql-migrations/").then(a => console.log("migrations applide", a)) // Line 52
    }
    catch (e) { console.error("Migrations error", e) }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions