2022-01-15 00:23:50 +00:00
|
|
|
import peewee
|
|
|
|
import datetime
|
2024-05-29 23:21:50 +00:00
|
|
|
from app.classes.shared.helpers import Helpers
|
2022-01-15 00:23:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
def migrate(migrator, database, **kwargs):
|
2022-03-23 02:50:12 +00:00
|
|
|
migrator.add_columns(
|
2024-05-29 23:21:50 +00:00
|
|
|
"users", valid_tokens_from=peewee.DateTimeField(default=Helpers.get_utc_now)
|
2022-03-23 02:50:12 +00:00
|
|
|
)
|
|
|
|
migrator.drop_columns("users", ["api_token"])
|
2022-01-15 00:23:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
def rollback(migrator, database, **kwargs):
|
2022-03-23 02:50:12 +00:00
|
|
|
migrator.drop_columns("users", ["valid_tokens_from"])
|
|
|
|
migrator.add_columns(
|
|
|
|
"users", api_token=peewee.CharField(default="", unique=True, index=True)
|
|
|
|
)
|