18 lines
834 B
MySQL
18 lines
834 B
MySQL
|
|
-- Add password field to customers table for authentication
|
||
|
|
ALTER TABLE customers ADD COLUMN password_hash VARCHAR(255);
|
||
|
|
|
||
|
|
-- Add phone number field if not exists (for registration)
|
||
|
|
ALTER TABLE customers ADD COLUMN phone_number VARCHAR(20) UNIQUE;
|
||
|
|
|
||
|
|
-- Add birth_date field for customer registration
|
||
|
|
ALTER TABLE customers ADD COLUMN birth_date DATE;
|
||
|
|
|
||
|
|
-- Add indexes for better performance
|
||
|
|
CREATE INDEX idx_customers_phone_number ON customers(phone_number);
|
||
|
|
CREATE INDEX idx_customers_password_hash ON customers(password_hash) WHERE password_hash IS NOT NULL;
|
||
|
|
|
||
|
|
-- Add comments
|
||
|
|
COMMENT ON COLUMN customers.password_hash IS 'Hashed password for customer authentication';
|
||
|
|
COMMENT ON COLUMN customers.phone_number IS 'Unique phone number for customer login';
|
||
|
|
COMMENT ON COLUMN customers.birth_date IS 'Customer birth date for registration';
|