lcr-create.sql 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. INSERT INTO version (table_name, table_version) values ('lcr_gw','1');
  2. CREATE TABLE lcr_gw (
  3. id SERIAL PRIMARY KEY NOT NULL,
  4. lcr_id SMALLINT NOT NULL,
  5. gw_name VARCHAR(128),
  6. ip_addr VARCHAR(15),
  7. hostname VARCHAR(64),
  8. port SMALLINT,
  9. params VARCHAR(64),
  10. uri_scheme SMALLINT,
  11. transport SMALLINT,
  12. strip SMALLINT,
  13. tag VARCHAR(16) DEFAULT NULL,
  14. flags INTEGER DEFAULT 0 NOT NULL,
  15. defunct INTEGER DEFAULT NULL,
  16. CONSTRAINT lcr_gw_lcr_id_ip_addr_port_hostname_idx UNIQUE (lcr_id, ip_addr, port, hostname)
  17. );
  18. INSERT INTO version (table_name, table_version) values ('lcr_rule_target','1');
  19. CREATE TABLE lcr_rule_target (
  20. id SERIAL PRIMARY KEY NOT NULL,
  21. lcr_id SMALLINT NOT NULL,
  22. rule_id INTEGER NOT NULL,
  23. gw_id INTEGER NOT NULL,
  24. priority SMALLINT NOT NULL,
  25. weight INTEGER DEFAULT 1 NOT NULL,
  26. CONSTRAINT lcr_rule_target_rule_id_gw_id_idx UNIQUE (rule_id, gw_id)
  27. );
  28. CREATE INDEX lcr_rule_target_lcr_id_idx ON lcr_rule_target (lcr_id);
  29. INSERT INTO version (table_name, table_version) values ('lcr_rule','1');
  30. CREATE TABLE lcr_rule (
  31. id SERIAL PRIMARY KEY NOT NULL,
  32. lcr_id SMALLINT NOT NULL,
  33. prefix VARCHAR(16) DEFAULT NULL,
  34. from_uri VARCHAR(64) DEFAULT NULL,
  35. stopper INTEGER DEFAULT 0 NOT NULL,
  36. enabled INTEGER DEFAULT 1 NOT NULL,
  37. CONSTRAINT lcr_rule_lcr_id_prefix_from_uri_idx UNIQUE (lcr_id, prefix, from_uri)
  38. );