﻿-- Table: public.channels

-- DROP TABLE public.channels;

CREATE TABLE public.joins
(
  id serial PRIMARY KEY,
  channel character varying(64) NOT NULL,
  channel_network character varying(40) NOT NULL,
  "user" character varying(31) NOT NULL,
  user_network character varying(40) NOT NULL, 
  FOREIGN KEY (channel, channel_network) REFERENCES channels(name, network),
  FOREIGN KEY ("user", user_network) REFERENCES users(name, network),
  UNIQUE (channel, channel_network, "user", user_network)
);
ALTER TABLE public.channels
  OWNER TO "pyRot";
