-- phpMyAdmin SQL Dump
-- version 3.5.6
-- http://www.phpmyadmin.net
--
-- 主機: localhost
-- 產生日期: 2016 年 04 月 25 日 18:32
-- 伺服器版本: 5.5.40-0ubuntu0.14.04.1
-- PHP 版本: 5.5.9-1ubuntu4.7

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- 資料庫: `ilccard`
--

-- --------------------------------------------------------

--
-- 表的結構 `applies`
--

CREATE TABLE IF NOT EXISTS `applies` (
  `apply_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '申請流水號',
  `user_uid` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '使用者帳號',
  `user_school_code` varchar(6) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '使用者學校代號',
  `apply_content` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '申請身份證',
  `apply_type` int(11) NOT NULL COMMENT '申請原因類別',
  `apply_status` int(11) NOT NULL COMMENT '申請狀態',
  `apply_receipt` int(11) NOT NULL COMMENT '申請收據列印',
  `apply_notice` int(11) NOT NULL COMMENT '申請通知',
  `apply_activation` int(11) NOT NULL COMMENT '申請開卡',
  `apply_activation_datetime` datetime NOT NULL COMMENT '申請開卡日期',
  `apply_timestamp` datetime NOT NULL COMMENT '申請時間戳',
  `apply_update_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '申請更新時間戳',
  PRIMARY KEY (`apply_id`),
  KEY `apply_id` (`apply_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

--
-- 表的結構 `cards`
--

CREATE TABLE IF NOT EXISTS `cards` (
  `card_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '卡片流水號',
  `apply_id` int(11) NOT NULL COMMENT '申請流水號',
  `user_uid` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '使用者帳號',
  `user_idno` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '使用者身份證',
  `user_name` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '使用者姓名',
  `user_class` varchar(3) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '使用者班級',
  `user_seatno` varchar(2) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '使用者座號',
  `card_no` varchar(8) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '卡片號碼',
  `card_barcode` varchar(51) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '卡片條碼編號',
  `card_ckno` varchar(11) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '卡片檢核號碼',
  `card_status` int(11) NOT NULL COMMENT '卡片狀態',
  `card_datetime` datetime NOT NULL COMMENT '卡片建立時間',
  `card_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '卡片時間戳',
  PRIMARY KEY (`card_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

--
-- 表的結構 `card_barcodes`
--

CREATE TABLE IF NOT EXISTS `card_barcodes` (
  `barcode_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '條碼流水號',
  `user_idno` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '使用者身份證',
  `barcode_no` varchar(51) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '條碼號碼',
  `barcode_num` int(11) NOT NULL COMMENT '條碼編號',
  PRIMARY KEY (`barcode_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

--
-- 表的結構 `users`
--

CREATE TABLE IF NOT EXISTS `users` (
  `user_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '使用者流水號',
  `user_uid` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '使用者帳號',
  `user_password` varchar(32) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '使用者密碼',
  `user_name` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `user_email` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '使用者電子郵件',
  `user_school_code` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '使用者學校代碼',
  `user_school` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '使用者學校',
  `user_grade` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '使用者年級',
  `user_class` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '使用者班級',
  `user_identity` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '使用者身份',
  `user_type` int(11) NOT NULL COMMENT '是否有最大權限',
  `user_role` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT '使用者角色',
  `user_register_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '使用者註冊時間',
  PRIMARY KEY (`user_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
