crafty-4/app/migrations/20211120221511_api_keys.py
Iain Powrie 29ce7a2cde Revert "Merge branch 'dev' into 'master'"
This reverts merge request !783
2024-07-29 21:49:44 +00:00

17 lines
461 B
Python

import peewee
import datetime
def migrate(migrator, database, **kwargs):
migrator.add_columns(
"users", valid_tokens_from=peewee.DateTimeField(default=datetime.datetime.now)
)
migrator.drop_columns("users", ["api_token"])
def rollback(migrator, database, **kwargs):
migrator.drop_columns("users", ["valid_tokens_from"])
migrator.add_columns(
"users", api_token=peewee.CharField(default="", unique=True, index=True)
)