CREATE TABLE zoom_users (
	uid		serial		PRIMARY KEY,
	user_id		varchar(255)	UNIQUE NOT NULL,	-- Zoom's
	email		varchar(255)	NOT NULL,
	full_name	varchar(255)	NOT NULL
);

CREATE TABLE zoom_meetings (
	mid		serial		PRIMARY KEY,
	meeting_id	int		UNIQUE NOT NULL,	-- Zoom's meeting ID
	uuid		varchar(255)	NOT NULL,		-- Zoom's meeting instance ID
	host_uid	int		NOT NULL REFERENCES zoom_users(uid),
	topic		varchar(255)	DEFAULT '',
	type		int		NOT NULL		-- 1=instant, 2=scheduled, 3=recurring no time, 8=recurring fixed time
);

CREATE TABLE zoom_schedule (
	id		serial		PRIMARY KEY,
	mid		int		NOT NULL REFERENCES zoom_meetings(mid),
	occurrence_id	bigint		DEFAULT 0,		-- Occurrence for recurring meetings, 0 otherwise
	start_time	timestamp	NOT NULL,
	duration	int		NOT NULL,		-- minutes
	UNIQUE(mid, occurrence_id)
);