drop table if exists member_languages;
create table member_languages(
	member_language_id serial,
	member_id integer not null references members( member_id ),
	language_id integer not null references languages( language_id ),
	ordering integer,
	constraint member_languages_member_language_id_pkey primary key( member_language_id )
);

comment on table member_languages is 'storage of member_languages';
comment on column member_languages.member_language_id is 'unique id of table';
comment on column member_languages.member_id is 'reference id to members table';
comment on column member_languages.language_id is 'reference id to languages table';
comment on column member_languages.ordering is 'ordering of the language';

create index member_languages_member_id_ind on member_languages( member_id );
comment on index member_languages_member_id_ind is 'reference index to';

comment on constraint member_languages_member_language_id_pkey on member_languages is
	'unique constraint of table';

comment on constraint member_languages_member_id_fkey on member_languages is
	'foreign constraint to members table';

comment on constraint member_languages_language_id_fkey on member_languages is
	'foreign constraint to languages table';

