-- Create carts table DROP TABLE IF EXISTS adyen_sessions; CREATE TABLE adyen_sessions ( id SERIAL PRIMARY KEY, cart_id TEXT NOT NULL, adyen_session_id TEXT, content JSONB NOT NULL, payment_complete_response TEXT, authorisation_webhook TEXT, status TEXT NOT NULL DEFAULT 'created', order_id INTEGER REFERENCES orders(id), inserted TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), updated TIMESTAMP WITH TIME ZONE ); CREATE TRIGGER updated_timestamp BEFORE UPDATE ON adyen_sessions FOR EACH ROW EXECUTE FUNCTION updated_timestamp(); ALTER TABLE orders ADD COLUMN delivery_method_name TEXT DEFAULT NULL;