diff options
Diffstat (limited to 'db/0-create.psql')
| -rw-r--r-- | db/0-create.psql | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/db/0-create.psql b/db/0-create.psql index a90d23e..3cb7236 100644 --- a/db/0-create.psql +++ b/db/0-create.psql @@ -76,14 +76,15 @@ INSERT INTO rooms (key, name, description, admin_only) VALUES ('VIP', 'The VIP Room', 'Command Post', true); CREATE TABLE feed_images ( - external_url text NOT NULL, - local_url text NOT NULL, feed_url text NOT NULL, + image_url text NOT NULL, + room_id integer REFERENCES rooms, + message_id integer REFERENCES messages, added_on timestamp NOT NULL DEFAULT now(), - room_id integer REFERENCES rooms + UNIQUE (room_id, image_url) ); -CREATE INDEX feed_images_external_url_idx ON feed_images (external_url); -CREATE INDEX feed_images_image_posted_idx ON feed_images (external_url, room_id); +CREATE INDEX feed_images_url_idx ON feed_images (image_url); +CREATE INDEX feed_images_url_room_idx ON feed_images (image_url, room_id); |
