CREATE TABLE sms_messages (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  from_number TEXT NOT NULL,
  content TEXT NOT NULL,
  timestamp INTEGER NOT NULL,
  device_info TEXT,
  sim_info TEXT,
  sign_verified INTEGER,
  ip_address TEXT,
  created_at TEXT
);

CREATE TABLE receive_logs (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  from_number TEXT NOT NULL,
  content TEXT NOT NULL,
  timestamp INTEGER NOT NULL,
  sign TEXT,
  sign_valid INTEGER,
  ip_address TEXT,
  status TEXT NOT NULL,
  error_message TEXT,
  created_at TEXT
);

CREATE INDEX idx_messages_from ON sms_messages(from_number);
CREATE INDEX idx_messages_timestamp ON sms_messages(timestamp);
CREATE INDEX idx_messages_created ON sms_messages(created_at);

CREATE INDEX idx_logs_created ON receive_logs(created_at);
CREATE INDEX idx_logs_status ON receive_logs(status);
