New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to rename a table #1403

Closed
rvarbanov opened this Issue May 12, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@rvarbanov

rvarbanov commented May 12, 2016

My migration scripts are breaking when trying to rename a table

'use strict';

exports.up = (knex, Promise) => {
    return knex.schema.withSchema('core').renameTable('organization_id_type', 'organization_code_type');
};

exports.down = (knex, Promise) => {
    return knex.schema.withSchema('core').renameTable('organization_code_type', 'organization_id_type');
};

and here is the warning that I get

Knex:warning - migrations failed with error: alter table "core"."organization_id_type" rename to "core"."organization_code_type" - syntax error at or near "."
Unhandled rejection error: alter table "core"."organization_id_type" rename to "core"."organization_code_type" - syntax error at or near "."
    at Connection.parseE (/opt/app/node_modules/pg/lib/connection.js:539:11)
    at Connection.parseMessage (/opt/app/node_modules/pg/lib/connection.js:366:17)
    at Socket.<anonymous> (/opt/app/node_modules/pg/lib/connection.js:105:22)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:172:18)
    at Socket.Readable.push (_stream_readable.js:130:10)
    at TCP.onread (net.js:542:20)
@rhys-vdw

This comment has been minimized.

Collaborator

rhys-vdw commented May 14, 2016

Got the correct output syntax from StackOverflow.

The "schema" part should not be specified in the TO name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment