-
-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Warning: may break everything and/or edit your cat
- Loading branch information
Showing
16 changed files
with
228 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
alembic/versions/9e9c89b0b877_add_edit_index_to_messages.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
"""Add edit index to messages | ||
Revision ID: 9e9c89b0b877 | ||
Revises: 17574c57f3f8 | ||
Create Date: 2019-05-29 15:28:23.128377 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = '9e9c89b0b877' | ||
down_revision = '17574c57f3f8' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
op.create_table('_message_temp', | ||
sa.Column('mxid', sa.String), | ||
sa.Column('mx_room', sa.String), | ||
sa.Column('tgid', sa.Integer), | ||
sa.Column('tg_space', sa.Integer), | ||
sa.Column('edit_index', sa.Integer), | ||
sa.PrimaryKeyConstraint('tgid', 'tg_space', 'edit_index'), | ||
sa.UniqueConstraint("mxid", "mx_room", "tg_space", name="_mx_id_room")) | ||
c = op.get_bind() | ||
c.execute("INSERT INTO _message_temp (mxid, mx_room, tgid, tg_space, edit_index) " | ||
"SELECT message.mxid, message.mx_room, message.tgid, message.tg_space, 0 " | ||
"FROM message") | ||
c.execute("DROP TABLE message") | ||
c.execute("ALTER TABLE _message_temp RENAME TO message") | ||
|
||
|
||
|
||
def downgrade(): | ||
op.create_table('_message_temp', | ||
sa.Column('mxid', sa.String), | ||
sa.Column('mx_room', sa.String), | ||
sa.Column('tgid', sa.Integer), | ||
sa.Column('tg_space', sa.Integer), | ||
sa.PrimaryKeyConstraint('tgid', 'tg_space'), | ||
sa.UniqueConstraint("mxid", "mx_room", "tg_space", name="_mx_id_room")) | ||
c = op.get_bind() | ||
c.execute("INSERT INTO _message_temp (mxid, mx_room, tgid, tg_space) " | ||
"SELECT message.mxid, message.mx_room, message.tgid, message.tg_space " | ||
"FROM portal") | ||
c.execute("DROP TABLE message") | ||
c.execute("ALTER TABLE _message_temp RENAME TO message") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
from .from_matrix import (matrix_reply_to_telegram, matrix_to_telegram, matrix_text_to_telegram, | ||
init_mx) | ||
from .from_telegram import (telegram_reply_to_matrix, telegram_to_matrix, init_tg) | ||
from .from_telegram import telegram_reply_to_matrix, telegram_to_matrix | ||
from .. import context as c | ||
|
||
|
||
def init(context: c.Context) -> None: | ||
init_mx(context) | ||
init_tg(context) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.