-- Ekspertizler tablosuna detay alanları ekler
ALTER TABLE `ekspertizler`
  ADD `alici_id` int(11) unsigned NULL AFTER `bayi_id`,
  ADD `satici_id` int(11) unsigned NULL AFTER `alici_id`,
  ADD `sase_no` varchar(30) DEFAULT NULL AFTER `plaka`,
  ADD `kasa_turu` varchar(50) DEFAULT NULL AFTER `sase_no`,
  ADD `renk` varchar(50) DEFAULT NULL AFTER `arac_yil`,
  ADD `yakit_tipi` varchar(50) DEFAULT NULL AFTER `renk`,
  ADD `sanziman_tipi` varchar(50) DEFAULT NULL AFTER `yakit_tipi`,
  ADD `km` int(11) unsigned DEFAULT NULL AFTER `sanziman_tipi`,
  ADD `motor_gucu` varchar(50) DEFAULT NULL AFTER `km`,
  ADD `motor_hacmi` varchar(50) DEFAULT NULL AFTER `motor_gucu`,
  ADD `ruhsat_goruldu` tinyint(1) NOT NULL DEFAULT 0 AFTER `motor_hacmi`,
  ADD `satis_tutari` decimal(12,2) NOT NULL DEFAULT 0.00 AFTER `tutar`,
  ADD `alinan_tutar` decimal(12,2) NOT NULL DEFAULT 0.00 AFTER `satis_tutari`,
  ADD `borc_odenen` decimal(12,2) NOT NULL DEFAULT 0.00 AFTER `alinan_tutar`,
  ADD `borc_kalan` decimal(12,2) NOT NULL DEFAULT 0.00 AFTER `borc_odenen`,
  ADD `odeme_turu` varchar(20) DEFAULT NULL AFTER `borc_kalan`,
  ADD `ekstra_toplam` decimal(12,2) NOT NULL DEFAULT 0.00 AFTER `odeme_turu`,
  ADD CONSTRAINT `fk_ekspertizler_alici` FOREIGN KEY (`alici_id`) REFERENCES `musteriler` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD CONSTRAINT `fk_ekspertizler_satici` FOREIGN KEY (`satici_id`) REFERENCES `musteriler` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
  ADD UNIQUE KEY `uq_ekspertizler_sase_no` (`sase_no`);

