CREATE TABLE `terminalotosaat` (
	`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
	`saat` VARCHAR(6) NULL DEFAULT NULL,
	PRIMARY KEY (`id`)
)
COLLATE='latin5_turkish_ci'
ENGINE=InnoDB;


CREATE TABLE `zimmetbolum` (
	`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
	`kod` VARCHAR(10) NULL DEFAULT NULL,
	`ad` VARCHAR(60) NULL DEFAULT NULL,
	PRIMARY KEY (`id`)
)
COLLATE='latin5_turkish_ci'
ENGINE=InnoDB
AUTO_INCREMENT=0;

CREATE TABLE `zimmetkategori` (
	`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
	`kod` VARCHAR(10) NULL DEFAULT NULL,
	`ad` VARCHAR(60) NULL DEFAULT NULL,
	PRIMARY KEY (`id`)
)
COLLATE='latin5_turkish_ci'
ENGINE=InnoDB
AUTO_INCREMENT=0;

CREATE TABLE `personel_zimmet` (
	`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
	`personelid` BIGINT(20) NOT NULL,
	`zimmetbolumid` INT(11) NULL DEFAULT NULL,
	`zimmetkategoriid` INT(11) NULL DEFAULT NULL,
	`teslimpersonelid` BIGINT(20) NULL DEFAULT NULL,
	`aciklama` VARCHAR(400) NULL DEFAULT NULL,
	`verilistarihi` DATE NULL DEFAULT '2000-01-01',
	`verilissaati` TIME NULL DEFAULT NULL,
	`iadetarihi` DATE NULL DEFAULT NULL,
	`iadesaati` TIME NULL DEFAULT NULL,	
	PRIMARY KEY (`id`)
)
COLLATE='latin5_turkish_ci'
ENGINE=InnoDB
AUTO_INCREMENT=0;



CREATE TABLE `mailbolum` (
	`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
	`mailsablonid` INT(11) NOT NULL,
        `mailadresid` INT(11) NOT NULL,
	`bolumid` INT(11) NOT NULL,
	PRIMARY KEY (`id`)
)
COLLATE='latin5_turkish_ci'
ENGINE=InnoDB;

CREATE TABLE `mailgorev` (
	`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
	`mailsablonid` INT(11) NOT NULL,
	`mailadresid` INT(11) NOT NULL,
	`gorevid` INT(11) NOT NULL,
	PRIMARY KEY (`id`)
)
COLLATE='latin5_turkish_ci'
ENGINE=InnoDB;

CREATE TABLE `mailservis` (
	`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
	`mailsablonid` INT(11) NOT NULL,
   `mailadresid` INT(11) NOT NULL,
	`servisid` INT(11) NOT NULL,
	PRIMARY KEY (`id`)
)
COLLATE='latin5_turkish_ci'
ENGINE=InnoDB;

CREATE TABLE `mailbolge` (
	`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
	`mailsablonid` INT(11) NOT NULL,
   `mailadresid` INT(11) NOT NULL,
	`bolgeid` INT(11) NOT NULL,
	PRIMARY KEY (`id`)
)
COLLATE='latin5_turkish_ci'
ENGINE=InnoDB;

CREATE TABLE `mailfirma` (
	`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
	`mailsablonid` INT(11) NOT NULL,
   `mailadresid` INT(11) NOT NULL,
	`firmaid` INT(11) NOT NULL,
	PRIMARY KEY (`id`)
)
COLLATE='latin5_turkish_ci'
ENGINE=InnoDB;

CREATE TABLE `mailadres` (
	`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
	`isim` VARCHAR(100) NULL DEFAULT NULL,
	`email` VARCHAR(100) NULL DEFAULT NULL,
	`mailsablonid` INT(11) NOT NULL,
	PRIMARY KEY (`id`)
)
COLLATE='latin5_turkish_ci'
ENGINE=InnoDB;


CREATE TABLE `mailsablon` (
	`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
	`ad` VARCHAR(60) NULL DEFAULT '0',
	`gonderileceksaat` VARCHAR(6) NULL DEFAULT NULL,
	`tarihbas` INT(11) NULL DEFAULT 0,
	`tarihbit` INT(11) NULL DEFAULT 0,
	`gunluk` TINYINT(1) NULL DEFAULT '0',
	`haftalik` TINYINT(1) NULL DEFAULT '0',
	`aylik` TINYINT(1) NULL DEFAULT '0',
	`alan`  VARCHAR(30) NULL DEFAULT NULL,
        `rc` INT(11) NULL DEFAULT NULL, 
	PRIMARY KEY (`id`)
)
COLLATE='latin5_turkish_ci'
ENGINE=InnoDB
AUTO_INCREMENT=0;






alter table personel_zimmet add `verilissaati` TIME NULL DEFAULT NULL;
alter table personel_zimmet add `iadesaati` TIME NULL DEFAULT NULL;
alter table personel_zimmet add `teslimpersonelid` BIGINT(20) NULL DEFAULT NULL;
