So far this is what I have.. (see below).
How can I have recurring bookings for a call?
Eg: if the call_frequency is weekly, how can I see a list of dates which this account will be called upon?
Kind regards
Kevin
CREATE TABLE call_frequency (
id SERIAL PRIMARY KEY NOT NULL,
name varchar(25) NOT NULL,
description VARCHAR(200) NOT NULL
);
COMMENT ON TABLE call_frequency IS 'How often a call is scheduled';
INSERT INTO call_frequency( name, description ) VALUES ('Once Only', 'Single non-recurring call' );
INSERT INTO call_frequency( name, description ) VALUES ('Hourly', 'Every hour' );
INSERT INTO call_frequency( name, description ) VALUES ('Daily', 'Every day' );
INSERT INTO call_frequency( name, description ) VALUES ('Weekly', 'Every week' );
INSERT INTO call_frequency( name, description ) VALUES ('Bi-Weekly', 'Every second week' );
INSERT INTO call_frequency( name, description ) VALUES ('Monthly', 'Every Month' );
INSERT INTO call_frequency( name, description ) VALUES ('Yearly', 'Every Year' );
CREATE TABLE callcard (
id SERIAL PRIMARY KEY NOT NULL,
account_id INT NOT NULL REFERENCES accounts(id),
user_id INT NOT NULL REFERENCES users(id),
call_type_id INT NOT NULL REFERENCES call_types(id),
call_frequency_id INT NOT NULL REFERENCES call_frequency(id),
duration TSRANGE NOT NULL
);
COMMENT ON TABLE callcard IS 'Table of scheduled calls';