forked from rDrama/rDrama
add created_utc column to all tables
parent
4abf75edc0
commit
d7c3ddf474
|
@ -1,6 +1,6 @@
|
||||||
from sqlalchemy import *
|
from sqlalchemy import *
|
||||||
from files.__main__ import Base
|
from files.__main__ import Base
|
||||||
|
import time
|
||||||
|
|
||||||
class Alt(Base):
|
class Alt(Base):
|
||||||
__tablename__ = "alts"
|
__tablename__ = "alts"
|
||||||
|
@ -8,6 +8,11 @@ class Alt(Base):
|
||||||
user1 = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
user1 = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||||
user2 = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
user2 = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||||
is_manual = Column(Boolean, default=False)
|
is_manual = Column(Boolean, default=False)
|
||||||
|
created_utc = Column(Integer)
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ from sqlalchemy.orm import relationship
|
||||||
from files.__main__ import Base
|
from files.__main__ import Base
|
||||||
from files.helpers.lazy import lazy
|
from files.helpers.lazy import lazy
|
||||||
from files.helpers.const import *
|
from files.helpers.const import *
|
||||||
|
import time
|
||||||
|
|
||||||
class AwardRelationship(Base):
|
class AwardRelationship(Base):
|
||||||
|
|
||||||
|
@ -15,11 +16,16 @@ class AwardRelationship(Base):
|
||||||
kind = Column(String)
|
kind = Column(String)
|
||||||
awarded_utc = Column(Integer)
|
awarded_utc = Column(Integer)
|
||||||
granted = Column(Boolean)
|
granted = Column(Boolean)
|
||||||
|
created_utc = Column(Integer)
|
||||||
|
|
||||||
user = relationship("User", primaryjoin="AwardRelationship.user_id==User.id", back_populates="awards")
|
user = relationship("User", primaryjoin="AwardRelationship.user_id==User.id", back_populates="awards")
|
||||||
post = relationship("Submission", primaryjoin="AwardRelationship.submission_id==Submission.id", back_populates="awards")
|
post = relationship("Submission", primaryjoin="AwardRelationship.submission_id==Submission.id", back_populates="awards")
|
||||||
comment = relationship("Comment", primaryjoin="AwardRelationship.comment_id==Comment.id", back_populates="awards")
|
comment = relationship("Comment", primaryjoin="AwardRelationship.comment_id==Comment.id", back_populates="awards")
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<AwardRelationship(id={self.id})>"
|
return f"<AwardRelationship(id={self.id})>"
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,11 @@ class BadgeDef(Base):
|
||||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||||
name = Column(String)
|
name = Column(String)
|
||||||
description = Column(String)
|
description = Column(String)
|
||||||
|
created_utc = Column(Integer)
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<BadgeDef(id={self.id})>"
|
return f"<BadgeDef(id={self.id})>"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from sqlalchemy import *
|
from sqlalchemy import *
|
||||||
from sqlalchemy.orm import relationship
|
from sqlalchemy.orm import relationship
|
||||||
from files.__main__ import Base
|
from files.__main__ import Base
|
||||||
|
import time
|
||||||
|
|
||||||
class Category(Base):
|
class Category(Base):
|
||||||
__tablename__ = "category"
|
__tablename__ = "category"
|
||||||
|
@ -10,6 +11,14 @@ class Category(Base):
|
||||||
sub = Column(String(20), ForeignKey("subs.name"))
|
sub = Column(String(20), ForeignKey("subs.name"))
|
||||||
color_text = Column(String(6))
|
color_text = Column(String(6))
|
||||||
color_bg = Column(String(6))
|
color_bg = Column(String(6))
|
||||||
|
created_utc = Column(Integer)
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return f"<Category(id={self.id})>"
|
||||||
|
|
||||||
def as_json(self):
|
def as_json(self):
|
||||||
data = {
|
data = {
|
||||||
|
|
|
@ -18,9 +18,14 @@ class OauthApp(Base):
|
||||||
redirect_uri = Column(String)
|
redirect_uri = Column(String)
|
||||||
description = Column(String)
|
description = Column(String)
|
||||||
author_id = Column(Integer, ForeignKey("users.id"))
|
author_id = Column(Integer, ForeignKey("users.id"))
|
||||||
|
created_utc = Column(Integer)
|
||||||
|
|
||||||
author = relationship("User", back_populates="apps")
|
author = relationship("User", back_populates="apps")
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<OauthApp(id={self.id})>"
|
return f"<OauthApp(id={self.id})>"
|
||||||
|
|
||||||
|
@ -61,9 +66,14 @@ class ClientAuth(Base):
|
||||||
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||||
oauth_client = Column(Integer, ForeignKey("oauth_apps.id"), primary_key=True)
|
oauth_client = Column(Integer, ForeignKey("oauth_apps.id"), primary_key=True)
|
||||||
access_token = Column(String)
|
access_token = Column(String)
|
||||||
|
created_utc = Column(Integer)
|
||||||
|
|
||||||
user = relationship("User")
|
user = relationship("User")
|
||||||
application = relationship("OauthApp")
|
application = relationship("OauthApp")
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<ClientAuth(user_id={self.user_id}, oauth_client={self.oauth_client})>"
|
return f"<ClientAuth(user_id={self.user_id}, oauth_client={self.oauth_client})>"
|
|
@ -1,11 +1,17 @@
|
||||||
from sqlalchemy import *
|
from sqlalchemy import *
|
||||||
from files.__main__ import Base
|
from files.__main__ import Base
|
||||||
|
import time
|
||||||
|
|
||||||
class BannedDomain(Base):
|
class BannedDomain(Base):
|
||||||
|
|
||||||
__tablename__ = "banneddomains"
|
__tablename__ = "banneddomains"
|
||||||
domain = Column(String, primary_key=True)
|
domain = Column(String, primary_key=True)
|
||||||
reason = Column(String)
|
reason = Column(String)
|
||||||
|
created_utc = Column(Integer)
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<BannedDomain(domain={self.domain})>"
|
return f"<BannedDomain(domain={self.domain})>"
|
|
@ -1,6 +1,7 @@
|
||||||
from sqlalchemy import *
|
from sqlalchemy import *
|
||||||
from sqlalchemy.orm import relationship
|
from sqlalchemy.orm import relationship
|
||||||
from files.__main__ import Base
|
from files.__main__ import Base
|
||||||
|
import time
|
||||||
|
|
||||||
class Exile(Base):
|
class Exile(Base):
|
||||||
|
|
||||||
|
@ -8,8 +9,13 @@ class Exile(Base):
|
||||||
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||||
sub = Column(String, ForeignKey("subs.name"), primary_key=True)
|
sub = Column(String, ForeignKey("subs.name"), primary_key=True)
|
||||||
exiler_id = Column(Integer, ForeignKey("users.id"))
|
exiler_id = Column(Integer, ForeignKey("users.id"))
|
||||||
|
created_utc = Column(Integer)
|
||||||
|
|
||||||
exiler = relationship("User", primaryjoin="User.id==Exile.exiler_id")
|
exiler = relationship("User", primaryjoin="User.id==Exile.exiler_id")
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<Exile(user_id={self.user_id}, sub={self.sub})>"
|
return f"<Exile(user_id={self.user_id}, sub={self.sub})>"
|
|
@ -4,6 +4,7 @@ from files.__main__ import Base
|
||||||
from files.helpers.lazy import lazy
|
from files.helpers.lazy import lazy
|
||||||
from files.helpers.regex import censor_slurs
|
from files.helpers.regex import censor_slurs
|
||||||
from flask import g
|
from flask import g
|
||||||
|
import time
|
||||||
|
|
||||||
class HatDef(Base):
|
class HatDef(Base):
|
||||||
__tablename__ = "hat_defs"
|
__tablename__ = "hat_defs"
|
||||||
|
@ -14,10 +15,18 @@ class HatDef(Base):
|
||||||
author_id = Column(Integer, ForeignKey('users.id'))
|
author_id = Column(Integer, ForeignKey('users.id'))
|
||||||
price = Column(Integer)
|
price = Column(Integer)
|
||||||
submitter_id = Column(Integer, ForeignKey("users.id"))
|
submitter_id = Column(Integer, ForeignKey("users.id"))
|
||||||
|
created_utc = Column(Integer)
|
||||||
|
|
||||||
author = relationship("User", primaryjoin="HatDef.author_id == User.id", back_populates="designed_hats")
|
author = relationship("User", primaryjoin="HatDef.author_id == User.id", back_populates="designed_hats")
|
||||||
submitter = relationship("User", primaryjoin="HatDef.submitter_id == User.id")
|
submitter = relationship("User", primaryjoin="HatDef.submitter_id == User.id")
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return f"<HatDef(id={self.id})>"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def number_sold(self):
|
def number_sold(self):
|
||||||
|
@ -33,10 +42,18 @@ class Hat(Base):
|
||||||
user_id = Column(Integer, ForeignKey('users.id'), primary_key=True)
|
user_id = Column(Integer, ForeignKey('users.id'), primary_key=True)
|
||||||
hat_id = Column(Integer, ForeignKey('hat_defs.id'), primary_key=True)
|
hat_id = Column(Integer, ForeignKey('hat_defs.id'), primary_key=True)
|
||||||
equipped = Column(Boolean, default=False)
|
equipped = Column(Boolean, default=False)
|
||||||
|
created_utc = Column(Integer)
|
||||||
|
|
||||||
hat_def = relationship("HatDef")
|
hat_def = relationship("HatDef")
|
||||||
owners = relationship("User", back_populates="owned_hats")
|
owners = relationship("User", back_populates="owned_hats")
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return f"<Hat(user_id={self.user_id}, hat_id={self.hat_id})>"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def name(self):
|
def name(self):
|
||||||
|
|
|
@ -4,7 +4,6 @@ from files.__main__ import Base
|
||||||
from files.helpers.lazy import lazy
|
from files.helpers.lazy import lazy
|
||||||
from files.helpers.const import *
|
from files.helpers.const import *
|
||||||
|
|
||||||
|
|
||||||
class Lottery(Base):
|
class Lottery(Base):
|
||||||
__tablename__ = "lotteries"
|
__tablename__ = "lotteries"
|
||||||
|
|
||||||
|
@ -14,6 +13,11 @@ class Lottery(Base):
|
||||||
prize = Column(Integer, default=0)
|
prize = Column(Integer, default=0)
|
||||||
tickets_sold = Column(Integer, default=0)
|
tickets_sold = Column(Integer, default=0)
|
||||||
winner_id = Column(Integer, ForeignKey("users.id"))
|
winner_id = Column(Integer, ForeignKey("users.id"))
|
||||||
|
created_utc = Column(Integer)
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<Lottery(id={self.id})>"
|
return f"<Lottery(id={self.id})>"
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
from sqlalchemy import *
|
from sqlalchemy import *
|
||||||
from files.__main__ import Base
|
from files.__main__ import Base
|
||||||
|
import time
|
||||||
|
|
||||||
class Marsey(Base):
|
class Marsey(Base):
|
||||||
__tablename__ = "marseys"
|
__tablename__ = "marseys"
|
||||||
|
@ -9,6 +10,11 @@ class Marsey(Base):
|
||||||
tags = Column(String)
|
tags = Column(String)
|
||||||
count = Column(Integer, default=0)
|
count = Column(Integer, default=0)
|
||||||
submitter_id = Column(Integer, ForeignKey("users.id"))
|
submitter_id = Column(Integer, ForeignKey("users.id"))
|
||||||
|
created_utc = Column(Integer)
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<Marsey(name={self.name})>"
|
return f"<Marsey(name={self.name})>"
|
|
@ -12,10 +12,15 @@ class SubmissionOption(Base):
|
||||||
submission_id = Column(Integer, ForeignKey("submissions.id"))
|
submission_id = Column(Integer, ForeignKey("submissions.id"))
|
||||||
body_html = Column(Text)
|
body_html = Column(Text)
|
||||||
exclusive = Column(Integer)
|
exclusive = Column(Integer)
|
||||||
|
created_utc = Column(Integer)
|
||||||
|
|
||||||
votes = relationship("SubmissionOptionVote")
|
votes = relationship("SubmissionOptionVote")
|
||||||
post = relationship("Submission", back_populates="options")
|
post = relationship("Submission", back_populates="options")
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<SubmissionOption(id={self.id})>"
|
return f"<SubmissionOption(id={self.id})>"
|
||||||
|
|
||||||
|
@ -57,10 +62,15 @@ class CommentOption(Base):
|
||||||
comment_id = Column(Integer, ForeignKey("comments.id"))
|
comment_id = Column(Integer, ForeignKey("comments.id"))
|
||||||
body_html = Column(Text)
|
body_html = Column(Text)
|
||||||
exclusive = Column(Integer)
|
exclusive = Column(Integer)
|
||||||
|
created_utc = Column(Integer)
|
||||||
|
|
||||||
votes = relationship("CommentOptionVote")
|
votes = relationship("CommentOptionVote")
|
||||||
comment = relationship("Comment", back_populates="options")
|
comment = relationship("Comment", back_populates="options")
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<CommentOption(id={self.id})>"
|
return f"<CommentOption(id={self.id})>"
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from sqlalchemy import *
|
from sqlalchemy import *
|
||||||
from sqlalchemy.orm import relationship
|
from sqlalchemy.orm import relationship
|
||||||
from files.__main__ import Base
|
from files.__main__ import Base
|
||||||
|
import time
|
||||||
|
|
||||||
class SaveRelationship(Base):
|
class SaveRelationship(Base):
|
||||||
|
|
||||||
|
@ -9,9 +9,14 @@ class SaveRelationship(Base):
|
||||||
|
|
||||||
user_id=Column(Integer, ForeignKey("users.id"), primary_key=True)
|
user_id=Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||||
submission_id=Column(Integer, ForeignKey("submissions.id"), primary_key=True)
|
submission_id=Column(Integer, ForeignKey("submissions.id"), primary_key=True)
|
||||||
|
created_utc = Column(Integer)
|
||||||
|
|
||||||
post = relationship("Submission", uselist=False)
|
post = relationship("Submission", uselist=False)
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<SaveRelationship(user_id={self.user_id}, submission_id={self.submission_id})>"
|
return f"<SaveRelationship(user_id={self.user_id}, submission_id={self.submission_id})>"
|
||||||
|
|
||||||
|
@ -22,8 +27,13 @@ class CommentSaveRelationship(Base):
|
||||||
|
|
||||||
user_id=Column(Integer, ForeignKey("users.id"), primary_key=True)
|
user_id=Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||||
comment_id=Column(Integer, ForeignKey("comments.id"), primary_key=True)
|
comment_id=Column(Integer, ForeignKey("comments.id"), primary_key=True)
|
||||||
|
created_utc = Column(Integer)
|
||||||
|
|
||||||
comment = relationship("Comment", uselist=False)
|
comment = relationship("Comment", uselist=False)
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<CommentSaveRelationship(user_id={self.user_id}, comment_id={self.comment_id})>"
|
return f"<CommentSaveRelationship(user_id={self.user_id}, comment_id={self.comment_id})>"
|
|
@ -5,6 +5,7 @@ from files.helpers.lazy import lazy
|
||||||
from os import environ
|
from os import environ
|
||||||
from .sub_block import *
|
from .sub_block import *
|
||||||
from .sub_subscription import *
|
from .sub_subscription import *
|
||||||
|
import time
|
||||||
|
|
||||||
SITE_NAME = environ.get("SITE_NAME", '').strip()
|
SITE_NAME = environ.get("SITE_NAME", '').strip()
|
||||||
SITE = environ.get("DOMAIN", '').strip()
|
SITE = environ.get("DOMAIN", '').strip()
|
||||||
|
@ -21,10 +22,15 @@ class Sub(Base):
|
||||||
marseyurl = Column(String)
|
marseyurl = Column(String)
|
||||||
css = Column(String)
|
css = Column(String)
|
||||||
stealth = Column(Boolean)
|
stealth = Column(Boolean)
|
||||||
|
created_utc = Column(Integer)
|
||||||
|
|
||||||
blocks = relationship("SubBlock", primaryjoin="SubBlock.sub==Sub.name")
|
blocks = relationship("SubBlock", primaryjoin="SubBlock.sub==Sub.name")
|
||||||
followers = relationship("SubSubscription", primaryjoin="SubSubscription.sub==Sub.name")
|
followers = relationship("SubSubscription", primaryjoin="SubSubscription.sub==Sub.name")
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,16 @@
|
||||||
from sqlalchemy import *
|
from sqlalchemy import *
|
||||||
from files.__main__ import Base
|
from files.__main__ import Base
|
||||||
|
import time
|
||||||
|
|
||||||
class SubBlock(Base):
|
class SubBlock(Base):
|
||||||
__tablename__ = "sub_blocks"
|
__tablename__ = "sub_blocks"
|
||||||
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||||
sub = Column(String(20), ForeignKey("subs.name"), primary_key=True)
|
sub = Column(String(20), ForeignKey("subs.name"), primary_key=True)
|
||||||
|
created_utc = Column(Integer)
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<SubBlock(user_id={self.user_id}, sub={self.sub})>"
|
return f"<SubBlock(user_id={self.user_id}, sub={self.sub})>"
|
|
@ -1,10 +1,16 @@
|
||||||
from sqlalchemy import *
|
from sqlalchemy import *
|
||||||
from files.__main__ import Base
|
from files.__main__ import Base
|
||||||
|
import time
|
||||||
|
|
||||||
class SubJoin(Base):
|
class SubJoin(Base):
|
||||||
__tablename__ = "sub_joins"
|
__tablename__ = "sub_joins"
|
||||||
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||||
sub = Column(String(20), ForeignKey("subs.name"), primary_key=True)
|
sub = Column(String(20), ForeignKey("subs.name"), primary_key=True)
|
||||||
|
created_utc = Column(Integer)
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<SubJoin(user_id={self.user_id}, sub={self.sub})>"
|
return f"<SubJoin(user_id={self.user_id}, sub={self.sub})>"
|
|
@ -1,10 +1,16 @@
|
||||||
from sqlalchemy import *
|
from sqlalchemy import *
|
||||||
from files.__main__ import Base
|
from files.__main__ import Base
|
||||||
|
import time
|
||||||
|
|
||||||
class SubSubscription(Base):
|
class SubSubscription(Base):
|
||||||
__tablename__ = "sub_subscriptions"
|
__tablename__ = "sub_subscriptions"
|
||||||
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||||
sub = Column(String(20), ForeignKey("subs.name"), primary_key=True)
|
sub = Column(String(20), ForeignKey("subs.name"), primary_key=True)
|
||||||
|
created_utc = Column(Integer)
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<SubSubscription(user_id={self.user_id}, sub={self.sub})>"
|
return f"<SubSubscription(user_id={self.user_id}, sub={self.sub})>"
|
|
@ -1,16 +1,19 @@
|
||||||
from sqlalchemy import *
|
from sqlalchemy import *
|
||||||
from sqlalchemy.orm import relationship
|
from sqlalchemy.orm import relationship
|
||||||
from files.__main__ import Base
|
from files.__main__ import Base
|
||||||
|
import time
|
||||||
|
|
||||||
class Subscription(Base):
|
class Subscription(Base):
|
||||||
__tablename__ = "subscriptions"
|
__tablename__ = "subscriptions"
|
||||||
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||||
submission_id = Column(Integer, ForeignKey("submissions.id"), primary_key=True)
|
submission_id = Column(Integer, ForeignKey("submissions.id"), primary_key=True)
|
||||||
|
created_utc = Column(Integer)
|
||||||
|
|
||||||
user = relationship("User", uselist=False)
|
user = relationship("User", uselist=False)
|
||||||
post = relationship("Submission", uselist=False)
|
post = relationship("Submission", uselist=False)
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
|
|
@ -475,9 +475,6 @@ class User(Base):
|
||||||
def url(self):
|
def url(self):
|
||||||
return f"/@{self.username}"
|
return f"/@{self.username}"
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
return f"<User(id={self.id})>"
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def unban_string(self):
|
def unban_string(self):
|
||||||
|
|
|
@ -1,15 +1,21 @@
|
||||||
from sqlalchemy import *
|
from sqlalchemy import *
|
||||||
from sqlalchemy.orm import relationship
|
from sqlalchemy.orm import relationship
|
||||||
from files.__main__ import Base
|
from files.__main__ import Base
|
||||||
|
import time
|
||||||
|
|
||||||
class UserBlock(Base):
|
class UserBlock(Base):
|
||||||
|
|
||||||
__tablename__ = "userblocks"
|
__tablename__ = "userblocks"
|
||||||
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
user_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||||
target_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
target_id = Column(Integer, ForeignKey("users.id"), primary_key=True)
|
||||||
|
created_utc = Column(Integer)
|
||||||
|
|
||||||
user = relationship("User", primaryjoin="User.id==UserBlock.user_id", back_populates="blocking")
|
user = relationship("User", primaryjoin="User.id==UserBlock.user_id", back_populates="blocking")
|
||||||
target = relationship("User", primaryjoin="User.id==UserBlock.target_id", back_populates="blocked")
|
target = relationship("User", primaryjoin="User.id==UserBlock.target_id", back_populates="blocked")
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<UserBlock(user={self.user_id}, target={self.target_id})>"
|
return f"<UserBlock(user={self.user_id}, target={self.target_id})>"
|
|
@ -11,14 +11,13 @@ class ViewerRelationship(Base):
|
||||||
user_id = Column(Integer, ForeignKey('users.id'), primary_key=True)
|
user_id = Column(Integer, ForeignKey('users.id'), primary_key=True)
|
||||||
viewer_id = Column(Integer, ForeignKey('users.id'), primary_key=True)
|
viewer_id = Column(Integer, ForeignKey('users.id'), primary_key=True)
|
||||||
last_view_utc = Column(Integer)
|
last_view_utc = Column(Integer)
|
||||||
|
created_utc = Column(Integer)
|
||||||
|
|
||||||
viewer = relationship("User", primaryjoin="ViewerRelationship.viewer_id == User.id")
|
viewer = relationship("User", primaryjoin="ViewerRelationship.viewer_id == User.id")
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
|
if "created_utc" not in kwargs: kwargs["created_utc"] = int(time.time())
|
||||||
if 'last_view_utc' not in kwargs:
|
if 'last_view_utc' not in kwargs: kwargs['last_view_utc'] = int(time.time())
|
||||||
kwargs['last_view_utc'] = int(time.time())
|
|
||||||
|
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
alter table alts add column created_utc int;
|
||||||
|
alter table award_relationships add column created_utc int;
|
||||||
|
alter table badge_defs add column created_utc int;
|
||||||
|
alter table category add column created_utc int;
|
||||||
|
alter table oauth_apps add column created_utc int;
|
||||||
|
alter table client_auths add column created_utc int;
|
||||||
|
alter table banneddomains add column created_utc int;
|
||||||
|
alter table exiles add column created_utc int;
|
||||||
|
alter table hat_defs add column created_utc int;
|
||||||
|
alter table hats add column created_utc int;
|
||||||
|
alter table lotteries add column created_utc int;
|
||||||
|
alter table marseys add column created_utc int;
|
||||||
|
alter table submission_options add column created_utc int;
|
||||||
|
alter table comment_options add column created_utc int;
|
||||||
|
alter table save_relationship add column created_utc int;
|
||||||
|
alter table comment_save_relationship add column created_utc int;
|
||||||
|
alter table sub_blocks add column created_utc int;
|
||||||
|
alter table sub_joins add column created_utc int;
|
||||||
|
alter table sub_subscriptions add column created_utc int;
|
||||||
|
alter table subs add column created_utc int;
|
||||||
|
alter table subscriptions add column created_utc int;
|
||||||
|
alter table userblocks add column created_utc int;
|
||||||
|
alter table viewers add column created_utc int;
|
Loading…
Reference in New Issue