drop table if exists job_quotes cascade;
create table job_quotes(
	job_quote_id serial,
	job_id integer not null references jobs( job_id ),
	member_id integer not null references members( member_id ),
	ctstamp timestamp without time zone not null default now(),
	quote_pricing varchar(64),
	quote text,
	is_accepted boolean,
	accepted_at timstamp without time zone,
	oldid integer,
	constraint job_quotes_job_quote_id_pkey primary key( job_quote_id )
);

comment on table job_quotes is 'storage of translators replies to job offers';
comment on column job_quotes.job_quote_id is 'unique id of table';
comment on column job_quotes.job_id is 'reference id to jobs table';
comment on column job_quotes.member_id is 'reference id to members table (the translator who replied)';
comment on column job_quotes.ctstamp is 'datetime of sent';
comment on column job_quotes.quote_pricing is 'pricing of the quote';
comment on column job_quotes.quote is 'the quote itself';
comment on column job_quotes.is_accepted is 'boolean if quote is accepted (null=undecided, true=accepted, false=declined)';
comment on column job_quotes.accepted_at is 'time stamp if accepting/declining of quote';
comment on column job_quotes.oldid is 'old id to fo_offer_sent table';

comment on constraint job_quotes_job_quote_id_pkey on job_quotes is 'unique constraint of table';
comment on constraint job_quotes_job_id_fkey on job_quotes is 'foreign constraint to jobs table';
comment on constraint job_quotes_member_id_fkey on job_quotes is 'foreign constraint to members table';

create index job_quotes_job_id_ind on job_quotes( job_id );
comment on index job_quotes_job_id_ind is 'index on job_id';
