mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2025-06-16 19:35:24 +02:00
Inital postgresql implementation (#46)
This commit is contained in:
committed by
GitHub
parent
3a503c9bcb
commit
aa9075f484
@ -11,10 +11,10 @@ class Guilds(db.Model):
|
||||
chat_links = db.Column(db.Boolean(), nullable=False, default=1) # If users can post links
|
||||
bracket_links = db.Column(db.Boolean(), nullable=False, default=1) # If appending brackets to links to prevent embed
|
||||
mentions_limit = db.Column(db.Integer, nullable=False, default=11) # If there is a limit on the number of mentions in a msg
|
||||
roles = db.Column(db.Text(4294967295), nullable=False) # Guild Roles
|
||||
channels = db.Column(db.Text(4294967295), nullable=False) # Guild channels
|
||||
webhooks = db.Column(db.Text(4294967295), nullable=False) # Guild webhooks
|
||||
emojis = db.Column(db.Text(4294967295), nullable=False) # Guild Emojis
|
||||
roles = db.Column(db.Text().with_variant(db.Text(4294967295), 'mysql'), nullable=False) # Guild Roles
|
||||
channels = db.Column(db.Text().with_variant(db.Text(4294967295), 'mysql'), nullable=False) # Guild channels
|
||||
webhooks = db.Column(db.Text().with_variant(db.Text(4294967295), 'mysql'), nullable=False) # Guild webhooks
|
||||
emojis = db.Column(db.Text().with_variant(db.Text(4294967295), 'mysql'), nullable=False) # Guild Emojis
|
||||
owner_id = db.Column(db.String(255), nullable=False) # Snowflake of the owner
|
||||
icon = db.Column(db.String(255)) # The icon string, null if none
|
||||
discordio = db.Column(db.String(255)) # Custom Discord.io Invite Link
|
||||
|
@ -20,14 +20,14 @@ def set_keyvalproperty(key, value, expiration=None):
|
||||
def get_keyvalproperty(key):
|
||||
q = db.session.query(KeyValueProperties).filter(KeyValueProperties.key == key)
|
||||
now = datetime.now()
|
||||
if q.count() > 0 and (q.first().expiration is None or q.first().expiration > now):
|
||||
if q.count() > 0 and (q.first().expiration is None or q.first().expiration.replace(tzinfo=None) > now):
|
||||
return q.first().value
|
||||
return None
|
||||
|
||||
def getexpir_keyvalproperty(key):
|
||||
q = db.session.query(KeyValueProperties).filter(KeyValueProperties.key == key)
|
||||
now = datetime.now()
|
||||
if q.count() > 0 and (q.first().expiration is not None and q.first().expiration > now):
|
||||
if q.count() > 0 and (q.first().expiration is not None and q.first().expiration.replace(tzinfo=None) > now):
|
||||
return int(q.first().expiration.strftime('%s'))
|
||||
return 0
|
||||
|
||||
|
@ -5,7 +5,7 @@ class UserCSS(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True) # Auto increment id
|
||||
name = db.Column(db.String(255), nullable=False) # CSS Name
|
||||
user_id = db.Column(db.String(255), nullable=False) # Discord client ID of the owner of the css (can edit)
|
||||
css = db.Column(db.Text(4294967295)) # CSS contents
|
||||
css = db.Column(db.Text().with_variant(db.Text(4294967295), 'mysql')) # CSS contents
|
||||
|
||||
def __init__(self, name, user_id, css=None):
|
||||
self.name = name
|
||||
|
Reference in New Issue
Block a user