0001_init.up.sql 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. -- inits controller db schema
  2. CREATE TABLE IF NOT EXISTS controllers_ctl (
  3. id text NOT NULL PRIMARY KEY,
  4. hostname text,
  5. last_heartbeat timestamp with time zone,
  6. public_identity text NOT NULL,
  7. version text
  8. );
  9. CREATE TABLE IF NOT EXISTS networks_ctl (
  10. id character varying(22) NOT NULL PRIMARY KEY,
  11. name text NOT NULL,
  12. configuration jsonb DEFAULT '{}'::jsonb NOT NULL,
  13. controller_id text REFERENCES controllers_ctl(id),
  14. revision integer DEFAULT 0 NOT NULL,
  15. last_modified timestamp with time zone DEFAULT now(),
  16. creation_time timestamp with time zone DEFAULT now()
  17. );
  18. CREATE TABLE IF NOT EXISTS network_memberships_ctl (
  19. device_id character varying(22) NOT NULL,
  20. network_id character varying(22) NOT NULL REFERENCES networks_ctl(id),
  21. authorized boolean,
  22. active_bridge boolean,
  23. ip_assignments text[],
  24. no_auto_assign_ips boolean,
  25. sso_exempt boolean,
  26. authentication_expiry_time timestamp with time zone,
  27. capabilities jsonb,
  28. creation_time timestamp with time zone DEFAULT now(),
  29. last_modified timestamp with time zone DEFAULT now(),
  30. identity text DEFAULT ''::text,
  31. last_authorized_credential text,
  32. last_authorized_time timestamp with time zone,
  33. last_deauthorized_time timestamp with time zone,
  34. last_seen jsonb DEFAULT '{}'::jsonb NOT NULL, -- in the context of the network
  35. remote_trace_level integer DEFAULT 0 NOT NULL,
  36. remote_trace_target text DEFAULT ''::text NOT NULL,
  37. revision integer DEFAULT 0 NOT NULL,
  38. tags jsonb,
  39. version_major integer DEFAULT 0 NOT NULL,
  40. version_minor integer DEFAULT 0 NOT NULL,
  41. version_revision integer DEFAULT 0 NOT NULL,
  42. version_protocol integer DEFAULT 0 NOT NULL,
  43. PRIMARY KEY (device_id, network_id)
  44. );