Cannot specify schema with PostgresqlMigrator
See original GitHub issueI’m trying to use playhouse.migrate
to modify the database according to the model changes, but it seems I cannot specify the PostgreSQL schema of the table that I need to alter.
My model looks like this:
db = PostgresqlDatabase(...)
class MyTable(Model):
title = CharField()
class Meta:
database = db
db_table = 'table_name'
schema = 'my_schema'
But if I run migration code like the following:
migrator = PostgresqlMigrator(db)
new_field = CharField(default="")
migrate(
migrator.add_column(MyTable._meta.db_table, 'new_field', new_field),
)
, I get this error:
peewee.ProgrammingError: relation "table_name" does not exist
How can I tell the migrator that it should alter the table table_name
in the schema my_schema
?
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Documentation: 15: 5.9. Schemas - PostgreSQL
A PostgreSQL database cluster contains one or more named databases. ... By default, users cannot access any objects in schemas they do not...
Read more >Dbcontext not able to migrate because schema does not exist?
DbContext is being created, but once the migrations is being called i get an error stating that the schema, does not exist? which...
Read more >Zero-downtime Postgres schema migrations need this
Deploying DB schema changes in heavily loaded systems is challenging. In this article, we explore one of the challenges - how to avoid ......
Read more >PostgreSQL error when migrating from 5.39.0 to 6.0.0
Summary errors during the database schema migration of the PostgreSQL database when starting up the 6.0.0 version with a PostgreSQL 13.4 ...
Read more >PostgreSQL schema-change gotchas - Medium
Add the new column (without the default value). · Set the default value on the column. This operation locks the table too, but...
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 FreeTop 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
Top GitHub Comments
Rather than modify all the APIs to support a schema parameter, I added a method which you can use to set the search path for subsequent operations. e.g.
Yep, that seems to fix the problem.