﻿CREATE TABLE public.users
(
   id serial PRIMARY KEY, 
   name character varying(31) NOT NULL, 
   network character varying(40) NOT NULL references networks(name), 
   messages bigint, 
   actions bigint, 
   notices bigint, 
   last_act_type character varying(20), 
   last_act_datetime timestamp without time zone, 
   last_act_channel character varying(64), 
   last_act_channel_network character varying(40), 
   last_act character varying(510),
   FOREIGN KEY (last_act_channel, last_act_channel_network) REFERENCES channels(name, network),
   UNIQUE (name, network)
) 
;
ALTER TABLE public.users
  OWNER TO "pyRot";
