schema.sql: fix syntax

This commit is contained in:
Luna Mendes 2018-07-06 02:29:17 -03:00
parent 0ca45c781e
commit 545d261bdd
3 changed files with 17 additions and 8 deletions

View File

@ -17,6 +17,12 @@ We use [pipenv] to manage our dependencies.
$ git clone https://gitlab.com/lnmds/litecord $ git clone https://gitlab.com/lnmds/litecord
$ cd litecord $ cd litecord
# create users as you want, etc
$ psql -U some_user -f schema.sql database
# edit config.py as you please
$ cp config.example.py config.py
# install all packages, including dev-packages # install all packages, including dev-packages
$ pipenv install --dev $ pipenv install --dev
``` ```
@ -28,5 +34,5 @@ $ pipenv install --dev
$ pipenv shell $ pipenv shell
# boot litecord # boot litecord
$ hypercorn run:app $ hypercorn -b 0.0.0.0:5000 run:app
``` ```

View File

@ -164,7 +164,7 @@ async def delete_message(channel_id, message_id):
""", message_id) """, message_id)
# TODO: MANAGE_MESSAGES permission check # TODO: MANAGE_MESSAGES permission check
if not author_id == user_id: if author_id != user_id:
raise Forbidden('You can not delete this message') raise Forbidden('You can not delete this message')
await app.db.execute(""" await app.db.execute("""

View File

@ -155,18 +155,20 @@ CREATE TABLE IF NOT EXISTS guild_channels (
CREATE TABLE IF NOT EXISTS guild_text_channels ( CREATE TABLE IF NOT EXISTS guild_text_channels (
id bigint REFERENCES guild_channels (id) PRIMARY KEY ON DELETE CASCADE, id bigint REFERENCES guild_channels (id) ON DELETE CASCADE,
topic text DEFAULT '' topic text DEFAULT '',
PRIMARY KEY (id)
); );
CREATE TABLE IF NOT EXISTS guild_voice_channels ( CREATE TABLE IF NOT EXISTS guild_voice_channels (
id bigint REFERENCES guild_channels (id) PRIMARY KEY ON DELETE CASCADE, id bigint REFERENCES guild_channels (id) ON DELETE CASCADE,
-- default bitrate for discord is 64kbps -- default bitrate for discord is 64kbps
bitrate int DEFAULT 64, bitrate int DEFAULT 64,
-- 0 means infinite -- 0 means infinite
user_limit int DEFAULT 0 user_limit int DEFAULT 0,
PRIMARY KEY (id)
); );
@ -176,9 +178,10 @@ CREATE TABLE IF NOT EXISTS dm_channels (
CREATE TABLE IF NOT EXISTS group_dm_channels ( CREATE TABLE IF NOT EXISTS group_dm_channels (
id bigint REFERENCES channels (id) PRIMARY KEY ON DELETE CASCADE, id bigint REFERENCES channels (id) ON DELETE CASCADE,
owner_id bigint REFERENCES users (id), owner_id bigint REFERENCES users (id),
icon bigint REFERENCES files (id) icon bigint REFERENCES files (id),
PRIMARY KEY (id)
); );