]> git.mxchange.org Git - pizzaservice-war.git/blob - install/install.sql
Added missing init() method + renamed localInit() -> genericInit()
[pizzaservice-war.git] / install / install.sql
1 DROP TABLE IF EXISTS `category`;
2 CREATE TABLE IF NOT EXISTS `category` (
3 `id` bigint(20) unsigned NOT NULL COMMENT 'Primary key',
4   `title` varchar(255) NOT NULL COMMENT 'Category title',
5   `parent` bigint(20) unsigned DEFAULT NULL COMMENT 'Parent category',
6   PRIMARY KEY (`id`),
7   INDEX `parent` (`parent`)
8 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COMMENT='Categories' ;
9
10 DROP TABLE IF EXISTS `contacts`;
11 CREATE TABLE IF NOT EXISTS `contacts` (
12 `id` bigint(20) unsigned NOT NULL COMMENT 'Primary key',
13   `own_contact` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Whether own contact',
14   `gender` varchar(10) NOT NULL DEFAULT 'UNKNOWN' COMMENT 'Gender',
15   `first_name` varchar(100) NOT NULL COMMENT 'First name',
16   `family_name` varchar(100) NOT NULL COMMENT 'Family name',
17   `company_name` varchar(255) DEFAULT NULL COMMENT 'Company name',
18   `street` varchar(255) DEFAULT NULL COMMENT 'Street name',
19   `house_number` smallint(5) unsigned DEFAULT NULL COMMENT 'House number',
20   `city` varchar(100) DEFAULT NULL COMMENT 'City name',
21   `zip_code` smallint(5) unsigned DEFAULT NULL COMMENT 'ZIP code',
22   `country_code` char(2) DEFAULT NULL COMMENT 'Country code',
23   `phone_number` varchar(100) DEFAULT NULL COMMENT 'Phone number',
24   `cellphone_number` varchar(100) DEFAULT NULL COMMENT 'Cellphone number',
25   `fax_number` varchar(100) DEFAULT NULL COMMENT 'Fax number',
26   `email_address` varchar(100) DEFAULT NULL COMMENT 'Email addres',
27   `birthday` date DEFAULT NULL COMMENT 'Birth day',
28   `comment` tinytext NOT NULL COMMENT 'Comment',
29   `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Entry created',
30   `updated` timestamp NULL DEFAULT NULL COMMENT 'Entry updated',
31   PRIMARY KEY (`id`)
32 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COMMENT='Contacts data' ;
33
34 DROP TABLE IF EXISTS `products`;
35 CREATE TABLE IF NOT EXISTS `products` (
36 `id` bigint(20) unsigned NOT NULL COMMENT 'Primary key',
37   `category` bigint(20) unsigned DEFAULT NULL COMMENT 'Category id',
38   `title` varchar(255) NOT NULL COMMENT 'Title of product',
39   `price` decimal(20,2) unsigned NOT NULL COMMENT 'Product price',
40   `available` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Whether product is available',
41   PRIMARY KEY (`id`),
42   INDEX `category` (`category`)
43 ) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COMMENT='Products' ;
44
45 ALTER TABLE `category`
46 MODIFY `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Primary key';
47
48 ALTER TABLE `contacts`
49 MODIFY `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Primary key';
50
51 ALTER TABLE `products`
52 MODIFY `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Primary key';