changeset 15:8ca52684ea6d

Add some indices and defaults to the SQL schema
author Lewin Bormann <lbo@spheniscida.de>
date Fri, 09 Dec 2016 21:56:58 +0100
parents 7c17fbb05306
children 755cd3259e29
files schema.sql
diffstat 1 files changed, 36 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/schema.sql	Fri Dec 09 21:49:06 2016 +0100
+++ b/schema.sql	Fri Dec 09 21:56:58 2016 +0100
@@ -15,6 +15,10 @@
 
 SET search_path = public, pg_catalog;
 
+DROP INDEX public.todo_done_chat_id_list_idx;
+DROP INDEX public.quotes_quoted_idx;
+DROP INDEX public.quotes_chat_id_idx;
+DROP INDEX public.fortunes_used_idx;
 ALTER TABLE ONLY public.todo DROP CONSTRAINT todo_pkey;
 ALTER TABLE ONLY public.reminders DROP CONSTRAINT reminders_pkey;
 ALTER TABLE ONLY public.quotes DROP CONSTRAINT quotes_pkey;
@@ -113,7 +117,7 @@
     ts timestamp without time zone,
     quote text,
     owner text,
-    quoted integer,
+    quoted integer DEFAULT 0,
     chat_id integer
 );
 
@@ -187,8 +191,9 @@
     ts timestamp without time zone,
     text text,
     owner text,
-    done boolean,
-    chat_id integer
+    done boolean DEFAULT false,
+    chat_id integer,
+    list text DEFAULT ''::text
 );
 
 
@@ -276,6 +281,34 @@
 
 
 --
+-- Name: fortunes_used_idx; Type: INDEX; Schema: public; Owner: goe_bot
+--
+
+CREATE INDEX fortunes_used_idx ON fortunes USING btree (used);
+
+
+--
+-- Name: quotes_chat_id_idx; Type: INDEX; Schema: public; Owner: goe_bot
+--
+
+CREATE INDEX quotes_chat_id_idx ON quotes USING btree (chat_id);
+
+
+--
+-- Name: quotes_quoted_idx; Type: INDEX; Schema: public; Owner: goe_bot
+--
+
+CREATE INDEX quotes_quoted_idx ON quotes USING btree (quoted);
+
+
+--
+-- Name: todo_done_chat_id_list_idx; Type: INDEX; Schema: public; Owner: goe_bot
+--
+
+CREATE INDEX todo_done_chat_id_list_idx ON todo USING btree (done, chat_id, list);
+
+
+--
 -- Name: public; Type: ACL; Schema: -; Owner: postgres
 --