queryInterface.addColumns always adds "public." to the table name for Postgres
See original GitHub issueNot sure if I’m doing anything wrong, but this is a pretty big blocker for me right now. I need to add a column to an existing table which is in a schema different from “public”.
Simply using the table name throws this error:
"relation \"public.mytable\" does not exist"
Adding the schema to the table name throws (this works for addIndex):
"relation \"public.default.mytable\" does not exist"
I’ve tried adding a schema
property to the options object, like for the createTable method, but it seems to be ignored.
Is there a way to avoid “public” always getting added? I’ve also haven’t seen a way to send arbitrary sql statements to the queryInterface, this way I could just send the “alter table” myself.
sequelize version: 5.19.4
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Sequelize migration add "IF NOT EXISTS" to addIndex and ...
If the column you need to add does not exist then call the queryInterface.addColumn function. const tableName = 'your_table_name' ...
Read more >QueryInterface - Sequelize
Add a new column to a table queryInterface.addColumn('tableA', 'columnC', Sequelize.STRING, { after: 'columnB' // after option is only supported by MySQL }); ...
Read more >Modifying an existing sequelize migration - DEV Community
This is a sequelize method queryInterface uses, to add a new column to a table. It takes the column and the name of...
Read more >Fullstack part13 | Migrations, many-to-many relationships
When defining migrations, it is essential to remember that unlike models, column and table names are written in snake case form: await queryInterface....
Read more >Active Record Migrations - Rails Edge Guides
This migration adds a table called products with a string column called name and a text column called description . A primary key...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For those who are like me found this from google search, this is duplicate of #11742
It seems like there’s no way to specify a default schema for migrations (won’t work with addColumn), you can however, change all your migrations to specify schema instead
This issue has been automatically marked as stale because it has been open for 14 days without activity. It will be closed if no further activity occurs within the next 14 days. If this is still an issue, just leave a comment or remove the “stale” label. 🙂