2022-02-19 05:05:41 +00:00
#!/bin/sh
2021-03-18 16:19:08 +00:00
set -e
psql -v ON_ERROR_STOP = 1 --username " $POSTGRES_USER " --dbname " $POSTGRES_DB " <<-EOSQL
2022-10-10 21:13:51 +00:00
CREATE TABLE guilds ( guild_id VARCHAR( 30) NOT NULL PRIMARY KEY, prefix VARCHAR( 15) NOT NULL, disabled text ARRAY NOT NULL, disabled_commands text ARRAY NOT NULL ) ;
2021-08-11 01:25:29 +00:00
CREATE TABLE counts ( command VARCHAR NOT NULL PRIMARY KEY, count integer NOT NULL ) ;
CREATE TABLE tags ( guild_id VARCHAR( 30) NOT NULL, name text NOT NULL, content text NOT NULL, author VARCHAR( 30) NOT NULL, UNIQUE( guild_id, name) ) ;
2022-02-19 05:05:41 +00:00
2022-10-25 17:37:55 +00:00
CREATE TABLE settings ( id smallint PRIMARY KEY, version integer NOT NULL, broadcast VARCHAR, CHECK( id = 1) ) ;
2022-10-10 21:13:51 +00:00
INSERT INTO settings ( id, version) VALUES ( 1, 2) ON CONFLICT ( id) DO NOTHING;
2022-02-19 05:05:41 +00:00
EOSQL