-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.py
34 lines (29 loc) · 1.01 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import os
from sqlalchemy import Column, Integer, String
from sqlalchemy.sql.expression import null
from sqlalchemy.sql.sqltypes import Boolean
from database import Base
try:
PREFIX = os.environ["PREFIX"]
except:
PREFIX = "*"
class Clients(Base):
__tablename__ = 'clients'
id = Column(Integer, primary_key=True, index=True)
guild_id = Column(Integer, index=True, nullable=False)
prefix = Column(String, default=PREFIX)
channel = Column(Integer, index=True, nullable=False)
def __init__(self, guild_id, channel, prefix=PREFIX):
self.guild_id = guild_id
self.prefix = prefix
self.channel = channel
class Comics(Base):
__tablename__ = 'comics'
id = Column(Integer, primary_key=True, index=True)
title = Column(String, index=True, nullable=False)
url = Column(String, index=True, nullable=False)
date = Column(String, index=True, nullable=False)
def __init__(self, title, url, date):
self.title = title
self.url = url
self.date = date