2021-02-26 01:28:54 -05:00
|
|
|
# mautrix-line - A very hacky Matrix-LINE bridge based on running LINE's Chrome extension in Puppeteer
|
|
|
|
# Copyright (C) 2020-2021 Tulir Asokan, Andrew Ferrazzutti
|
2020-08-28 09:38:06 -04:00
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Affero General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU Affero General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
from asyncpg import Connection
|
|
|
|
|
|
|
|
from mautrix.util.async_db import UpgradeTable
|
|
|
|
|
|
|
|
upgrade_table = UpgradeTable()
|
|
|
|
|
|
|
|
|
|
|
|
@upgrade_table.register(description="Initial revision")
|
|
|
|
async def upgrade_v1(conn: Connection) -> None:
|
|
|
|
await conn.execute("""CREATE TABLE portal (
|
2021-02-16 02:49:54 -05:00
|
|
|
chat_id TEXT PRIMARY KEY,
|
2020-08-28 09:38:06 -04:00
|
|
|
other_user TEXT,
|
|
|
|
mxid TEXT,
|
|
|
|
name TEXT,
|
|
|
|
encrypted BOOLEAN NOT NULL DEFAULT false
|
|
|
|
)""")
|
|
|
|
await conn.execute("""CREATE TABLE "user" (
|
|
|
|
mxid TEXT PRIMARY KEY,
|
|
|
|
notice_room TEXT
|
|
|
|
)""")
|
|
|
|
await conn.execute("""CREATE TABLE puppet (
|
|
|
|
mid TEXT PRIMARY KEY,
|
|
|
|
name TEXT,
|
|
|
|
is_registered BOOLEAN NOT NULL DEFAULT false
|
|
|
|
)""")
|
|
|
|
await conn.execute("""CREATE TABLE message (
|
|
|
|
mxid TEXT NOT NULL,
|
|
|
|
mx_room TEXT NOT NULL,
|
|
|
|
mid INTEGER PRIMARY KEY,
|
2021-02-16 02:49:54 -05:00
|
|
|
chat_id TEXT NOT NULL,
|
2020-08-28 09:38:06 -04:00
|
|
|
|
|
|
|
UNIQUE (mxid, mx_room)
|
|
|
|
)""")
|