-- +goose Up
-- +goose StatementBegin

-- ─────────────────────────────────────────────────────────────────────────────
-- Fix role CHECK constraint to include all roles used by the application.
-- Original migration only had: owner, admin, manager, user, readonly
-- System also uses: vendedor, operador
-- ─────────────────────────────────────────────────────────────────────────────

ALTER TABLE users
    DROP CONSTRAINT IF EXISTS users_role_check;

ALTER TABLE users
    ADD CONSTRAINT users_role_check
    CHECK (role IN ('owner','admin','manager','vendedor','operador','readonly'));

-- +goose StatementEnd

-- +goose Down
-- +goose StatementBegin

ALTER TABLE users
    DROP CONSTRAINT IF EXISTS users_role_check;

ALTER TABLE users
    ADD CONSTRAINT users_role_check
    CHECK (role IN ('owner','admin','manager','user','readonly'));

-- +goose StatementEnd
