# ************************************************************
# Sequel Pro SQL dump
# Version 5224
#
# http://www.sequelpro.com/
# https://github.com/sequelpro/sequelpro
#
# Host: 127.0.0.1 (MySQL 5.6.23)
# Database: sailing_sw
# Generation Time: 2017-11-03 10:23:10 +0000
# ************************************************************




# Dump of table swboat
# ------------------------------------------------------------


CREATE TABLE `swboat` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(20) DEFAULT '',
  `sail_no` varchar(20) NOT NULL DEFAULT '',
  `boat_class_id` int(11) unsigned NOT NULL,
  `club_id` int(11) unsigned NOT NULL,
  `image` varchar(255) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `fk_boat_club` (`club_id`),
  KEY `fk_boat_class` (`boat_class_id`),
  CONSTRAINT `fk_boat_class` FOREIGN KEY (`boat_class_id`) REFERENCES `swclass` (`id`),
  CONSTRAINT `fk_boat_club` FOREIGN KEY (`club_id`) REFERENCES `swclub` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


INSERT INTO `swboat` (`id`, `name`, `sail_no`, `boat_class_id`, `club_id`, `image`, `created_at`, `updated_at`)
VALUES
	(3,'Laser Std','213126',35,3,NULL,'2017-10-29 19:25:48','2017-11-02 22:32:14'),
	(4,'Blaze ','828',58,2,NULL,'2017-10-29 19:29:04','2017-11-02 22:23:32'),
	(5,'Int. Canoe','314',91,4,NULL,'2017-10-29 19:30:11','2017-11-02 22:30:45'),
	(7,'Laser radial','WA2',23,2,NULL,'2017-10-29 21:02:50','2017-11-02 22:26:19'),
	(8,'RS400','1280',75,5,NULL,'2017-10-29 21:20:42','2017-11-02 22:29:45'),
	(9,'Blaze ','807',58,6,NULL,'2017-10-30 18:52:24','2017-11-02 22:19:40'),
	(12,'Phantom','1454',63,7,NULL,'2017-10-30 19:47:59','2017-11-02 22:33:31'),
	(13,'Scorpion ','1886',53,2,NULL,'2017-10-30 19:48:34','2017-11-02 22:29:22'),
	(14,'Int. Canoe','340',91,8,NULL,'2017-10-30 19:49:05','2017-11-02 22:31:47'),
	(15,'D Zero','260',56,9,NULL,'2017-10-30 19:57:50','2017-11-02 22:23:55'),
	(16,'Dart 18 ','7442',96,2,NULL,'2017-10-30 19:58:20','2017-11-02 22:24:22'),
	(17,'Blaze ','823',58,2,NULL,'2017-10-30 19:59:34','2017-11-02 22:19:30'),
	(18,'Laser Bahia','3',10,2,NULL,'2017-10-30 20:00:00','2017-10-30 20:00:00'),
	(19,'Blaze ','710',58,10,NULL,'2017-10-30 20:00:31','2017-11-02 22:19:51'),
	(20,'Redwing','62',11,2,NULL,'2017-10-30 20:01:01','2017-10-30 20:01:01'),
	(21,'RS Aero 7','2104',43,4,NULL,'2017-10-30 20:01:41','2017-11-02 22:30:39'),
	(22,'Laser radial','151242',23,2,NULL,'2017-10-30 20:02:13','2017-11-02 22:26:19'),
	(23,'Sprint 15','1545',78,2,NULL,'2017-10-30 20:02:43','2017-11-02 22:28:45'),
	(24,'Supernova','1111',41,2,NULL,'2017-10-30 20:03:00','2017-11-02 22:28:01'),
	(25,'Laser radial','159397',23,2,NULL,'2017-10-30 20:03:26','2017-11-02 22:26:19'),
	(26,'GP 14','546',24,2,NULL,'2017-10-30 20:03:56','2017-11-02 22:34:22'),
	(27,'Dart 18 ','7942',96,2,NULL,'2017-10-30 20:04:24','2017-11-02 22:24:14'),
	(28,'Redwing','211',11,2,NULL,'2017-10-30 20:04:47','2017-10-30 20:04:47'),
	(29,'Feva XL','21',9,2,NULL,'2017-10-30 20:05:12','2017-11-02 22:45:34'),
	(30,'Feva XL','6544',9,2,NULL,'2017-10-30 20:05:35','2017-11-02 22:45:13'),
	(31,'Sprint 15','525',78,2,NULL,'2017-10-30 20:05:58','2017-11-02 22:28:45'),
	(32,'Icon','18',67,7,NULL,'2017-10-30 20:06:22','2017-11-02 22:25:37'),
	(33,'RS400','411',75,7,NULL,'2017-10-30 20:06:48','2017-11-02 22:29:56'),
	(34,'Blaze ','713',58,2,NULL,'2017-10-30 20:07:08','2017-11-02 22:22:59'),
	(35,'RS500','508',70,11,NULL,'2017-10-30 20:07:32','2017-11-02 22:30:12'),
	(36,'Scorpion ','2041',53,12,NULL,'2017-10-30 20:07:58','2017-11-02 22:29:07'),
	(37,'D Zero','11',56,13,NULL,'2017-10-30 20:08:32','2017-11-02 22:23:38'),
	(38,'Merlin Rocket','3774',65,12,NULL,'2017-10-30 20:09:01','2017-11-02 22:32:33'),
	(39,'Laser Bahia','',10,2,NULL,'2017-10-30 20:09:23','2017-10-30 20:09:23'),
	(40,'Laser Vargo','181',42,14,NULL,'2017-10-30 20:09:55','2017-11-02 22:27:39'),
	(41,'Sprint 15','1929',78,2,NULL,'2017-10-30 20:10:30','2017-11-02 22:28:45'),
	(42,'Sprint 15','1849',78,2,NULL,'2017-10-30 20:10:55','2017-11-02 22:28:45'),
	(43,'Sprint 15','1424',78,2,NULL,'2017-10-30 20:11:20','2017-11-02 22:28:45'),
	(44,'Dart 18 ','7480',96,2,NULL,'2017-10-30 20:11:47','2017-11-02 22:24:06'),
	(45,'Laser radial','7',23,2,NULL,'2017-10-30 20:12:08','2017-11-02 22:26:19'),
	(46,'Sprint 16','1972',21,2,NULL,'2017-10-30 20:12:34','2017-10-30 20:12:34'),
	(47,'Dart 18 ','5951',96,2,NULL,'2017-10-30 20:12:57','2017-11-02 22:25:01');



# Dump of table swboatclassstarttime
# ------------------------------------------------------------


CREATE TABLE `swboatclassstarttime` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `race_id` int(11) unsigned NOT NULL,
  `boat_class_id` int(11) unsigned NOT NULL,
  `start_time_datetime` datetime NOT NULL,
  `start_time_hhmmss` varchar(8) NOT NULL DEFAULT '',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `fk_time_race` (`race_id`),
  KEY `fk_time_class` (`boat_class_id`),
  CONSTRAINT `fk_time_class` FOREIGN KEY (`boat_class_id`) REFERENCES `swclass` (`id`),
  CONSTRAINT `fk_time_race` FOREIGN KEY (`race_id`) REFERENCES `swrace` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


INSERT INTO `swboatclassstarttime` (`id`, `race_id`, `boat_class_id`, `start_time_datetime`, `start_time_hhmmss`, `created_at`, `updated_at`)
VALUES
	(202,1,8,'2017-10-29 11:00:00','11:00:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(203,1,9,'2017-10-29 11:10:00','11:10:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(204,1,13,'2017-10-29 11:13:00','11:13:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(205,1,14,'2017-10-29 11:13:00','11:13:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(206,1,17,'2017-10-29 11:16:00','11:16:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(207,1,22,'2017-10-29 11:18:00','11:18:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(208,1,23,'2017-10-29 11:19:00','11:19:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(209,1,24,'2017-10-29 11:19:00','11:19:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(210,1,25,'2017-10-29 11:19:00','11:19:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(211,1,28,'2017-10-29 11:20:00','11:20:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(212,1,29,'2017-10-29 11:21:00','11:21:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(213,1,30,'2017-10-29 11:21:00','11:21:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(214,1,31,'2017-10-29 11:21:00','11:21:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(215,1,33,'2017-10-29 11:22:00','11:22:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(216,1,34,'2017-10-29 11:22:00','11:22:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(217,1,37,'2017-10-29 11:23:00','11:23:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(218,1,39,'2017-10-29 11:23:00','11:23:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(219,1,40,'2017-10-29 11:23:00','11:23:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(220,1,41,'2017-10-29 11:24:00','11:24:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(221,1,43,'2017-10-29 11:25:00','11:25:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(222,1,44,'2017-10-29 11:25:00','11:25:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(223,1,45,'2017-10-29 11:25:00','11:25:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(224,1,46,'2017-10-29 11:25:00','11:25:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(225,1,47,'2017-10-29 11:25:00','11:25:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(226,1,49,'2017-10-29 11:27:00','11:27:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(227,1,50,'2017-10-29 11:27:00','11:27:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(228,1,51,'2017-10-29 11:27:00','11:27:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(229,1,52,'2017-10-29 11:27:00','11:27:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(230,1,53,'2017-10-29 11:27:00','11:27:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(231,1,54,'2017-10-29 11:28:00','11:28:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(232,1,56,'2017-10-29 11:28:00','11:28:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(233,1,57,'2017-10-29 11:29:00','11:29:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(234,1,58,'2017-10-29 11:29:00','11:29:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(235,1,59,'2017-10-29 11:29:00','11:29:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(236,1,60,'2017-10-29 11:30:00','11:30:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(237,1,62,'2017-10-29 11:30:00','11:30:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(238,1,63,'2017-10-29 11:31:00','11:31:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(239,1,64,'2017-10-29 11:32:00','11:32:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(240,1,65,'2017-10-29 11:33:00','11:33:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(241,1,66,'2017-10-29 11:33:00','11:33:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(242,1,67,'2017-10-29 11:33:00','11:33:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(243,1,68,'2017-10-29 11:33:00','11:33:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(244,1,69,'2017-10-29 11:34:00','11:34:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(245,1,70,'2017-10-29 11:34:00','11:34:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(246,1,71,'2017-10-29 11:34:00','11:34:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(247,1,73,'2017-10-29 11:35:00','11:35:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(248,1,74,'2017-10-29 11:35:00','11:35:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(249,1,75,'2017-10-29 11:36:00','11:36:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(250,1,76,'2017-10-29 11:37:00','11:37:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(251,1,77,'2017-10-29 11:37:00','11:37:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(252,1,78,'2017-10-29 11:37:00','11:37:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(253,1,79,'2017-10-29 11:38:00','11:38:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(254,1,81,'2017-10-29 11:38:00','11:38:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(255,1,82,'2017-10-29 11:38:00','11:38:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(256,1,83,'2017-10-29 11:38:00','11:38:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(257,1,84,'2017-10-29 11:38:00','11:38:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(258,1,86,'2017-10-29 11:39:00','11:39:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(259,1,90,'2017-10-29 11:40:00','11:40:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(260,1,91,'2017-10-29 11:40:00','11:40:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(261,1,92,'2017-10-29 11:42:00','11:42:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(262,1,93,'2017-10-29 11:43:00','11:43:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(263,1,94,'2017-10-29 11:45:00','11:45:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(264,1,95,'2017-10-29 11:45:00','11:45:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(265,1,96,'2017-10-29 11:47:00','11:47:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(266,1,97,'2017-10-29 11:48:00','11:48:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(267,1,98,'2017-10-29 11:52:00','11:52:00','2017-11-03 01:19:36','2017-11-03 01:19:36'),
	(268,1,99,'2017-10-29 11:53:00','11:53:00','2017-11-03 01:19:36','2017-11-03 01:19:36');



# Dump of table swbouy
# ------------------------------------------------------------


CREATE TABLE `swbouy` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL DEFAULT '',
  `description` varchar(500) DEFAULT NULL,
  `latitude` double NOT NULL,
  `longitude` double NOT NULL,
  `color` varchar(9) NOT NULL DEFAULT '',
  `is_static` tinyint(1) NOT NULL DEFAULT '0',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


INSERT INTO `swbouy` (`id`, `name`, `description`, `latitude`, `longitude`, `color`, `is_static`, `created_at`, `updated_at`)
VALUES
	(25,'Bouy #1',NULL,50.790527850939256,-0.9534931182861328,'#A92020',0,'2017-11-02 08:36:09','2017-11-02 08:36:09');



# Dump of table swbouyrace
# ------------------------------------------------------------


CREATE TABLE `swbouyrace` (
  `bouy_id` int(11) unsigned NOT NULL,
  `race_id` int(11) unsigned NOT NULL,
  `order` int(11) DEFAULT NULL,
  PRIMARY KEY (`bouy_id`,`race_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


INSERT INTO `swbouyrace` (`bouy_id`, `race_id`, `order`)
VALUES
	(25,1,NULL);



# Dump of table swclass
# ------------------------------------------------------------


CREATE TABLE `swclass` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL DEFAULT '',
  `no_crew` int(11) DEFAULT NULL,
  `rig` varchar(2) DEFAULT '',
  `spinnake` varchar(1) DEFAULT NULL,
  `pn` int(11) DEFAULT NULL,
  `change` int(11) DEFAULT NULL,
  `races` varchar(11) DEFAULT NULL,
  `year` int(11) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


INSERT INTO `swclass` (`id`, `name`, `no_crew`, `rig`, `spinnake`, `pn`, `change`, `races`, `year`, `created_at`, `updated_at`)
VALUES
	(1,'OPTIMIST',1,'U','0',1665,0,'1744',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(2,'RS TERA SPORT',1,'U','0',1432,-25,'281',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(3,'CADET',2,'S','C',1428,0,'Exp',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(4,'TOPPER 4.2',1,'U','0',1400,NULL,'Exp',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(5,'MIRROR',2,'S','C',1383,0,'547',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(6,'MIRROR',1,'S','0',1369,0,'216',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(7,'RS TERA PRO',1,'U','0',1364,8,'260',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(8,'TOPPER',1,'U','0',1347,6,'3044',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(9,'RS FEVA XL',2,'S','A',1240,5,'896',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(10,'2.4 M',1,'S','0',1240,0,'Keel',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(11,'SPLASH',1,'U','0',1220,12,'Exp',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(12,'MIRACLE',2,'S','C',1210,0,'689',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(13,'COMET',1,'U','0',1204,4,'1941',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(14,'LASER 4.7',1,'U','0',1200,5,'1511',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(15,'WANDERER',2,'S','C',1180,3,'Exp',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(16,'LIGHTNING 368',1,'U','0',1170,6,'407',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(17,'FIREFLY',2,'S','0',1165,2,'219',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(18,'CHALLENGER',1,'U','0',1160,10,'Cat',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(19,'BRITISH MOTH',1,'U','0',1155,-3,'294',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(20,'BYTE CII',1,'U','0',1147,-1,'1042',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(21,'EUROPE',1,'U','0',1145,0,'402',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(22,'SOLO',1,'U','0',1143,3,'13701',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(23,'LASER RADIAL',1,'U','0',1139,3,'8479',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(24,'GP14',2,'S','C',1133,2,'1866',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(25,'STREAKER',1,'U','0',1132,-5,'4350',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(26,'GRADUATE',2,'S','0',1129,-3,'345',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(27,'RS VISION',2,'S','A',1128,-6,'350',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(28,'RS AERO 5',1,'U','0',1120,13,'Exp',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(29,'ENTERPRISE',2,'S','0',1113,0,'2521',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(30,'420',2,'S','C',1110,5,'306',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(31,'Laser 2000',2,'S','A',1107,6,'1768',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(32,'OK',1,'U','0',1104,1,'527',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(33,'WAYFARER',2,'S','C',1102,-5,'1530',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(34,'LASER',1,'U','0',1097,2,'22963',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(35,'LASER STRATOS',2,'S','A',1095,1,'Exp',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(36,'SNIPE',2,'S','0',1095,7,'Exp',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(37,'COMET TRIO',2,'S','A',1094,8,'Exp',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(38,'SOLUTION',1,'U','0',1087,-3,'436',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(39,'RS VAREO',1,'U','A',1085,14,'648',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(40,'LASER 3000',2,'S','A',1085,11,'Exp',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(41,'SUPERNOVA',1,'U','0',1075,0,'4499',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(42,'LASER VAGO XD',2,'S','A',1074,0,'Exp',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(43,'RS AERO 7',1,'U','0',1071,5,'1350',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(44,'LARK',2,'S','C',1070,0,'514',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(45,'K1',1,'S','0',1068,3,'Keel',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(46,'LASER II',2,'S','C',1065,0,'223',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(47,'NATIONAL 12',2,'S','0',1064,0,'410',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(48,'MEGABYTE',1,'U','0',1060,0,'Exp',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(49,'RS 200',2,'S','A',1047,0,'5088',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(50,'FINN',1,'U','0',1045,3,'827',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(51,'ROOSTER 8.1',1,'U','0',1045,5,'176',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(52,'ALBACORE',2,'S','0',1041,-4,'1934',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(53,'SCORPION',2,'S','C',1040,0,'869',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(54,'KESTREL',2,'S','C',1035,6,'266',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(55,'LASER EPS',1,'U','0',1030,3,'176',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(56,'DEVOTI D-ZERO',1,'U','0',1029,-4,'1755',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(57,'RS AERO 9',1,'U','0',1024,-4,'1081',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(58,'BLAZE',1,'U','0',1023,2,'1023',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(59,'BUZZ',2,'S','A',1023,8,'Exp',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(60,'TASAR',2,'S','0',1015,-8,'556',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(61,'FLYING FIFTEEN',2,'S','C',1015,2,'Keel',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(62,'RS 100 8.4',1,'U','A',1008,4,'521',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(63,'PHANTOM',1,'U','0',999,4,'4873',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(64,'HALO',1,'U','0',992,5,'109',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(65,'MERLIN-ROCKET',2,'S','C',981,-2,'2529',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(66,'RS 100 10.2',1,'U','A',978,0,'193',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(67,'ICON',2,'S','0',976,0,'Exp',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(68,'RS 300',1,'U','0',973,-6,'1449',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(69,'CONTENDER',1,'U','0',970,-6,'1142',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(70,'RS 500',2,'S','A',968,-5,'357',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(71,'HORNET',2,'S','C',962,-1,'134',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(72,'WETA',1,'S','A',960,NULL,'Cat',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(73,'FIREBALL',2,'S','C',959,-5,'2398',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(74,'DEVOTI D-ONE',1,'U','A',953,-5,'321',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(75,'RS 400',2,'S','A',942,-1,'5191',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(76,'OSPREY',2,'S','C',935,-6,'522',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(77,'JAVELIN',2,'S','C',933,0,'Exp',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(78,'SPRINT 15 ',1,'U','0',931,0,'Cat',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(79,'ISO',2,'S','A',922,0,'135',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(80,'VORTEX',1,'U','A',921,-10,'285',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(81,'RS 600',1,'U','0',920,0,'414',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(82,'ALTO',2,'S','A',917,5,'169',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(83,'LASER 4000/ 4000',2,'S','A',917,-3,'242',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(84,'29ER',2,'S','A',915,-4,'387',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(85,'CHERUB',2,'S','A',908,0,'Exp',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(86,'505',2,'S','C',906,-6,'204',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(87,'K6',2,'S','A',905,0,'Keel',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(88,'DART 16',2,'S','0',905,-1,'Cat',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(89,'CATAPULT',1,'U','0',895,5,'Cat',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(90,'SPRINT 15 SPORT ',1,'S','0',894,0,'Cat',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(91,'CANOE INTERNATIONAL',1,'S','0',893,0,'Exp',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(92,'B14',2,'S','A',870,-2,'Exp',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(93,'CANOE INTERNATIONAL Assy',1,'S','A',866,0,'Exp',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(94,'MUSTO SKIFF',1,'U','A',847,0,'578',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(95,'RS 700',1,'U','A',847,-3,'629',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(96,'DART 18',2,'S','0',816,0,'Cat',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(97,'RS 800',2,'S','A',810,-7,'429',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(98,'14 INTERNATIONAL',2,'S','A',765,-15,'Exp',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(99,'SHADOW X',1,'S','A',750,NULL,'Cat',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(100,'49ER',2,'S','A',710,-10,'155',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(101,'SPITFIRE',2,'S','A',705,-7,'Cat',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(102,'HURRICANE 5.9',2,'S','A',698,0,'Cat',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(103,'FORMULA 18',2,'S','A',693,0,'Cat',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48'),
	(104,'A CLASS',1,'U','0',684,0,'Cat',2017,'2017-11-01 17:42:48','2017-11-01 17:42:48');



# Dump of table swclub
# ------------------------------------------------------------


CREATE TABLE `swclub` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `logo` varchar(255) DEFAULT NULL,
  `name` varchar(100) NOT NULL DEFAULT '',
  `description` varchar(200) DEFAULT '',
  `latitude` double DEFAULT NULL,
  `longitude` double DEFAULT NULL,
  `contact` varchar(50) NOT NULL DEFAULT '',
  `contact_no` varchar(12) NOT NULL DEFAULT '',
  `address_line_1` varchar(100) DEFAULT NULL,
  `address_line_2` varchar(100) DEFAULT NULL,
  `town` varchar(100) DEFAULT NULL,
  `postcode` varchar(100) DEFAULT NULL,
  `country` varchar(100) DEFAULT NULL,
  `website` varchar(255) DEFAULT NULL,
  `email` varchar(255) NOT NULL DEFAULT '',
  `no_devices` int(11) NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


INSERT INTO `swclub` (`id`, `logo`, `name`, `description`, `latitude`, `longitude`, `contact`, `contact_no`, `address_line_1`, `address_line_2`, `town`, `postcode`, `country`, `website`, `email`, `no_devices`, `created_at`, `updated_at`)
VALUES
	(1,NULL,'Not Attached','',0,0,'','',' ',' ',' ',' ',' ',NULL,'',0,'2017-10-29 09:54:37','2017-10-29 09:54:37'),
	(2,NULL,'NDYC','NDYC',51.048986,-4.179429,'','',' ',' ',' ',' ',' ',NULL,'',0,'2017-10-29 09:59:50','2017-10-29 09:59:50'),
	(3,NULL,'Poly Steps Quay ','',0,0,'','',' ',' ',' ',' ',' ',NULL,'',0,'2017-10-29 19:10:24','2017-10-29 19:10:24'),
	(4,NULL,' Roadford Lake SC','',0,0,'','',' ',' ',' ',' ',' ',NULL,'',0,'2017-10-29 19:10:46','2017-10-29 19:10:46'),
	(5,NULL,'Exe SC ','',0,0,'','',' ',' ',' ',' ',' ',NULL,'',0,'2017-10-29 19:10:56','2017-10-29 19:10:56'),
	(6,NULL,'Burghfield','',0,0,'','',' ',' ',' ',' ',' ',NULL,'',0,'2017-10-29 19:11:15','2017-10-29 19:11:15'),
	(7,NULL,'Starcross YC','',0,0,'','',' ',' ',' ',' ',' ',NULL,'',0,'2017-10-29 19:11:30','2017-10-29 19:11:30'),
	(8,NULL,'RYA ','',0,0,'','',' ',' ',' ',' ',' ',NULL,'',0,'2017-10-29 19:11:39','2017-10-29 19:11:39'),
	(9,NULL,'Porthpean ','',0,0,'','',' ',' ',' ',' ',' ',NULL,'',0,'2017-10-29 19:11:52','2017-10-29 19:11:52'),
	(10,NULL,'Paignton SC ','',0,0,'','',' ',' ',' ',' ',' ',NULL,'',0,'2017-10-29 19:12:02','2017-10-29 19:12:02'),
	(11,NULL,'BCYC ','',0,0,'','',' ',' ',' ',' ',' ',NULL,'',0,'2017-10-29 19:12:21','2017-10-29 19:12:21'),
	(12,NULL,'Lyme Regis SC ','',0,0,'','',' ',' ',' ',' ',' ',NULL,'',0,'2017-10-29 19:12:37','2017-10-29 19:12:37'),
	(13,NULL,'Bristol Corinthian YC','',0,0,'','',' ',' ',' ',' ',' ',NULL,'',0,'2017-10-29 19:13:02','2017-10-29 19:13:02'),
	(14,NULL,'Tamar SC','',0,0,'','',' ',' ',' ',' ',' ',NULL,'',0,'2017-10-29 19:13:22','2017-10-29 19:13:22'),
	(15,NULL,'Committee ','',0,0,'','',' ',' ',' ',' ',' ',NULL,'',0,'2017-10-29 19:46:17','2017-10-29 19:46:17');



# Dump of table swclubdevices
# ------------------------------------------------------------


CREATE TABLE `swclubdevices` (
  `club_id` int(11) unsigned NOT NULL,
  `device_id` int(11) unsigned NOT NULL,
  PRIMARY KEY (`device_id`,`club_id`),
  KEY `fk_club_id` (`club_id`),
  CONSTRAINT `fk_club_id` FOREIGN KEY (`club_id`) REFERENCES `swclub` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table swcrew
# ------------------------------------------------------------


CREATE TABLE `swcrew` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `firstname` varchar(50) NOT NULL DEFAULT '',
  `lastname` varchar(50) DEFAULT NULL,
  `avatar` varchar(255) DEFAULT NULL,
  `email` varchar(255) DEFAULT NULL,
  `contact_no` varchar(12) DEFAULT NULL,
  `club_id` int(11) unsigned DEFAULT NULL,
  `race_id` int(11) unsigned NOT NULL,
  `boat_id` int(11) unsigned NOT NULL,
  `is_helm` tinyint(1) NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `fk_crew_boat` (`boat_id`),
  KEY `fk_crew_club` (`club_id`),
  KEY `fk_crew_race` (`race_id`),
  CONSTRAINT `fk_crew_boat` FOREIGN KEY (`boat_id`) REFERENCES `swboat` (`id`),
  CONSTRAINT `fk_crew_club` FOREIGN KEY (`club_id`) REFERENCES `swclub` (`id`),
  CONSTRAINT `fk_crew_race` FOREIGN KEY (`race_id`) REFERENCES `swrace` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


INSERT INTO `swcrew` (`id`, `firstname`, `lastname`, `avatar`, `email`, `contact_no`, `club_id`, `race_id`, `boat_id`, `is_helm`, `created_at`, `updated_at`)
VALUES
	(2,'Ben ','Flower',NULL,NULL,NULL,3,1,3,1,'2017-10-30 20:15:43','2017-10-30 20:15:43'),
	(3,'Paul','Tatum',NULL,NULL,NULL,2,1,4,1,'2017-11-03 01:54:43','2017-11-03 01:54:43'),
	(4,'Iain','Horlock',NULL,NULL,NULL,5,1,8,1,'2017-11-03 01:55:32','2017-11-03 01:55:32'),
	(5,'Charlotte ','Horlock',NULL,NULL,NULL,5,1,8,0,'2017-11-03 01:55:53','2017-11-03 01:55:53'),
	(6,' Ed','Bremmer',NULL,NULL,NULL,4,1,5,1,'2017-11-03 01:58:06','2017-11-03 01:58:06'),
	(7,' Dave','Barker',NULL,NULL,NULL,2,1,7,1,'2017-11-03 06:05:04','2017-11-03 06:05:04'),
	(8,'Mike','Bell',NULL,NULL,NULL,6,1,9,1,'2017-11-03 06:05:51','2017-11-03 06:05:51'),
	(9,'Simon','Hawkes',NULL,NULL,NULL,7,1,12,1,'2017-11-03 06:07:09','2017-11-03 06:07:09'),
	(10,'Peter','Smith',NULL,NULL,NULL,2,1,13,1,'2017-11-03 06:07:36','2017-11-03 06:07:36'),
	(11,'Chris','Hampe',NULL,NULL,NULL,8,1,14,1,'2017-11-03 06:08:36','2017-11-03 06:08:36'),
	(12,'Howard','Stone',NULL,NULL,NULL,2,1,13,0,'2017-11-03 06:08:56','2017-11-03 06:08:56'),
	(13,'Stacey','Bray',NULL,NULL,NULL,9,1,15,1,'2017-11-03 06:09:27','2017-11-03 06:09:27'),
	(14,'Hector','Bunclark',NULL,NULL,NULL,2,1,16,1,'2017-11-03 06:10:00','2017-11-03 06:10:00'),
	(15,'Daniel','Craner',NULL,NULL,NULL,2,1,16,0,'2017-11-03 06:10:21','2017-11-03 06:10:21'),
	(16,'Jon','Ireonmonger',NULL,NULL,NULL,2,1,17,1,'2017-11-03 06:10:45','2017-11-03 06:10:45'),
	(17,'Matthew','Brittan',NULL,NULL,NULL,2,1,18,1,'2017-11-03 06:11:05','2017-11-03 06:11:05'),
	(18,'Dominic','Britton',NULL,NULL,NULL,2,1,18,0,'2017-11-03 06:11:28','2017-11-03 06:11:28'),
	(19,'Nick','Ripley',NULL,NULL,NULL,10,1,19,1,'2017-11-03 06:11:55','2017-11-03 06:11:55'),
	(20,'Stan','Pyle',NULL,NULL,NULL,2,1,20,1,'2017-11-03 06:12:22','2017-11-03 06:12:22'),
	(21,'Ben','Blake',NULL,NULL,NULL,2,1,20,0,'2017-11-03 06:12:36','2017-11-03 06:12:36'),
	(22,'Richard','Willows',NULL,NULL,NULL,4,1,21,1,'2017-11-03 06:13:14','2017-11-03 06:13:14'),
	(23,'Tom','Lewis',NULL,NULL,NULL,2,1,22,1,'2017-11-03 06:13:33','2017-11-03 06:13:33'),
	(24,'Richard','Chidwick',NULL,NULL,NULL,2,1,23,1,'2017-11-03 06:13:56','2017-11-03 06:13:56'),
	(25,'Philip','Coles',NULL,NULL,NULL,2,1,24,1,'2017-11-03 06:14:34','2017-11-03 06:14:34'),
	(26,'Amy','Barker',NULL,NULL,NULL,2,1,25,1,'2017-11-03 06:14:56','2017-11-03 06:14:56'),
	(27,'Matt','Hill',NULL,NULL,NULL,2,1,26,1,'2017-11-03 06:15:29','2017-11-03 06:15:29'),
	(28,'Ed','Sylvester',NULL,NULL,NULL,2,1,26,0,'2017-11-03 06:15:42','2017-11-03 06:15:42'),
	(29,'Frazer','Manning',NULL,NULL,NULL,2,1,27,1,'2017-11-03 06:16:00','2017-11-03 06:16:00'),
	(30,'David','Grant',NULL,NULL,NULL,2,1,27,0,'2017-11-03 06:16:21','2017-11-03 06:16:21'),
	(31,'Matt','Muir',NULL,NULL,NULL,2,1,28,1,'2017-11-03 06:16:54','2017-11-03 06:16:54'),
	(32,'Angus','Cook',NULL,NULL,NULL,2,1,29,1,'2017-11-03 06:17:49','2017-11-03 06:17:49'),
	(33,'Alfie','Cook',NULL,NULL,NULL,2,1,29,0,'2017-11-03 06:18:11','2017-11-03 06:18:11'),
	(34,'Anthony','Gray',NULL,NULL,NULL,2,1,30,1,'2017-11-03 06:18:46','2017-11-03 06:18:46'),
	(35,'J','Gray',NULL,NULL,NULL,2,1,30,0,'2017-11-03 06:19:01','2017-11-03 06:19:01'),
	(36,'Alex','Raymount',NULL,NULL,NULL,2,1,31,1,'2017-11-03 06:19:20','2017-11-03 06:19:20'),
	(37,'Paul','Bartlett',NULL,NULL,NULL,7,1,32,1,'2017-11-03 06:19:44','2017-11-03 06:19:44'),
	(38,'Nicki','Bartlett',NULL,NULL,NULL,7,1,32,0,'2017-11-03 06:20:03','2017-11-03 06:20:03'),
	(39,'Richard','Cain',NULL,NULL,NULL,7,1,33,1,'2017-11-03 06:20:39','2017-11-03 06:20:39'),
	(40,'Barney','Dearsly',NULL,NULL,NULL,7,1,33,0,'2017-11-03 06:21:04','2017-11-03 06:21:04'),
	(41,'Eric','Evans',NULL,NULL,NULL,2,1,34,1,'2017-11-03 06:21:25','2017-11-03 06:21:25'),
	(42,'Ian','Mairs',NULL,NULL,NULL,11,1,35,1,'2017-11-03 06:22:06','2017-11-03 06:22:06'),
	(43,'Tim','Parsons',NULL,NULL,NULL,12,1,36,1,'2017-11-03 06:22:28','2017-11-03 06:22:28'),
	(44,'Steve','Bolland',NULL,NULL,NULL,13,1,37,1,'2017-11-03 06:22:57','2017-11-03 06:22:57'),
	(45,'Jon','Turner',NULL,NULL,NULL,12,1,38,1,'2017-11-03 06:23:20','2017-11-03 06:23:20'),
	(46,'Katie','Prost',NULL,NULL,NULL,12,1,38,0,'2017-11-03 06:23:36','2017-11-03 06:23:36'),
	(47,'Emily','Lewis',NULL,NULL,NULL,2,1,39,1,'2017-11-03 06:24:05','2017-11-03 06:24:05'),
	(48,'Esme','Mistrick',NULL,NULL,NULL,2,1,39,0,'2017-11-03 06:24:27','2017-11-03 06:24:27'),
	(49,'John','Craddock',NULL,NULL,NULL,14,1,40,1,'2017-11-03 06:24:50','2017-11-03 06:24:50'),
	(50,'Jake','Craddock',NULL,NULL,NULL,14,1,40,0,'2017-11-03 06:25:15','2017-11-03 06:25:15'),
	(51,'Jonathan','Kiliam',NULL,NULL,NULL,2,1,41,1,'2017-11-03 06:25:35','2017-11-03 06:25:35'),
	(52,'Liam','Blunclark',NULL,NULL,NULL,2,1,42,1,'2017-11-03 06:26:06','2017-11-03 06:26:06'),
	(53,'Ken','Heason',NULL,NULL,NULL,2,1,43,1,'2017-11-03 06:26:26','2017-11-03 06:26:26'),
	(54,'Tim','Cobby',NULL,NULL,NULL,2,1,44,1,'2017-11-03 06:26:45','2017-11-03 06:26:45'),
	(55,'Emma','Cobby',NULL,NULL,NULL,2,1,44,0,'2017-11-03 06:26:58','2017-11-03 06:26:58'),
	(56,'M','Selter',NULL,NULL,NULL,2,1,45,1,'2017-11-03 06:27:16','2017-11-03 06:27:16'),
	(57,'Sam','Heaton',NULL,NULL,NULL,2,1,46,1,'2017-11-03 06:27:35','2017-11-03 06:27:35'),
	(58,'Marc','Croner',NULL,NULL,NULL,2,1,47,1,'2017-11-03 06:28:00','2017-11-03 06:28:00'),
	(59,'Harry','Gose',NULL,NULL,NULL,2,1,47,0,'2017-11-03 06:28:15','2017-11-03 06:28:15');



# Dump of table swdeviceboatraceclub
# ------------------------------------------------------------


CREATE TABLE `swdeviceboatraceclub` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `device_id` int(11) unsigned NOT NULL,
  `device_name` varchar(128) NOT NULL DEFAULT '',
  `boat_id` int(11) unsigned NOT NULL,
  `sail_no` varchar(20) NOT NULL DEFAULT '',
  `race_id` int(11) unsigned NOT NULL,
  `club_id` int(11) unsigned NOT NULL,
  `handicap_id` int(11) unsigned NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `fk_boat_dbrc` (`boat_id`),
  KEY `fk_race_dbrc` (`race_id`),
  KEY `fk_club_dbrc` (`club_id`),
  CONSTRAINT `fk_boat_dbrc` FOREIGN KEY (`boat_id`) REFERENCES `swboat` (`id`),
  CONSTRAINT `fk_club_dbrc` FOREIGN KEY (`club_id`) REFERENCES `swclub` (`id`),
  CONSTRAINT `fk_race_dbrc` FOREIGN KEY (`race_id`) REFERENCES `swrace` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


INSERT INTO `swdeviceboatraceclub` (`id`, `device_id`, `device_name`, `boat_id`, `sail_no`, `race_id`, `club_id`, `handicap_id`, `created_at`, `updated_at`)
VALUES
	(2,7,'SSW 1',3,'213126',1,3,1,'2017-10-29 19:25:48','2017-10-29 19:25:48'),
	(3,9,'SSW 2',4,'828',1,2,1,'2017-10-29 19:29:04','2017-10-29 19:29:04'),
	(4,10,'SSW 4',5,'314',1,4,1,'2017-10-29 19:30:11','2017-10-29 19:30:11'),
	(7,5,'SSW 5',7,'WA2',1,2,1,'2017-10-29 21:21:38','2017-10-29 21:21:38'),
	(8,6,'SSW 6',8,'1280',1,5,1,'2017-10-29 21:22:35','2017-10-29 21:22:35'),
	(9,16,'SSW 7',9,'807',1,6,1,'2017-10-30 18:52:24','2017-10-30 18:52:24'),
	(11,14,'SSW 8',12,'1454',1,7,1,'2017-10-30 19:47:59','2017-10-30 19:47:59'),
	(12,15,'SSW 9',13,'1886',1,2,1,'2017-10-30 19:48:34','2017-10-30 19:48:34'),
	(13,13,'SSW 10',14,'340',1,8,1,'2017-10-30 19:49:05','2017-10-30 19:49:05'),
	(14,12,'SSW 11',15,'260',1,9,1,'2017-10-30 19:57:50','2017-10-30 19:57:50'),
	(15,11,'SSW 12',16,'7442',1,2,1,'2017-10-30 19:58:20','2017-10-30 19:58:20'),
	(16,71,'SSW 13',17,'823',1,2,1,'2017-10-30 19:59:34','2017-10-30 19:59:34'),
	(17,69,'SSW 14',18,'3',1,2,1,'2017-10-30 20:00:00','2017-10-30 20:00:00'),
	(18,70,'SSW 15',19,'710',1,10,1,'2017-10-30 20:00:31','2017-10-30 20:00:31'),
	(19,73,'SSW 17',20,'62',1,2,1,'2017-10-30 20:01:01','2017-10-30 20:01:01'),
	(20,74,'SSW 18',21,'2104',1,4,1,'2017-10-30 20:01:41','2017-10-30 20:01:41'),
	(21,75,'SSW 19',22,'151242',1,2,1,'2017-10-30 20:02:13','2017-10-30 20:02:13'),
	(22,76,'SSW 20',23,'1545',1,2,1,'2017-10-30 20:02:43','2017-10-30 20:02:43'),
	(23,4,'SSW 21',24,'1111',1,2,1,'2017-10-30 20:03:00','2017-10-30 20:03:00'),
	(24,3,'SSW 22',25,'159397',1,2,1,'2017-10-30 20:03:26','2017-10-30 20:03:26'),
	(25,43,'SSW 50',26,'546',1,2,1,'2017-10-30 20:03:56','2017-10-30 20:03:56'),
	(26,44,'SSW 51',27,'7942',1,2,1,'2017-10-30 20:04:24','2017-10-30 20:04:24'),
	(27,45,'SSW 52',28,'211',1,2,1,'2017-10-30 20:04:47','2017-10-30 20:04:47'),
	(28,46,'SSW 53',29,'21',1,2,1,'2017-10-30 20:05:12','2017-10-30 20:05:12'),
	(29,47,'SSW 54',30,'6544',1,2,1,'2017-10-30 20:05:35','2017-10-30 20:05:35'),
	(30,48,'SSW 55',31,'525',1,2,1,'2017-10-30 20:05:58','2017-10-30 20:05:58'),
	(31,49,'SSW  56',32,'18',1,7,1,'2017-10-30 20:06:22','2017-10-30 20:06:22'),
	(32,50,'SSW 57',33,'411',1,7,1,'2017-10-30 20:06:48','2017-10-30 20:06:48'),
	(33,51,'SSW 58',34,'713',1,2,1,'2017-10-30 20:07:08','2017-10-30 20:07:08'),
	(34,52,'SSW 59',35,'508',1,11,1,'2017-10-30 20:07:32','2017-10-30 20:07:32'),
	(35,53,'SSW 60',36,'2041',1,12,1,'2017-10-30 20:07:58','2017-10-30 20:07:58'),
	(36,54,'SSW 61',37,'11',1,13,1,'2017-10-30 20:08:32','2017-10-30 20:08:32'),
	(37,55,'SSW 62',38,'3774',1,12,1,'2017-10-30 20:09:01','2017-10-30 20:09:01'),
	(38,56,'SSW 63',39,'',1,2,1,'2017-10-30 20:09:23','2017-10-30 20:09:23'),
	(39,57,'SSW 64',40,'181',1,14,1,'2017-10-30 20:09:55','2017-10-30 20:09:55'),
	(40,58,'SSW 65',41,'1929',1,2,1,'2017-10-30 20:10:30','2017-10-30 20:10:30'),
	(41,61,'SSW 68',42,'1849',1,2,1,'2017-10-30 20:10:55','2017-10-30 20:10:55'),
	(42,62,'SSW 69',43,'1424',1,2,1,'2017-10-30 20:11:20','2017-10-30 20:11:20'),
	(43,63,'SSW 70',44,'7480',1,2,1,'2017-10-30 20:11:47','2017-10-30 20:11:47'),
	(44,64,'SSW 71',45,'7',1,2,1,'2017-10-30 20:12:08','2017-10-30 20:12:08'),
	(45,65,'SSW 72',46,'1972',1,2,1,'2017-10-30 20:12:34','2017-10-30 20:12:34'),
	(46,66,'SSW 73',47,'5951',1,2,1,'2017-10-30 20:12:57','2017-10-30 20:12:57');



# Dump of table swevent
# ------------------------------------------------------------


CREATE TABLE `swevent` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `club_id` int(11) unsigned NOT NULL,
  `event_type_id` int(11) unsigned NOT NULL DEFAULT '1',
  `restricted` tinyint(1) NOT NULL DEFAULT '0',
  `name` varchar(100) NOT NULL DEFAULT '',
  `description` text,
  `latitude` double NOT NULL,
  `longitude` double NOT NULL,
  `start_datetime` datetime NOT NULL,
  `end_datetime` datetime NOT NULL,
  `cover_image` varchar(255) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `fk_evt_club` (`club_id`),
  KEY `fk_evt_type` (`event_type_id`),
  CONSTRAINT `fk_evt_club` FOREIGN KEY (`club_id`) REFERENCES `swclub` (`id`),
  CONSTRAINT `fk_evt_type` FOREIGN KEY (`event_type_id`) REFERENCES `sweventtype` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


INSERT INTO `swevent` (`id`, `club_id`, `event_type_id`, `restricted`, `name`, `description`, `latitude`, `longitude`, `start_datetime`, `end_datetime`, `cover_image`, `created_at`, `updated_at`)
VALUES
	(2,2,2,0,'The Gul Wrecker Event','The Gul Wrecker event ',51.058815,-4.195776,'2017-10-29 10:00:00','2017-10-29 10:00:00',NULL,'2017-10-29 09:55:16','2017-10-29 09:55:16');



# Dump of table sweventtype
# ------------------------------------------------------------


CREATE TABLE `sweventtype` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL DEFAULT '',
  `description` varchar(200) DEFAULT NULL,
  `allow_restriction` tinyint(1) NOT NULL DEFAULT '0',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


INSERT INTO `sweventtype` (`id`, `name`, `description`, `allow_restriction`, `created_at`, `updated_at`)
VALUES
	(1,'Open Event','An open event',0,'2017-10-18 21:56:18','2017-10-19 07:44:06'),
	(2,'Club Event',NULL,1,'2017-10-18 21:56:26','2017-10-19 07:44:06');



# Dump of table swhandicap
# ------------------------------------------------------------


CREATE TABLE `swhandicap` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `type_id` int(11) unsigned NOT NULL,
  `value` varchar(10) NOT NULL DEFAULT '',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `fk_hand_type` (`type_id`),
  CONSTRAINT `fk_hand_type` FOREIGN KEY (`type_id`) REFERENCES `swhandicaptype` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table swhandicaptype
# ------------------------------------------------------------


CREATE TABLE `swhandicaptype` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL DEFAULT '',
  `decsription` text,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


INSERT INTO `swhandicaptype` (`id`, `name`, `decsription`, `created_at`, `updated_at`)
VALUES
	(1,'Plymouth Yardstick',NULL,'2017-10-26 23:42:26','2017-10-26 23:42:26'),
	(2,'IRC',NULL,'2017-10-26 23:42:39','2017-10-26 23:42:39'),
	(3,'MOCRA',NULL,'2017-10-26 23:43:06','2017-10-26 23:43:30'),
	(4,'IMS',NULL,'2017-10-26 23:45:00','2017-10-26 23:45:00');



# Dump of table swline
# ------------------------------------------------------------


CREATE TABLE `swline` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `race_id` int(11) unsigned NOT NULL,
  `start_line` text NOT NULL,
  `start_color` varchar(9) NOT NULL DEFAULT '',
  `finish_line` text,
  `finish_color` varchar(9) DEFAULT NULL,
  `handicap_id` int(11) unsigned NOT NULL DEFAULT '1',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `fk_race_line` (`race_id`),
  KEY `fk_hand_line` (`handicap_id`),
  CONSTRAINT `fk_hand_line` FOREIGN KEY (`handicap_id`) REFERENCES `swhandicap` (`id`),
  CONSTRAINT `fk_race_line` FOREIGN KEY (`race_id`) REFERENCES `swrace` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table swplayback
# ------------------------------------------------------------


CREATE TABLE `swplayback` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `state_id` int(11) unsigned NOT NULL,
  `race_id` int(11) unsigned NOT NULL,
  `play_back_speed` int(11) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`),
  KEY `fk_play_state` (`state_id`),
  KEY `fk_play_race` (`race_id`),
  CONSTRAINT `fk_play_race` FOREIGN KEY (`race_id`) REFERENCES `swrace` (`id`),
  CONSTRAINT `fk_play_state` FOREIGN KEY (`state_id`) REFERENCES `swplaybackstate` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table swplaybackstate
# ------------------------------------------------------------


CREATE TABLE `swplaybackstate` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(30) NOT NULL DEFAULT '',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


INSERT INTO `swplaybackstate` (`id`, `name`, `created_at`, `updated_at`)
VALUES
	(1,'PAUSED','2017-11-01 07:18:26','2017-11-01 07:18:26'),
	(2,'STOPPED','2017-11-01 07:18:37','2017-11-01 07:18:37'),
	(3,'PLAYING','2017-11-01 07:18:43','2017-11-01 07:18:43');



# Dump of table swrace
# ------------------------------------------------------------


CREATE TABLE `swrace` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `event_id` int(11) unsigned DEFAULT NULL,
  `race_type_id` int(11) unsigned NOT NULL DEFAULT '1',
  `name` varchar(100) NOT NULL DEFAULT '',
  `description` varchar(200) DEFAULT NULL,
  `cover_image` varchar(255) DEFAULT NULL,
  `start_datetime` datetime NOT NULL,
  `end_datetime` datetime NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `fk_race_event` (`event_id`),
  KEY `fk_race_type` (`race_type_id`),
  CONSTRAINT `fk_race_event` FOREIGN KEY (`event_id`) REFERENCES `swevent` (`id`),
  CONSTRAINT `fk_race_type` FOREIGN KEY (`race_type_id`) REFERENCES `swracetype` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


INSERT INTO `swrace` (`id`, `event_id`, `race_type_id`, `name`, `description`, `cover_image`, `start_datetime`, `end_datetime`, `created_at`, `updated_at`)
VALUES
	(1,2,1,'The Gul Wrecker','The Gul Wrecker race','imgs/racecovers/gul_wrecker.jpg','2017-10-29 11:00:00','2017-10-29 13:00:00','2017-10-29 09:56:20','2017-10-29 09:56:20');



# Dump of table swraceboatclass
# ------------------------------------------------------------


CREATE TABLE `swraceboatclass` (
  `race_id` int(11) unsigned NOT NULL,
  `boat_class_id` int(11) unsigned NOT NULL,
  PRIMARY KEY (`race_id`,`boat_class_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


INSERT INTO `swraceboatclass` (`race_id`, `boat_class_id`)
VALUES
	(1,8),
	(1,9),
	(1,13),
	(1,14),
	(1,17),
	(1,22),
	(1,23),
	(1,24),
	(1,25),
	(1,28),
	(1,29),
	(1,30),
	(1,31),
	(1,33),
	(1,34),
	(1,37),
	(1,39),
	(1,40),
	(1,41),
	(1,43),
	(1,44),
	(1,45),
	(1,46),
	(1,47),
	(1,49),
	(1,50),
	(1,51),
	(1,52),
	(1,53),
	(1,54),
	(1,56),
	(1,57),
	(1,58),
	(1,59),
	(1,60),
	(1,62),
	(1,63),
	(1,64),
	(1,65),
	(1,66),
	(1,67),
	(1,68),
	(1,69),
	(1,70),
	(1,71),
	(1,73),
	(1,74),
	(1,75),
	(1,76),
	(1,77),
	(1,78),
	(1,79),
	(1,81),
	(1,82),
	(1,83),
	(1,84),
	(1,86),
	(1,90),
	(1,91),
	(1,92),
	(1,93),
	(1,94),
	(1,95),
	(1,96),
	(1,97),
	(1,98),
	(1,99);



# Dump of table swraceofficals
# ------------------------------------------------------------


CREATE TABLE `swraceofficals` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(50) DEFAULT NULL,
  `race_id` int(11) unsigned NOT NULL,
  `device_id` int(11) unsigned NOT NULL,
  `color` varchar(9) NOT NULL DEFAULT '',
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



# Dump of table swracetype
# ------------------------------------------------------------


CREATE TABLE `swracetype` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL DEFAULT '',
  `description` varchar(200) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


INSERT INTO `swracetype` (`id`, `name`, `description`, `created_at`, `updated_at`)
VALUES
	(1,' Pursuit',NULL,'2017-10-29 20:07:01','2017-10-29 20:07:01');




# Dump of table swsponsor
# ------------------------------------------------------------


CREATE TABLE `swsponsor` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL DEFAULT '',
  `logo` varchar(255) NOT NULL DEFAULT '',
  `website` varchar(255) NOT NULL DEFAULT '',
  `email` varchar(255) DEFAULT NULL,
  `contact_name` varchar(200) NOT NULL DEFAULT '',
  `contact_no` varchar(12) DEFAULT NULL,
  `short_description` varchar(255) NOT NULL DEFAULT '',
  `long_description` text,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


INSERT INTO `swsponsor` (`id`, `name`, `logo`, `website`, `email`, `contact_name`, `contact_no`, `short_description`, `long_description`, `created_at`, `updated_at`)
VALUES
	(1,'Sailing SW','imgs/logos/sailingsw.png','',NULL,'',NULL,'',NULL,'2017-10-29 10:04:57','2017-10-29 10:04:57');



# Dump of table swsponsorsevent
# ------------------------------------------------------------


CREATE TABLE `swsponsorsevent` (
  `sponsor_id` int(11) unsigned NOT NULL,
  `event_id` int(11) unsigned NOT NULL,
  PRIMARY KEY (`sponsor_id`,`event_id`),
  KEY `fk_evt_evt` (`event_id`),
  CONSTRAINT `fk_evt_evt` FOREIGN KEY (`event_id`) REFERENCES `swevent` (`id`),
  CONSTRAINT `fk_sp_evt` FOREIGN KEY (`sponsor_id`) REFERENCES `swsponsor` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


INSERT INTO `swsponsorsevent` (`sponsor_id`, `event_id`)
VALUES
	(1,2);



# Dump of table swsponsorsraces
# ------------------------------------------------------------


CREATE TABLE `swsponsorsraces` (
  `sponsor_id` int(11) unsigned NOT NULL,
  `race_id` int(11) unsigned NOT NULL,
  PRIMARY KEY (`sponsor_id`,`race_id`),
  KEY `fk_sp_race` (`race_id`),
  CONSTRAINT `fk_sp_race` FOREIGN KEY (`sponsor_id`) REFERENCES `swsponsor` (`id`),
  CONSTRAINT `fk_sp_race_race` FOREIGN KEY (`race_id`) REFERENCES `swrace` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


INSERT INTO `swsponsorsraces` (`sponsor_id`, `race_id`)
VALUES
	(1,1);




