Skip to content
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

How to add a new column in existing table after a specified column. #888

Open
krzywiecki opened this issue Apr 6, 2022 · 2 comments
Open

Comments

@krzywiecki
Copy link

Hey guys, asking this question after not so successful internet research.

Basically, I need to add a new column to an existing table. By default, it adds a new column at the end but what I need to do is to add the column after another specific column. I tried to do this:

pgm.addColumns('mbb_channels', {
        budget_gross_cents: { 
            type: 'integer', 
            notNull: true,
            default: 0,
            after: 'budget_gross'
        },
});

but looks like the after property isn't supported.

Is there a way to achieve it?

@GabenGar
Copy link

GabenGar commented May 4, 2022

Why do you need "after" specifically? The column order shouldn't matter and if it does matter for the context of a query, you will name them in a specific order within it.

@moltar
Copy link

moltar commented Oct 18, 2022

This is a PostgreSQL limitation. There is no way to add columns after another column, like in MySQL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants