CREATE TABLE IF NOT EXISTS users (
  id SERIAL PRIMARY KEY,
  phone_number TEXT UNIQUE NOT NULL,
  username TEXT,
  email TEXT,
  address TEXT,
  profile_picture TEXT,
  created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);

-- Create indexes for better performance
CREATE INDEX IF NOT EXISTS users_phone_number_idx ON users(phone_number);
CREATE INDEX IF NOT EXISTS users_email_idx ON users(email);

-- Insert sample data
INSERT INTO users (phone_number, username, email, address, profile_picture)
VALUES 
  ('+1234567890', 'John Doe', 'john@example.com', '123 Main St, City, Country', 'uploads/default.jpg'),
  ('+1987654321', 'Jane Smith', 'jane@example.com', '456 Oak Ave, Town, Country', 'uploads/default.jpg'),
  ('+1122334455', 'Mike Johnson', 'mike@example.com', '789 Pine Rd, Village, Country', 'uploads/default.jpg')
ON CONFLICT (phone_number) DO NOTHING;
