CREATE TABLE `api_keys` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL,
  `active` tinyint(1) NOT NULL DEFAULT '0',
  `key` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
  `times_accessed` int(11) NOT NULL DEFAULT '0',
  `last_accessed_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`),
  UNIQUE KEY `api_keys_key_unique` (`key`),
  KEY `api_keys_user_id_foreign` (`user_id`),
  CONSTRAINT `api_keys_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
INSERT INTO `migrations` (`migration`, `batch`) VALUES ('2015_10_28_181548_create_api_keys_table', 1);
ALTER TABLE `jobs` ADD `source` tinyint(1) NOT NULL DEFAULT '0' AFTER `city`;
INSERT INTO `migrations` (`migration`, `batch`) VALUES ('2015_11_03_182128_add_source_column_to_jobs', 1);
