Comments (3)
After some tinkering I found that the following modification seems to work:
@cached_property
def model(self):
"""Initialize and cache MigrationHistory model."""
MigrateHistory._meta.database = self.database
MigrateHistory._meta.db_table = self.migrate_table
self.database.create_table(MigrateHistory, safe=True)
return MigrateHistory
and I posted an issue about it to peewee's repo: coleifer/peewee#1314
from peewee_migrate.
Ok, I found the issue. Problem was that I have multiple schemas in my database and at the moment peewee_migrate seems to add migratehistory
table to first schema, in my case to schema extensions
. Now since 'MigrateHistorydoes not specify meta option
schema peewee's table_exists
function fails because its implementation requires schema to be set:
@classmethod
def table_exists(cls):
kwargs = {}
if cls._meta.schema:
kwargs['schema'] = cls._meta.schema
return cls._meta.db_table in cls._meta.database.get_tables(**kwargs)
So for now the solution is to add following to the MigrateHistory
model:
class Meta:
schema = 'schema_name'
This is a bit dirty however. Would it be possible to somehow configure MigrateHistory
model to pass it the schema option?
from peewee_migrate.
Hello @Tumetsu,
Good point. Sorry for the late response, but I've added schema param to Router. And now the option is configurable.
from peewee_migrate.
Related Issues (20)
- peewee.InternalError: (1059, "Identifier name 'fk_tb_transition_record_operation_record_id_refs_tb_operation_record' is too long")
- `auto` can be `list`
- Migration failed, keyerror, migrator.orm is empty HOT 4
- CLI create migration - ignore option missing
- Peewee Migrate 2: support is here HOT 2
- Persist schema for all migrations HOT 1
- Bug report: Self foreign keys are not handled
- Bug report: [PLEASE DESCRIBE] HOT 1
- Bug report: [The same database name conflict: pw]
- Bug report: [Wrong migrate for datetimefield with default value] HOT 1
- Bug report: Failed when reference a custom fields HOT 1
- Bug report: migration datetime field not get default HOT 2
- Bug report: invalid VOID parameters HOT 1
- Bug report: don't write to stderr when used as a library
- Bug report: Not work migrate on foreign_keys=1 HOT 1
- pw_migrate: command not found HOT 2
- Bug report: Git tag for 1.7.0 is missing HOT 1
- pw_migrate rollback: ... Ignored in case of non-empty name
- Incorrect index drop/remove syntax
- Constraints do not get carried over into migrations
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from peewee_migrate.