drop table if exists job_langpairs;
create table job_langpairs(
	job_langpair_id serial,
	job_id integer not null references jobs( job_id ),
	ordering integer not null,
	source_language_id integer not null references languages( language_id ),
	target_language_id integer not null references languages( language_id ),
	constraint job_langpairs_job_langpair_id_pkey primary key( job_langpair_id )
);

comment on table job_langpairs is 'storage of job language pairs';
comment on column job_langpairs.job_langpair_id is 'unique id of table';
comment on column job_langpairs.job_id is 'reference to jobs table';
comment on column job_langpairs.ordering is 'ordering of the language pair';
comment on column job_langpairs.source_language_id is 'source language of the language pair';
comment on column job_langpairs.target_language_id is 'target language of the language pair';

comment on constraint job_langpairs_job_langpair_id_pkey on job_langpairs is 'unique constraint of table';
comment on constraint job_langpairs_job_id_fkey on job_langpairs is 'foreign constraint to jobs table';
comment on constraint job_langpairs_source_language_id_fkey on job_langpairs is 'foreign constraint to languages table on source language';
comment on constraint job_langpairs_target_language_id_fkey on job_langpairs is 'foreign constraint to languages table on target language';

create index job_langpairs_job_id_ind on job_langpairs( job_id );
comment on index job_langpairs_job_id_ind is 'index of job_id';
