-- migrate:up
ALTER TABLE tenant_ecommerce_config DROP COLUMN credential_secret;
ALTER TABLE tenant_ecommerce_config RENAME COLUMN credential_key TO credential_ref;
ALTER TABLE tenant_ecommerce_config ADD COLUMN enc_consumer_key bytea;
ALTER TABLE tenant_ecommerce_config ADD COLUMN enc_consumer_secret bytea;
ALTER TABLE tenant_ecommerce_config ADD COLUMN encryption_salt bytea DEFAULT gen_random_bytes(16);

-- migrate:down
ALTER TABLE tenant_ecommerce_config DROP COLUMN encryption_salt;
ALTER TABLE tenant_ecommerce_config DROP COLUMN enc_consumer_secret;
ALTER TABLE tenant_ecommerce_config DROP COLUMN enc_consumer_key;
ALTER TABLE tenant_ecommerce_config RENAME COLUMN credential_ref TO credential_key;
ALTER TABLE tenant_ecommerce_config ADD COLUMN credential_secret text NOT NULL;