mirror of
https://github.com/Derpy-Leggies/OnlyLegs.git
synced 2025-01-01 12:26:13 +00:00
💀
This commit is contained in:
parent
422ed16b4a
commit
b5fc635f7d
|
@ -5,7 +5,8 @@ from uuid import uuid4
|
||||||
import os
|
import os
|
||||||
import platformdirs
|
import platformdirs
|
||||||
|
|
||||||
from sqlalchemy import create_engine, Column, Integer, String, DateTime, ForeignKey, PickleType, func
|
from sqlalchemy import (create_engine, Column, Integer, String,
|
||||||
|
DateTime, ForeignKey, PickleType, func)
|
||||||
from sqlalchemy.orm import declarative_base, relationship
|
from sqlalchemy.orm import declarative_base, relationship
|
||||||
from flask_login import UserMixin
|
from flask_login import UserMixin
|
||||||
|
|
||||||
|
@ -33,7 +34,7 @@ class Users (base, UserMixin): # pylint: disable=too-few-public-methods, C0103
|
||||||
username = Column(String, unique=True, nullable=False)
|
username = Column(String, unique=True, nullable=False)
|
||||||
email = Column(String, unique=True, nullable=False)
|
email = Column(String, unique=True, nullable=False)
|
||||||
password = Column(String, nullable=False)
|
password = Column(String, nullable=False)
|
||||||
joined_at = Column(DateTime, nullable=False, server_default=func.now())
|
joined_at = Column(DateTime, nullable=False, server_default=func.now()) # pylint: disable=E1102
|
||||||
|
|
||||||
posts = relationship('Posts', backref='users')
|
posts = relationship('Posts', backref='users')
|
||||||
groups = relationship('Groups', backref='users')
|
groups = relationship('Groups', backref='users')
|
||||||
|
@ -52,7 +53,7 @@ class Posts (base): # pylint: disable=too-few-public-methods, C0103
|
||||||
|
|
||||||
id = Column(Integer, primary_key=True)
|
id = Column(Integer, primary_key=True)
|
||||||
author_id = Column(Integer, ForeignKey('users.id'))
|
author_id = Column(Integer, ForeignKey('users.id'))
|
||||||
created_at = Column(DateTime, nullable=False, server_default=func.now())
|
created_at = Column(DateTime, nullable=False, server_default=func.now()) # pylint: disable=E1102
|
||||||
filename = Column(String, unique=True, nullable=False)
|
filename = Column(String, unique=True, nullable=False)
|
||||||
mimetype = Column(String, nullable=False)
|
mimetype = Column(String, nullable=False)
|
||||||
exif = Column(PickleType, nullable=False)
|
exif = Column(PickleType, nullable=False)
|
||||||
|
@ -73,7 +74,7 @@ class Groups (base): # pylint: disable=too-few-public-methods, C0103
|
||||||
name = Column(String, nullable=False)
|
name = Column(String, nullable=False)
|
||||||
description = Column(String, nullable=False)
|
description = Column(String, nullable=False)
|
||||||
author_id = Column(Integer, ForeignKey('users.id'))
|
author_id = Column(Integer, ForeignKey('users.id'))
|
||||||
created_at = Column(DateTime, nullable=False, server_default=func.now())
|
created_at = Column(DateTime, nullable=False, server_default=func.now()) # pylint: disable=E1102
|
||||||
|
|
||||||
junction = relationship('GroupJunction', backref='groups')
|
junction = relationship('GroupJunction', backref='groups')
|
||||||
|
|
||||||
|
@ -86,7 +87,7 @@ class GroupJunction (base): # pylint: disable=too-few-public-methods, C0103
|
||||||
__tablename__ = 'group_junction'
|
__tablename__ = 'group_junction'
|
||||||
|
|
||||||
id = Column(Integer, primary_key=True)
|
id = Column(Integer, primary_key=True)
|
||||||
date_added = Column(DateTime, nullable=False, server_default=func.now())
|
date_added = Column(DateTime, nullable=False, server_default=func.now()) # pylint: disable=E1102
|
||||||
group_id = Column(Integer, ForeignKey('groups.id'))
|
group_id = Column(Integer, ForeignKey('groups.id'))
|
||||||
post_id = Column(Integer, ForeignKey('posts.id'))
|
post_id = Column(Integer, ForeignKey('posts.id'))
|
||||||
|
|
||||||
|
@ -103,7 +104,7 @@ class Logs (base): # pylint: disable=too-few-public-methods, C0103
|
||||||
ip_address = Column(String, nullable=False)
|
ip_address = Column(String, nullable=False)
|
||||||
code = Column(Integer, nullable=False)
|
code = Column(Integer, nullable=False)
|
||||||
note = Column(String, nullable=False)
|
note = Column(String, nullable=False)
|
||||||
created_at = Column(DateTime, nullable=False, server_default=func.now())
|
created_at = Column(DateTime, nullable=False, server_default=func.now()) # pylint: disable=E1102
|
||||||
|
|
||||||
|
|
||||||
class Bans (base): # pylint: disable=too-few-public-methods, C0103
|
class Bans (base): # pylint: disable=too-few-public-methods, C0103
|
||||||
|
@ -116,7 +117,7 @@ class Bans (base): # pylint: disable=too-few-public-methods, C0103
|
||||||
ip_address = Column(String, nullable=False)
|
ip_address = Column(String, nullable=False)
|
||||||
code = Column(Integer, nullable=False)
|
code = Column(Integer, nullable=False)
|
||||||
note = Column(String, nullable=False)
|
note = Column(String, nullable=False)
|
||||||
banned_at = Column(DateTime, nullable=False, server_default=func.now())
|
banned_at = Column(DateTime, nullable=False, server_default=func.now()) # pylint: disable=E1102
|
||||||
|
|
||||||
|
|
||||||
# check if database file exists, if not create it
|
# check if database file exists, if not create it
|
||||||
|
|
Loading…
Reference in a new issue