-- --------------------------------------------------------
-- Server OS:                    Win64
-- HeidiSQL Version:             10.1.0.5484
-- --------------------------------------------------------



-- Dumping structure for table myconnection.migration
CREATE TABLE IF NOT EXISTS `migration` (
  `version` varchar(180) NOT NULL,
  `apply_time` int(11) DEFAULT NULL,
  PRIMARY KEY (`version`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- Dumping data for table myconnection.migration: ~2 rows (approximately)
DELETE FROM `migration`;
INSERT INTO `migration` (`version`, `apply_time`) VALUES
	('m000000_000000_base', 1548917531),
	('m130524_201442_init', 1548917544);

-- Dumping structure for table myconnection.sync_account_to_jurnal
CREATE TABLE IF NOT EXISTS `sync_account_to_jurnal` (
  `payment_fpkey` int(11) NOT NULL,
  `payment_type` varchar(90) DEFAULT NULL,
  `nama_akun` varchar(90) DEFAULT NULL,
  PRIMARY KEY (`payment_fpkey`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- Dumping structure for table myconnection.sync_to_jurnal
CREATE TABLE IF NOT EXISTS `sync_to_jurnal` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `last_update` datetime DEFAULT NULL,
  `tipe_tabel` varchar(255) DEFAULT NULL,
  `id_record` int(11) NOT NULL,
  `status_sinkron` varchar(10) DEFAULT NULL,
  `keterangan` text,
  `id_jurnal` double DEFAULT NULL,
  `tipe_proses` varchar(20) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=latin1;

ALTER TABLE sync_to_jurnal ADD type_con ENUM('retail','resto');
ALTER TABLE sync_account_to_jurnal ADD type_con ENUM('retail','resto');
ALTER TABLE `sync_account_to_jurnal`
  ALTER `type_con` DROP DEFAULT;
ALTER TABLE `sync_account_to_jurnal`
  CHANGE COLUMN `type_con` `type_con` ENUM('retail','resto') NOT NULL AFTER `nama_akun`,
  DROP PRIMARY KEY,
  ADD PRIMARY KEY (`payment_fpkey`, `type_con`);


UPDATE sync_account_to_jurnal SET type_con = 'resto' WHERE type_con IS NULL;
UPDATE sync_to_jurnal SET type_con = 'resto' WHERE type_con IS NULL;

CREATE TABLE `sync_to_jurnal_header` (                     
 `id_header` int(11) NOT NULL auto_increment,             
 `jenis_sinkron` enum('manual','otomatis') default NULL,  
 `jenis_data` enum('master','transaksi') default NULL,
 `date_created` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
 `type_con` enum('resto','retail') default 'resto',
 PRIMARY KEY  (`id_header`)                               
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

ALTER TABLE sync_to_jurnal ADD COLUMN id_header int(11) AFTER id;

