-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add cache_is_valid property to query model
- Loading branch information
Showing
2 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
db/migrations/011_add_more_cache_is_valid_column_to_query_table.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
"""Peewee migrations -- 011_add_more_cache_is_valid_column_to_query_table.py.""" | ||
import peewee as pw | ||
from peewee_migrate import Migrator | ||
|
||
from db.models import Query | ||
|
||
|
||
def migrate(migrator: Migrator, database: pw.Database, fake=False, **kwargs): | ||
"""Write your migrations here.""" | ||
field = pw.BooleanField(null=False, default=True) | ||
migrator.add_fields( | ||
Query, | ||
cache_is_valid=field, | ||
) | ||
migrator.run() | ||
|
||
|
||
def rollback(migrator: Migrator, database: pw.Database, fake=False, **kwargs): | ||
"""Write your rollback migrations here.""" | ||
migrator.remove_fields(Query, 'cache_is_valid', cascade=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters