-- +goose Up

ALTER TABLE disputes
  ADD COLUMN initiator_type VARCHAR(16) NOT NULL DEFAULT 'user' COMMENT '发起方类型: user用户/admin客服' AFTER initiator_id,
  ADD COLUMN initiator_admin_id BIGINT UNSIGNED NULL COMMENT '客服发起时的管理员ID' AFTER initiator_type,
  ADD KEY idx_disputes_initiator_type (initiator_type, initiator_id),
  ADD KEY idx_disputes_initiator_admin (initiator_admin_id);

UPDATE disputes
SET initiator_type = 'user'
WHERE initiator_type = '';

-- +goose Down

ALTER TABLE disputes
  DROP KEY idx_disputes_initiator_admin,
  DROP KEY idx_disputes_initiator_type,
  DROP COLUMN initiator_admin_id,
  DROP COLUMN initiator_type;
