-- ------------------------------------------------------------
-- Migration 002: Membership code + document verification
-- Run this ONLY if you already have an existing ltda_association
-- database from before this feature was added. Fresh installs
-- using schema.sql already include these columns.
-- ------------------------------------------------------------

ALTER TABLE users
    ADD COLUMN member_code VARCHAR(20) DEFAULT NULL UNIQUE AFTER membership_date,
    ADD COLUMN documents_verified TINYINT(1) NOT NULL DEFAULT 0 AFTER member_code,
    ADD COLUMN documents_verified_at DATETIME DEFAULT NULL AFTER documents_verified,
    ADD COLUMN documents_verified_by INT DEFAULT NULL AFTER documents_verified_at;
