2021-08-22 10:21:59 +00:00
|
|
|
# Generated by database migrator
|
|
|
|
from peewee import *
|
2021-09-08 22:01:10 +00:00
|
|
|
from app.classes.models.users import Users
|
|
|
|
from app.classes.models.servers import Servers
|
2021-08-22 10:21:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
def migrate(migrator, database, **kwargs):
|
2022-03-23 02:50:12 +00:00
|
|
|
migrator.drop_table("user_servers") # Can be model class OR table name
|
2021-08-22 10:21:59 +00:00
|
|
|
"""
|
|
|
|
Write your migrations here.
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
def rollback(migrator, database, **kwargs):
|
2022-03-23 02:50:12 +00:00
|
|
|
db = database
|
|
|
|
|
2021-08-22 10:21:59 +00:00
|
|
|
class User_Servers(Model):
|
2022-03-23 02:50:12 +00:00
|
|
|
user_id = ForeignKeyField(Users, backref="user_server")
|
|
|
|
server_id = ForeignKeyField(Servers, backref="user_server")
|
2021-08-22 10:21:59 +00:00
|
|
|
permissions = CharField(default="00000000")
|
|
|
|
|
|
|
|
class Meta:
|
2022-03-23 02:50:12 +00:00
|
|
|
table_name = "user_servers"
|
|
|
|
primary_key = CompositeKey("user_id", "server_id")
|
2021-08-22 10:21:59 +00:00
|
|
|
database = db
|
2022-03-23 02:50:12 +00:00
|
|
|
|
2021-08-22 10:21:59 +00:00
|
|
|
migrator.create_table(User_Servers)
|
|
|
|
"""
|
|
|
|
Write your rollback migrations here.
|
|
|
|
"""
|