-- Run this in cPanel → phpMyAdmin (or MySQL Databases) after creating a database.

CREATE TABLE IF NOT EXISTS bids (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT,
  job_name VARCHAR(255) NOT NULL DEFAULT 'Untitled Bid',
  system_description VARCHAR(500) NOT NULL DEFAULT '',
  selling_price DECIMAL(14, 2) NOT NULL DEFAULT 0,
  gross_profit DECIMAL(14, 2) NOT NULL DEFAULT 0,
  gp_margin DECIMAL(8, 6) NOT NULL DEFAULT 0,
  inputs_json LONGTEXT NOT NULL,
  created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (id),
  KEY idx_bids_updated (updated_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
