BEGIN;

CREATE TABLE phoneringtone (
 id serial,

 created timestamp with time zone not null default CURRENT_TIMESTAMP,
--HELP_EN_INFO:Creation Date
--HELP_EN_LONG:The date and time this record was created.
--HELP_NL_INFO:Datum aanmaak
--HELP_NL_LONG:De tijd en datum waarop dit is aangemaakt.

 lastupdate timestamp with time zone not null default CURRENT_TIMESTAMP,
--HELP_EN_INFO:Last Update
--HELP_EN_LONG:The date and time this record was updated.
--HELP_NL_INFO:Laatste wijziging
--HELP_NL_LONG:De tijd en datum van laatste wijziging.

 phone integer NOT NULL default '1',
--GENERATE:phoneconfig:NEW.phone:
--HELP_EN_INFO:phone
--HELP_EN_LONG:The phone for which this button is defined.
--HELP_NL_INFO:telefoon
--HELP_NL_LONG:De telefoon waarvoor deze toets is gedefinieerd.

 contacttype integer NOT NULL default '1',
--HELP_EN_INFO:contact type
--HELP_EN_LONG:The contact type for which this ringtone is valid.
--HELP_NL_INFO:contact type
--HELP_NL_LONG:Het type contact voor deze beltoon.

 ringtone integer NOT NULL default '1',
--HELP_EN_INFO:ringtone
--HELP_EN_LONG:The ringtone to play with this contact type.
--HELP_NL_INFO:beltoon
--HELP_NL_LONG:De beltoon die bij dit type contact afgespeeld moet worden.

 PRIMARY KEY  (id)
);

create unique index phoneringtone_phone_contacttype_index on phoneringtone(phone, contacttype);

GRANT UPDATE, SELECT, INSERT, DELETE ON phoneringtone TO astium;
GRANT UPDATE, SELECT, INSERT, DELETE ON phoneringtone_id_seq TO astium;

COMMIT;
