예제 #1
0
파일: todo.py 프로젝트: BeatButton/Akane
class TodoTable(db.Table, table_name="todos"):
    id = db.PrimaryKeyColumn()

    owner_id = db.Column(db.Integer(big=True))
    content = db.Column(db.String)
    added_at = db.Column(db.Datetime)
    jump_url = db.Column(db.String)
예제 #2
0
class Reminders(db.Table):
    id = db.PrimaryKeyColumn()

    expires = db.Column(db.Datetime, index=True)
    created = db.Column(db.Datetime, default="now() at time zone 'utc'")
    event = db.Column(db.String)
    extra = db.Column(db.JSON, default="'{}'::jsonb")
예제 #3
0
파일: config.py 프로젝트: BeatButton/Akane
class Plonks(db.Table):
    """ Create db table for plonks. """

    id = db.PrimaryKeyColumn()
    guild_id = db.Column(db.Integer(big=True), index=True)

    # this can either be a channel_id or an author_id
    entity_id = db.Column(db.Integer(big=True), index=True, unique=True)
예제 #4
0
파일: twitch.py 프로젝트: BeatButton/Akane
class TwitchSecretTable(db.Table):
    """ Creates the database for storing the OAuth secret. """

    id = db.PrimaryKeyColumn()

    secret = db.Column(db.String)
    edited_at = db.Column(db.Datetime)
    expires_at = db.Column(db.Datetime)
예제 #5
0
파일: todo.py 프로젝트: AbstractUmbra/Bot
class TodoTable(db.Table, table_name="todos"):
    id = db.PrimaryKeyColumn()

    owner_id = db.Column(db.Integer(big=True))
    content = db.Column(db.String)
    added_at = db.Column(db.Datetime(timezone=True),
                         default="now() at time zone 'utc'")
    jump_url = db.Column(db.String)
예제 #6
0
파일: twitch.py 프로젝트: BeatButton/Akane
class TwitchClipTable(db.Table):
    """ Creates the Clip table for storing clip following data. """

    id = db.PrimaryKeyColumn()

    guild_id = db.Column(db.Integer(big=True))
    channel_id = db.Column(db.Integer(big=True))
    broadcaster_id = db.Column(db.String())
    last_25_clips = db.Column(db.Array(db.String()))
예제 #7
0
파일: fun.py 프로젝트: BeatButton/Akane
class StatisticsTable(db.Table, table_name="statistics"):
    id = db.PrimaryKeyColumn()
    message_deletes = db.Column(db.Integer(big=True))
    bulk_message_deletes = db.Column(db.Integer(big=True))
    message_edits = db.Column(db.Integer(big=True))
    bans = db.Column(db.Integer(big=True))
    unbans = db.Column(db.Integer(big=True))
    channel_deletes = db.Column(db.Integer(big=True))
    channel_creates = db.Column(db.Integer(big=True))
    command_count = db.Column(db.Integer(big=True))
예제 #8
0
파일: snipe.py 프로젝트: BeatButton/Akane
class SnipeDeleteTable(db.Table, table_name="snipe_deletes"):
    id = db.PrimaryKeyColumn()

    user_id = db.Column(db.Integer(big=True))
    guild_id = db.Column(db.Integer(big=True))
    channel_id = db.Column(db.Integer(big=True))
    message_id = db.Column(db.Integer(big=True))
    message_content = db.Column(db.String())
    attachment_urls = db.Column(db.Array(db.String()), nullable=True)
    delete_time = db.Column(db.Integer(big=True))
예제 #9
0
파일: twitch.py 프로젝트: BeatButton/Akane
class TwitchTable(db.Table):
    """ Create the twitch database table. """

    id = db.PrimaryKeyColumn()

    guild_id = db.Column(db.Integer(big=True))
    channel_id = db.Column(db.Integer(big=True))
    streamer_name = db.Column(db.String)
    streamer_last_game = db.Column(db.String())
    streamer_last_datetime = db.Column(db.Datetime())
예제 #10
0
class Commands(db.Table):
    id = db.PrimaryKeyColumn()

    guild_id = db.Column(db.Integer(big=True), index=True)
    channel_id = db.Column(db.Integer(big=True))
    author_id = db.Column(db.Integer(big=True), index=True)
    used = db.Column(db.Datetime, index=True)
    prefix = db.Column(db.String)
    command = db.Column(db.String, index=True)
    failed = db.Column(db.Boolean, index=True)
예제 #11
0
파일: snipe.py 프로젝트: BeatButton/Akane
class SnipeEditTable(db.Table, table_name="snipe_edits"):
    id = db.PrimaryKeyColumn()

    user_id = db.Column(db.Integer(big=True))
    guild_id = db.Column(db.Integer(big=True))
    channel_id = db.Column(db.Integer(big=True))
    message_id = db.Column(db.Integer(big=True))
    before_content = db.Column(db.String())
    after_content = db.Column(db.String())
    edited_time = db.Column(db.Integer(big=True))
    jump_url = db.Column(db.String)
예제 #12
0
파일: config.py 프로젝트: BeatButton/Akane
class CommandConfig(db.Table, table_name="command_config"):
    """ Create db table for command config. """

    id = db.PrimaryKeyColumn()

    guild_id = db.Column(db.Integer(big=True), index=True)
    channel_id = db.Column(db.Integer(big=True))

    name = db.Column(db.String)
    whitelist = db.Column(db.Boolean)

    @classmethod
    def create_table(cls, *, exists_ok=True):
        statement = super().create_table(exists_ok=exists_ok)
        # create the unique index
        sql = "CREATE UNIQUE INDEX IF NOT EXISTS command_config_uniq_idx ON command_config (channel_id, name, whitelist);"
        return statement + "\n" + sql
예제 #13
0
파일: tags.py 프로젝트: BeatButton/Akane
class TagLookup(db.Table, table_name="tag_lookup"):
    id = db.PrimaryKeyColumn()

    # we will create more indexes manually
    name = db.Column(db.String, index=True)
    location_id = db.Column(db.Integer(big=True), index=True)

    owner_id = db.Column(db.Integer(big=True))
    created_at = db.Column(db.Datetime, default="now() at time zone 'utc'")
    tag_id = db.Column(db.ForeignKey("tags", "id"))

    @classmethod
    def create_table(cls, *, exists_ok=True):
        statement = super().create_table(exists_ok=exists_ok)

        # create the indexes
        sql = (
            "CREATE INDEX IF NOT EXISTS tag_lookup_name_trgm_idx ON tag_lookup USING GIN (name gin_trgm_ops);\n"
            "CREATE INDEX IF NOT EXISTS tag_lookup_name_lower_idx ON tag_lookup (LOWER(name));\n"
            "CREATE UNIQUE INDEX IF NOT EXISTS tag_lookup_uniq_idx ON tag_lookup (LOWER(name), location_id);"
        )

        return statement + "\n" + sql
예제 #14
0
class Feeds(db.Table):
    id = db.PrimaryKeyColumn()
    channel_id = db.Column(db.Integer(big=True))
    role_id = db.Column(db.Integer(big=True))
    name = db.Column(db.String)