DROP TABLE IF EXISTS `document_fields`;
CREATE TABLE `document_fields` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `doc_type` int(11) NOT NULL COMMENT '1-Pracownik, 2-Pracodawca, 3-Hakowy',
  `field_name` varchar(50) NOT NULL,
  `field_label` varchar(100) NOT NULL,
  `pos_x` int(11) NOT NULL DEFAULT 0,
  `pos_y` int(11) NOT NULL DEFAULT 0,
  `width` int(11) DEFAULT NULL,
  `height` int(11) DEFAULT NULL,
  `font_size` int(11) DEFAULT 12,
  `is_required` tinyint(1) NOT NULL DEFAULT 1,
  PRIMARY KEY (`id`),
  UNIQUE KEY `doc_type_field` (`doc_type`,`field_name`)
) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci;
DROP TABLE IF EXISTS `firmy`;
CREATE TABLE `firmy` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL DEFAULT '',
  `value` text NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci COMMENT='utf8_polish_ci';
DROP TABLE IF EXISTS `settings`;
CREATE TABLE `settings` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `setting_key` varchar(50) NOT NULL,
  `setting_value` text NOT NULL,
  `description` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `setting_key` (`setting_key`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci;
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(50) NOT NULL,
  `password` varchar(255) NOT NULL,
  `role` varchar(20) DEFAULT 'operator',
  `email` varchar(100) DEFAULT NULL,
  `full_name` varchar(100) DEFAULT NULL,
  `created_at` int(11) NOT NULL,
  `last_login` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `username` (`username`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci;
DROP TABLE IF EXISTS `zaswiadczenia`;
CREATE TABLE `zaswiadczenia` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) DEFAULT NULL,
  `birth_date` varchar(30) DEFAULT NULL,
  `birth_place` varchar(30) DEFAULT NULL,
  `birth_province` varchar(30) DEFAULT NULL,
  `datefrom` int(11) DEFAULT NULL,
  `dateto` int(11) DEFAULT NULL,
  `course_rate` varchar(20) DEFAULT NULL,
  `today` varchar(30) DEFAULT NULL,
  `city` varchar(30) DEFAULT NULL,
  `doc_id` varchar(15) DEFAULT NULL,
  `doc_type` int(11) DEFAULT NULL,
  `background` int(1) DEFAULT 0,
  `firma` int(11) NOT NULL DEFAULT 0,
  `pesel` varchar(50) DEFAULT NULL,
  `expiry_date` int(11) DEFAULT NULL COMMENT 'Data wygaśnięcia szkolenia',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=725 DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci COMMENT='utf8_polish_ci';
