drop table if exists member_specialties;
create table member_specialties(
	member_specialty_id serial,
	member_id integer not null references members( member_id ),
	specialty_id integer not null references specialties( specialty_id ),
	constraint member_specialties_member_specialty_id_pkey primary key( member_specialty_id )
);

comment on table member_specialties is 'storage of member specialties';
comment on column member_specialties.member_specialty_id is 'unique id of table';
comment on column member_specialties.member_id is 'reference id to members table';
comment on column member_specialties.specialty_id is 'reference id to specialties table';

create index member_specialties_member_id_ind on member_specialties( member_id );
comment on index member_specialties_member_id_ind is 'reference index to members table';

create index member_specialties_specialty_id_ind on member_specialties( specialty_id );
comment on index member_specialties_specialty_id_ind is 'reference index to specialties table';

comment on constraint member_specialties_member_specialty_id_pkey on member_specialties is 'unique constraint of table';
comment on constraint member_specialties_member_id_fkey on member_specialties is 'foreign constraint to members table';
comment on constraint member_specialties_specialty_id_fkey on member_specialties is 'foreign constraint to specialties table';
