<?php

return <<<'SQL'
ALTER TABLE coffee_entries
    ADD COLUMN status VARCHAR(20) NOT NULL DEFAULT 'booked' AFTER total_cost,
    ADD COLUMN cancelled_at DATETIME NULL AFTER status,
    ADD COLUMN cancelled_by_member_id CHAR(36) NULL AFTER cancelled_at,
    ADD COLUMN cancellation_reason VARCHAR(255) NULL AFTER cancelled_by_member_id,
    ADD COLUMN cancellation_ledger_entry_id CHAR(36) NULL AFTER cancellation_reason,
    ADD INDEX coffee_entries_tenant_status_idx (tenant_id, status),
    ADD INDEX coffee_entries_tenant_member_status_idx (tenant_id, member_id, status);

ALTER TABLE payment_entries
    ADD COLUMN status VARCHAR(20) NOT NULL DEFAULT 'booked' AFTER amount,
    ADD COLUMN cancelled_at DATETIME NULL AFTER status,
    ADD COLUMN cancelled_by_member_id CHAR(36) NULL AFTER cancelled_at,
    ADD COLUMN cancellation_reason VARCHAR(255) NULL AFTER cancelled_by_member_id,
    ADD COLUMN cancellation_ledger_entry_id CHAR(36) NULL AFTER cancellation_reason,
    ADD INDEX payment_entries_tenant_status_idx (tenant_id, status),
    ADD INDEX payment_entries_tenant_member_status_idx (tenant_id, member_id, status);
SQL;
