CREATE TABLE IF NOT EXISTS `users` (
  `userId` bigint(20) NOT NULL AUTO_INCREMENT,
  `phone` varchar(50) NOT NULL,
  `type` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `password` varchar(255) NOT NULL,
  `name` varchar(100)  NOT NULL,
  `nickName` varchar(100) DEFAULT NULL,
  `email` varchar(100) DEFAULT NULL,
  `pic` varchar(255) DEFAULT NULL,
  `createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updatedAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`userId`),
  UNIQUE KEY `phone_type` (`phone`,`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `userToken` (
  `userId` bigint(20) unsigned NOT NULL,
  `token` varchar(100) NOT NULL,
  `isExpired` tinyint(2) unsigned NOT NULL DEFAULT '0',
  `createdAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`updatedAt` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`userId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;