-- Deploy camper:payment_redsys_response to pg
-- requires: roles
-- requires: schema_camper
-- requires: payment
-- requires: currency_code

begin;

set search_path to camper, public;

create table payment_redsys_response (
	payment_redsys_response_id integer generated by default as identity primary key,
	payment_id integer not null references payment,
	response_code integer not null,
	date_time timestamp without time zone not null,
	secure_payment boolean not null,
	transaction_type integer not null,
	amount integer not null,
	currency_code currency_code not null references currency,
	order_number text not null,
	authorization_code text not null,
	merchant_code text not null,
	terminal_number integer not null,
	error_code text not null
);

grant select, insert, update on table payment_redsys_response to guest;
grant select, insert, update on table payment_redsys_response to employee;
grant select, insert, update, delete on table payment_redsys_response to admin;

commit;
