drop table if exists member_languagepairs;
create table member_languagepairs(
	member_languagepair_id serial,
	member_id integer not null references members( member_id ),
	source_language_id integer not null references languages( language_id ),
	target_language_id integer not null references languages( language_id ),
	servicetype_id integer not null references servicetypes( servicetype_id ),
	constraint member_languagepairs_member_languagepair_id_pkey primary key( member_languagepair_id )
);

comment on table member_languagepairs is 'storage of member_languagepairs';
comment on column member_languagepairs.member_languagepair_id is 'unique id of table';
comment on column member_languagepairs.member_id is 'reference id to members table';
comment on column member_languagepairs.source_language_id is 'source language id (reference id to languages table)';
comment on column member_languagepairs.target_language_id is 'target language id (reference id to languages table)';
comment on column member_languagepairs.servicetype_id is 'servicetype reference id';

comment on constraint member_languagepairs_member_languagepair_id_pkey on member_languagepairs is
	'unique constraint of table';

comment on constraint member_languagepairs_member_id_fkey on member_languagepairs is
	'foreign constraint to members table';

comment on constraint member_languagepairs_source_language_id_fkey on member_languagepairs is 
	'foreign constraint to languages table on source language';

comment on constraint member_languagepairs_target_language_id_fkey on member_languagepairs is
	'foreign constraint to languages table on target language';

comment on constraint member_languagepairs_servicetype_id_fkey on member_languagepairs is
	'foreign constraint to servicetypes table';


