--
-- Host: localhost    Database: JosmWeb
-- ------------------------------------------------------


--
-- Table structure for table `Auction`
--

CREATE TABLE `Auction` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `created` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `auctionType` tinyint(4) NOT NULL DEFAULT '1',
  `auctionStart` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `countdownStart` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `countdownTimer` int(11) NOT NULL DEFAULT '0',
  `auctionEnded` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `status` tinyint(4) NOT NULL DEFAULT '0',
  `bidId` int(11) NOT NULL DEFAULT '0',
  `bid` int(11) NOT NULL DEFAULT '0',
  `bidTime` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `reservationPrice` int(11) NOT NULL DEFAULT '0',
  `marketPrice` int(11) NOT NULL DEFAULT '0',
  `biddingFee` int(11) NOT NULL DEFAULT '0',
  `biddingFeeDealer` int(11) NOT NULL DEFAULT '0',
  `lowestBidIncrement` int(11) NOT NULL DEFAULT '0',
  `vat` tinyint(4) NOT NULL DEFAULT '0',
  `deductibleVat` tinyint(4) DEFAULT '0',
  `biddingFeeVat` tinyint(4) NOT NULL DEFAULT '0',
  `currency` varchar(3) CHARACTER SET utf8 COLLATE utf8_swedish_ci NOT NULL DEFAULT 'SEK',
  `export` tinyint(4) NOT NULL DEFAULT '0',
  `businessSystemId` tinyint(4) NOT NULL DEFAULT '0',
  `updateBusinessSystem` tinyint(4) NOT NULL DEFAULT '0',
  `readByBusinessSystem` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `preliminaryDate` tinyint(4) NOT NULL DEFAULT '0',
  `isTestAuction` tinyint(3) unsigned DEFAULT '0',
  `md5` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `auctionEnded` (`auctionEnded`),
  KEY `status` (`status`)
) ENGINE=InnoDB AUTO_INCREMENT=709701 DEFAULT CHARSET=utf8;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `SET_AUCTIONSTART` BEFORE UPDATE ON `Auction` FOR EACH ROW BEGIN
IF (NEW.status = 1 OR NEW.status = 11) AND (OLD.status <> 1 and OLD.status <> 11) THEN

 SET NEW.auctionStart = NOW();

END IF;

END */;;
DELIMITER ;


