From f3ce3aa8769008ee930ace361ac7302a01c24a21 Mon Sep 17 00:00:00 2001 From: n3vrax Date: Wed, 3 May 2017 02:01:03 +0300 Subject: [PATCH] updated dependencies, sql schema --- composer.json | 6 +- data/admin+frontend.sql | 159 ++++++++++++++-------------------------- 2 files changed, 57 insertions(+), 108 deletions(-) diff --git a/composer.json b/composer.json index c303842..4c1fb84 100644 --- a/composer.json +++ b/composer.json @@ -35,14 +35,14 @@ "dotkernel/dot-authentication-service": "^0.2", "dotkernel/dot-authentication-web": "^0.2", "dotkernel/dot-cache": "^1.1", - "dotkernel/dot-controller": "^0.2", + "dotkernel/dot-controller": "^0.3", "dotkernel/dot-controller-plugin-flashmessenger": "^0.2", "dotkernel/dot-controller-plugin-authentication": "^0.2", "dotkernel/dot-controller-plugin-authorization": "^0.2", "dotkernel/dot-controller-plugin-forms": "^0.2", "dotkernel/dot-controller-plugin-mail": "^0.1", "dotkernel/dot-controller-plugin-session": "^0.2", - "dotkernel/dot-mapper": "^0.3", + "dotkernel/dot-mapper": "^0.4", "dotkernel/dot-event": "^0.2", "dotkernel/dot-filter": "^1.1", "dotkernel/dot-flashmessenger": "^0.2", @@ -58,7 +58,7 @@ "dotkernel/dot-rbac-guard": "^0.2", "dotkernel/dot-session": "^2.0", "dotkernel/dot-twigrenderer": "^0.2", - "dotkernel/dot-user": "^0.2", + "dotkernel/dot-user": "^0.3", "dotkernel/dot-validator": "^1.1" }, "require-dev": { diff --git a/data/admin+frontend.sql b/data/admin+frontend.sql index 9ad0eff..1c62af6 100644 --- a/data/admin+frontend.sql +++ b/data/admin+frontend.sql @@ -4,159 +4,108 @@ -- Table structure for table `user` -- -CREATE TABLE `user` ( - `id` int(11) NOT NULL, +CREATE TABLE IF NOT EXISTS `user` ( + `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(150) DEFAULT NULL, `email` varchar(150) NOT NULL, `password` varchar(150) NOT NULL, `status` enum('pending','active','inactive','deleted') NOT NULL DEFAULT 'pending', - `dateCreated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + `dateCreated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `email` (`email`), + UNIQUE KEY `username` (`username`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4; --- -------------------------------------------------------- -- -- Table structure for table `user_details` -- -CREATE TABLE `user_details` ( +CREATE TABLE IF NOT EXISTS `user_details` ( `userId` int(11) NOT NULL, `firstName` varchar(150) DEFAULT NULL, `lastName` varchar(150) DEFAULT NULL, `phone` varchar(150) DEFAULT NULL, - `address` text + `address` text, + PRIMARY KEY (`userId`), + CONSTRAINT `user_details_ibfk_1` FOREIGN KEY (`userId`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; --- -------------------------------------------------------- + +-- +-- Table structure for table `user_message` +-- + +CREATE TABLE IF NOT EXISTS `user_message` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `email` varchar(150) NOT NULL, + `name` text NOT NULL, + `subject` text NOT NULL, + `message` text NOT NULL, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4; + -- -- Table structure for table `user_role` -- -CREATE TABLE `user_role` ( - `id` int(11) NOT NULL, - `name` varchar(150) NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +CREATE TABLE IF NOT EXISTS `user_role` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(150) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `name` (`name`) +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `user_role` -- -INSERT INTO `user_role` (`id`, `name`) VALUES -(1, 'user'), -(2, 'subscriber'); +LOCK TABLES `user_role` WRITE; +/*!40000 ALTER TABLE `user_role` DISABLE KEYS */; +INSERT INTO `user_role` VALUES (2,'subscriber'),(1,'user'); +/*!40000 ALTER TABLE `user_role` ENABLE KEYS */; +UNLOCK TABLES; --- -------------------------------------------------------- -- -- Table structure for table `user_roles` -- -CREATE TABLE `user_roles` ( +CREATE TABLE IF NOT EXISTS `user_roles` ( `userId` int(11) NOT NULL, - `roleId` int(11) NOT NULL + `roleId` int(11) NOT NULL, + PRIMARY KEY (`userId`,`roleId`), + KEY `userId` (`userId`), + KEY `roleId` (`roleId`), + CONSTRAINT `user_roles_ibfk_1` FOREIGN KEY (`userId`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `user_roles_ibfk_2` FOREIGN KEY (`roleId`) REFERENCES `user_role` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; --- -------------------------------------------------------- -- -- Table structure for table `user_token` -- -CREATE TABLE `user_token` ( - `id` int(11) NOT NULL, +CREATE TABLE IF NOT EXISTS `user_token` ( + `id` int(11) NOT NULL AUTO_INCREMENT, `userId` int(11) NOT NULL, `selector` varchar(150) DEFAULT NULL, `token` varchar(150) NOT NULL, `expire` int(11) DEFAULT NULL, `type` enum('confirm','reset','remember') NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; - --- --- Indexes for dumped tables --- - --- --- Indexes for table `user` --- -ALTER TABLE `user` - ADD PRIMARY KEY (`id`), - ADD UNIQUE KEY `email` (`email`), - ADD UNIQUE KEY `username` (`username`); + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + KEY `userId` (`userId`), + KEY `selector` (`selector`), + KEY `token` (`token`), + CONSTRAINT `user_token_ibfk_1` FOREIGN KEY (`userId`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4; --- --- Indexes for table `user_details` --- -ALTER TABLE `user_details` - ADD PRIMARY KEY (`userId`); - --- --- Indexes for table `user_role` --- -ALTER TABLE `user_role` - ADD PRIMARY KEY (`id`), - ADD UNIQUE KEY `name` (`name`); --- --- Indexes for table `user_roles` --- -ALTER TABLE `user_roles` - ADD PRIMARY KEY (`userId`,`roleId`), - ADD KEY `userId` (`userId`), - ADD KEY `roleId` (`roleId`); - --- --- Indexes for table `user_token` --- -ALTER TABLE `user_token` - ADD PRIMARY KEY (`id`), - ADD KEY `userId` (`userId`), - ADD KEY `selector` (`selector`), - ADD KEY `token` (`token`); - --- --- AUTO_INCREMENT for dumped tables --- - --- --- AUTO_INCREMENT for table `user` --- -ALTER TABLE `user` - MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1; --- --- AUTO_INCREMENT for table `user_role` --- -ALTER TABLE `user_role` - MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; --- --- AUTO_INCREMENT for table `user_token` --- -ALTER TABLE `user_token` - MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1; --- --- Constraints for dumped tables --- - --- --- Constraints for table `user_details` --- -ALTER TABLE `user_details` - ADD CONSTRAINT `user_details_ibfk_1` FOREIGN KEY (`userId`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; - --- --- Constraints for table `user_roles` --- -ALTER TABLE `user_roles` - ADD CONSTRAINT `user_roles_ibfk_2` FOREIGN KEY (`roleId`) REFERENCES `user_role` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - ADD CONSTRAINT `user_roles_ibfk_1` FOREIGN KEY (`userId`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; - --- --- Constraints for table `user_token` --- -ALTER TABLE `user_token` - ADD CONSTRAINT `user_token_ibfk_1` FOREIGN KEY (`userId`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; +--********************************************************* -- DOT_ADMIN EXPORT --