crafty-4/app/migrations/20230119_command_drop.py

36 lines
934 B
Python
Raw Normal View History

2023-01-19 16:47:07 +00:00
# Generated by database migrator
import datetime
from peewee import *
from app.classes.models.users import Users
from app.classes.models.servers import Servers
def migrate(migrator, database, **kwargs):
migrator.drop_table("commands")
"""
Write your migrations here.
"""
def rollback(migrator, database, **kwargs):
db = database
class Commands(Model):
command_id = AutoField()
created = DateTimeField(default=datetime.datetime.now)
server_id = ForeignKeyField(Servers, backref="server", index=True)
user = ForeignKeyField(Users, backref="user", index=True)
source_ip = CharField(default="127.0.0.1")
command = CharField(default="")
executed = BooleanField(default=False)
class Meta:
2023-01-19 16:57:11 +00:00
table_name = "commands"
2023-01-19 16:47:07 +00:00
database = db
migrator.create_table(Commands)
"""
Write your rollback migrations here.
"""