locationbot.sql 908 B

1234567891011121314151617181920212223242526272829303132333435
  1. -- Location Bot
  2. --
  3. -- Douglas Thrift
  4. --
  5. -- $Id$
  6. create schema locationbot;
  7. create type locationbot.granularity as enum ('city', 'best');
  8. create table locationbot.nick (
  9. id serial primary key,
  10. nick text not null unique,
  11. secret char(32) not null,
  12. masks text[],
  13. channels text[],
  14. timezone text,
  15. granularity locationbot.granularity,
  16. location text,
  17. coordinates point,
  18. updated timestamp with time zone
  19. );
  20. create table locationbot.latitude (
  21. id integer primary key references locationbot.nick on delete cascade,
  22. granularity locationbot.granularity not null,
  23. token text not null,
  24. secret text not null,
  25. authorized boolean not null
  26. );
  27. create index nick_location_index on locationbot.nick (location);
  28. create index nick_updated_index on locationbot.nick (updated);
  29. create index nick_latitude_index on locationbot.nick (latitude);
  30. create index latitude_authorized on locationbot.latitude (authorized);