create manager adding form
This commit is contained in:
parent
fcc1f608ed
commit
22073b71e1
BIN
lab1/Lab1.mdzip
Normal file
BIN
lab1/Lab1.mdzip
Normal file
Binary file not shown.
481
lab1/Lab1.sql
Normal file
481
lab1/Lab1.sql
Normal file
@ -0,0 +1,481 @@
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
START TRANSACTION;
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8mb4 */;
|
||||
|
||||
|
||||
CREATE TABLE `factory` (
|
||||
`ID` int(11) NOT NULL,
|
||||
`NAME` varchar(255) NOT NULL,
|
||||
`LOCATION` varchar(255) NOT NULL,
|
||||
`FLOOR_SIZE` float NOT NULL,
|
||||
`FK_MANAGER_ID` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
INSERT INTO `factory` (`ID`, `NAME`, `LOCATION`, `FLOOR_SIZE`, `FK_MANAGER_ID`) VALUES
|
||||
(0, 'aut magni in earum et ea repellat est', 'Bogan chester', 48.17, 14),
|
||||
(1, 'accusamus exercitationem sed illo enim labore', 'Antone ton', 37.3, 16),
|
||||
(2, 'veritatis eaque rem corrupti vero', 'Gottlieb shire', 79.07, 10),
|
||||
(3, 'error maxime voluptatibus neque quo quo natus', 'Padberg view', 53.2, 8),
|
||||
(4, 'perspiciatis ut incidunt laborum praesentium voluptatum a perspiciatis autem', 'Greenfelder bury', 24.26, 12),
|
||||
(5, 'laboriosam impedit illo eveniet quis provident soluta rerum', 'Skiles town', 81.03, 11),
|
||||
(6, 'debitis assumenda ad tenetur', 'Grant chester', 78.5, 9),
|
||||
(7, 'ipsum libero animi dolore optio', 'Makenzie shire', 27.56, 5),
|
||||
(8, 'quia possimus eaque eveniet', 'Waldo port', 52.13, 18),
|
||||
(9, 'eum dolor dolorum', 'Sawayn view', 13.17, 2),
|
||||
(10, 'voluptas deserunt quo ipsum incidunt voluptas autem doloremque minima', 'Daniel shire', 46.16, 13),
|
||||
(11, 'totam omnis sit aut deserunt', 'Glover port', 44.17, 3),
|
||||
(12, 'molestias nulla voluptatem et nihil repudiandae velit accusamus', 'South Leilani Balistreri berg', 63.92, 7),
|
||||
(13, 'eaque voluptas repellendus officia', 'Mertz mouth', 17.12, 17),
|
||||
(14, 'voluptatem impedit eos repudiandae', 'Cristina fort', 24, 0),
|
||||
(15, 'rem velit voluptates non molestiae aut labore quis', 'McGlynn shire', 90.25, 15),
|
||||
(16, 'excepturi consectetur numquam labore praesentium at autem impedit', 'Green burgh', 46.62, 19),
|
||||
(17, 'quae beatae dolor omnis veniam dolores natus repellendus', 'Koss haven', 68.28, 6),
|
||||
(18, 'et quis molestiae animi nam sapiente sed nihil omnis', 'Otilia bury', 55.74, 1),
|
||||
(19, 'dignissimos modi et', 'Ryan town', 50.15, 4);
|
||||
|
||||
CREATE TABLE `factory_supports_processes` (
|
||||
`FK_PROCESS_ID` int(11) NOT NULL,
|
||||
`FK_FACTORY_ID` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
INSERT INTO `factory_supports_processes` (`FK_PROCESS_ID`, `FK_FACTORY_ID`) VALUES
|
||||
(0, 12),
|
||||
(1, 9),
|
||||
(2, 16),
|
||||
(3, 4),
|
||||
(4, 15),
|
||||
(5, 14),
|
||||
(6, 18),
|
||||
(7, 17),
|
||||
(8, 8),
|
||||
(9, 1),
|
||||
(10, 3),
|
||||
(11, 0),
|
||||
(12, 7),
|
||||
(13, 10),
|
||||
(14, 6),
|
||||
(15, 11),
|
||||
(16, 5),
|
||||
(17, 19),
|
||||
(18, 13),
|
||||
(19, 2);
|
||||
|
||||
CREATE TABLE `ice_cream_product` (
|
||||
`ID` int(11) NOT NULL,
|
||||
`PRICE` decimal(10,0) NOT NULL,
|
||||
`NAME` varchar(255) NOT NULL,
|
||||
`DESCRIPTION` varchar(255) NOT NULL,
|
||||
`ICECREAM_AMOUNT` float NOT NULL,
|
||||
`FK_FACTORY_ID` int(11) NOT NULL,
|
||||
`FK_ICE_CREAM_RECIPE_ID` int(11) NOT NULL,
|
||||
`PACKAGING_TYPE` char(8) DEFAULT NULL CHECK (`PACKAGING_TYPE` in ('CONE','BOX','CUP','ON_STICK'))
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
INSERT INTO `ice_cream_product` (`ID`, `PRICE`, `NAME`, `DESCRIPTION`, `ICECREAM_AMOUNT`, `FK_FACTORY_ID`, `FK_ICE_CREAM_RECIPE_ID`, `PACKAGING_TYPE`) VALUES
|
||||
(0, '2', 'Nina', 'accusantium et facere hic quas magni', 115.95, 3, 19, 'ON_STICK'),
|
||||
(1, '0', 'Mckenna', 'omnis odio ipsa eos dolor quae modi aut', 90.63, 1, 5, 'CUP'),
|
||||
(2, '2', 'Theodore', 'beatae et quis earum', 197.45, 10, 2, 'ON_STICK'),
|
||||
(3, '0', 'Alanis', 'illum quibusdam est', 192.52, 17, 18, 'CONE'),
|
||||
(4, '3', 'Maynard', 'ut rem dignissimos id libero', 147.98, 12, 0, 'CONE'),
|
||||
(5, '1', 'Jodie', 'maxime labore iste', 155.6, 6, 17, 'CONE'),
|
||||
(6, '0', 'Jamel', 'alias culpa fugit aperiam', 182.08, 15, 3, 'CONE'),
|
||||
(7, '2', 'Nayeli', 'dolores consequatur iste corporis aut', 39.36, 11, 8, 'CUP'),
|
||||
(8, '0', 'Walton', 'officiis aut qui eveniet inventore', 159.46, 16, 13, 'CUP'),
|
||||
(9, '1', 'Eriberto', 'maxime laboriosam debitis', 111.41, 14, 7, 'BOX'),
|
||||
(10, '1', 'Christophe', 'at totam quia debitis architecto qui alias ut voluptatem', 129.07, 19, 12, 'CONE'),
|
||||
(11, '2', 'Tierra', 'amet consequatur exercitationem', 168.46, 9, 4, 'CUP'),
|
||||
(12, '0', 'Lionel', 'fugit deleniti occaecati vero architecto iusto nostrum', 50.01, 13, 1, 'CUP'),
|
||||
(13, '2', 'Bettie', 'odit iste illo', 141.82, 2, 11, 'BOX'),
|
||||
(14, '3', 'Raoul', 'perferendis laboriosam rem vel officia vero', 143.75, 18, 6, 'ON_STICK'),
|
||||
(15, '0', 'Kristofer', 'ut dolorem rerum beatae labore et hic et', 59.43, 5, 14, 'BOX'),
|
||||
(16, '2', 'Gladyce', 'velit sunt aut porro ea qui ut nihil quis', 182.8, 7, 10, 'CUP'),
|
||||
(17, '1', 'Jacquelyn', 'et ullam est dolore inventore tempora numquam', 162.2, 4, 9, 'BOX'),
|
||||
(18, '2', 'Katarina', 'consectetur ullam minus rem nesciunt', 74.51, 8, 16, 'CUP'),
|
||||
(19, '2', 'Janick', 'nihil sit et qui similique repudiandae quae eos', 167.62, 0, 15, 'ON_STICK');
|
||||
|
||||
CREATE TABLE `ice_cream_recipe` (
|
||||
`ID` int(11) NOT NULL,
|
||||
`PRICE` decimal(10,0) NOT NULL,
|
||||
`FLAVOUR_NAME` varchar(255) NOT NULL,
|
||||
`DESCRIPTION` varchar(255) NOT NULL,
|
||||
`TYPE` char(11) NOT NULL,
|
||||
`FK_NUTRIENT_ID` int(11) NOT NULL
|
||||
) ;
|
||||
|
||||
INSERT INTO `ice_cream_recipe` (`ID`, `PRICE`, `FLAVOUR_NAME`, `DESCRIPTION`, `TYPE`, `FK_NUTRIENT_ID`) VALUES
|
||||
(0, '6', 'voluptatem aliquam aut voluptas cumque praesentium neque', 'numquam quam cum', 'SORBET', 1),
|
||||
(1, '6', 'assumenda necessitatibus et quia accusamus atque non voluptatibus repellat', 'quaerat iste nesciunt', 'DESSERT_ICE', 8),
|
||||
(2, '1', 'qui quia facere accusantium et quasi atque', 'dolorem eos et minima non illo', 'DESSERT_ICE', 11),
|
||||
(3, '2', 'totam et cumque illo', 'quos vel quidem cupiditate qui exercitationem ad minima', 'SORBET', 0),
|
||||
(4, '5', 'necessitatibus voluptatem et aspernatur ipsum', 'repellendus sit aspernatur voluptates', 'WATER_ICE', 18),
|
||||
(5, '5', 'non excepturi aliquid atque modi itaque amet velit', 'sit animi cumque odit tenetur recusandae', 'DESSERT_ICE', 13),
|
||||
(6, '9', 'sequi velit eligendi aut hic alias doloribus velit', 'sed nisi et beatae', 'DESSERT_ICE', 9),
|
||||
(7, '2', 'eligendi ea aperiam dolores totam perferendis sunt', 'aut rerum autem', 'ICE_CREAM', 14),
|
||||
(8, '7', 'vel distinctio ipsa rem occaecati velit', 'nihil expedita possimus maxime praesentium perspiciatis rem est', 'WATER_ICE', 7),
|
||||
(9, '10', 'autem hic nulla accusantium sint laborum', 'qui qui maiores voluptas eos dicta ut', 'DESSERT_ICE', 12),
|
||||
(10, '2', 'quidem iure porro aliquam fugiat unde in et', 'vel voluptas perspiciatis rerum accusamus dolore', 'MILK_ICE', 2),
|
||||
(11, '7', 'placeat nihil explicabo reiciendis et at unde nam', 'qui libero id quia fugiat a rem enim enim', 'ICE_CREAM', 4),
|
||||
(12, '8', 'velit qui voluptas atque fuga nihil dolore esse', 'veniam distinctio voluptas unde est libero dolor', 'WATER_ICE', 3),
|
||||
(13, '4', 'voluptatem quo et voluptas non', 'tempore incidunt ut ullam', 'WATER_ICE', 15),
|
||||
(14, '8', 'quis et in fugit repellendus rem perferendis', 'sed distinctio nihil sit sapiente sunt iure nemo sint', 'MILK_ICE', 16),
|
||||
(15, '5', 'ullam est laboriosam sint labore saepe molestiae', 'corporis repellat nobis', 'SORBET', 5),
|
||||
(16, '1', 'natus rem et eius itaque magnam', 'ipsa nihil natus amet placeat', 'SORBET', 10),
|
||||
(17, '4', 'minima ea saepe corrupti et eligendi omnis quia non', 'tenetur sapiente quaerat eaque voluptas sunt', 'SORBET', 19),
|
||||
(18, '4', 'quia qui dignissimos rerum molestiae', 'maiores inventore aperiam laboriosam aspernatur', 'DESSERT_ICE', 6),
|
||||
(19, '2', 'ad consequatur beatae laudantium explicabo nisi', 'veniam rerum consequatur hic', 'SHERBET', 17);
|
||||
|
||||
CREATE TABLE `ice_cream_recipe_ingredient` (
|
||||
`AMOUNT` float NOT NULL,
|
||||
`FK_INGREDIENT_ID` int(11) NOT NULL,
|
||||
`FK_ICE_CREAM_RECIPE_ID` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
INSERT INTO `ice_cream_recipe_ingredient` (`AMOUNT`, `FK_INGREDIENT_ID`, `FK_ICE_CREAM_RECIPE_ID`) VALUES
|
||||
(7.76, 0, 2),
|
||||
(1.86, 1, 8),
|
||||
(0.6, 2, 5),
|
||||
(4.79, 3, 19),
|
||||
(6.85, 4, 4),
|
||||
(1.9, 5, 7),
|
||||
(5.72, 6, 14),
|
||||
(3.04, 7, 17),
|
||||
(3.96, 8, 18),
|
||||
(6.66, 9, 9),
|
||||
(0.43, 10, 16),
|
||||
(1.59, 11, 6),
|
||||
(6.11, 12, 13),
|
||||
(5.25, 13, 0),
|
||||
(5.82, 14, 10),
|
||||
(9.04, 15, 1),
|
||||
(6.33, 16, 11),
|
||||
(9.72, 17, 12),
|
||||
(3.15, 18, 3),
|
||||
(1.99, 19, 15);
|
||||
|
||||
CREATE TABLE `ice_cream_recipe_instruction` (
|
||||
`ORDERING` int(11) NOT NULL,
|
||||
`CONTENT` varchar(255) NOT NULL,
|
||||
`FK_ICE_CREAM_RECIPE_ID` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
INSERT INTO `ice_cream_recipe_instruction` (`ORDERING`, `CONTENT`, `FK_ICE_CREAM_RECIPE_ID`) VALUES
|
||||
(0, 'maiores aut itaque qui', 14),
|
||||
(1, 'occaecati deserunt quam aspernatur vel amet enim', 12),
|
||||
(2, 'exercitationem soluta enim', 4),
|
||||
(3, 'facilis qui officiis hic assumenda eum quia officia', 17),
|
||||
(4, 'voluptatem eum ipsa', 0),
|
||||
(5, 'aut nisi enim maxime aut totam vero', 2),
|
||||
(6, 'ipsum id et soluta debitis deleniti', 9),
|
||||
(7, 'aut consectetur voluptatum', 7),
|
||||
(8, 'fugiat ipsum expedita neque ducimus quaerat dolores enim', 15),
|
||||
(9, 'qui deserunt nisi hic similique dicta et voluptate', 8),
|
||||
(10, 'modi ut id cum magnam dolor numquam consectetur', 11),
|
||||
(11, 'rerum rerum eaque', 6),
|
||||
(12, 'saepe ut ipsam ea maxime et temporibus odio qui', 3),
|
||||
(13, 'quidem qui incidunt iusto', 13),
|
||||
(14, 'vero ipsa facere itaque sit et magni sit inventore', 5),
|
||||
(15, 'ea et qui et harum rerum consequatur dolorem', 16),
|
||||
(16, 'enim omnis rerum eum ut vero et culpa vitae', 1),
|
||||
(17, 'quia fuga unde expedita recusandae', 10),
|
||||
(18, 'occaecati exercitationem omnis', 19),
|
||||
(19, 'corrupti non consequatur laboriosam quo repudiandae ut tempore', 18);
|
||||
|
||||
CREATE TABLE `ingredient` (
|
||||
`ID` int(11) NOT NULL,
|
||||
`NAME` varchar(255) NOT NULL,
|
||||
`MEASUREMENT_UNITS` char(8) NOT NULL,
|
||||
`FK_NUTRIENT_ID` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
INSERT INTO `ingredient` (`ID`, `NAME`, `MEASUREMENT_UNITS`, `FK_NUTRIENT_ID`) VALUES
|
||||
(0, 'et hic dolore ipsum sapiente delectus nesciunt nobis', 'repellat', 7),
|
||||
(1, 'suscipit quis error id', 'dicta du', 12),
|
||||
(2, 'et voluptatem nemo et laborum et eveniet et nihil', 'labore q', 17),
|
||||
(3, 'natus hic quia quos est distinctio', 'debitis', 8),
|
||||
(4, 'earum pariatur facilis molestias molestiae voluptate', 'at et vo', 16),
|
||||
(5, 'pariatur tempore autem illum', 'tempora', 15),
|
||||
(6, 'aut in quia enim', 'corporis', 10),
|
||||
(7, 'maiores optio dolor', 'sit nobi', 5),
|
||||
(8, 'explicabo voluptatibus dolorem consequatur alias magni in', 'voluptas', 2),
|
||||
(9, 'aperiam dolor hic quia ut non asperiores et', 'quasi qu', 6),
|
||||
(10, 'eos quia perferendis', 'sunt con', 1),
|
||||
(11, 'odit voluptatem delectus reiciendis omnis ullam corporis', 'sit enim', 3),
|
||||
(12, 'aspernatur aut optio', 'beatae d', 14),
|
||||
(13, 'placeat ducimus natus quod', 'laudanti', 13),
|
||||
(14, 'debitis aut dolor assumenda', 'aut arch', 0),
|
||||
(15, 'aspernatur aut id illo quasi', 'et nam t', 18),
|
||||
(16, 'id sunt vel nam nostrum', 'quasi au', 19),
|
||||
(17, 'quae natus quo eius nihil et asperiores eligendi nemo', 'delectus', 4),
|
||||
(18, 'exercitationem velit numquam pariatur odio facilis', 'adipisci', 9),
|
||||
(19, 'est at consectetur iure ut omnis deserunt ea', 'ut quaer', 11);
|
||||
|
||||
CREATE TABLE `ingredient_provider` (
|
||||
`MONTHLY_PRICE` decimal(10,0) NOT NULL,
|
||||
`MONTHLY_SUPPLY` float NOT NULL,
|
||||
`FK_INGREDIENT_ID` int(11) NOT NULL,
|
||||
`FK_PROVIDER_ID` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
INSERT INTO `ingredient_provider` (`MONTHLY_PRICE`, `MONTHLY_SUPPLY`, `FK_INGREDIENT_ID`, `FK_PROVIDER_ID`) VALUES
|
||||
('862', 743.06, 0, 16),
|
||||
('859', 76.8, 1, 0),
|
||||
('166', 753.18, 2, 17),
|
||||
('415', 70.83, 3, 11),
|
||||
('999', 433.5, 4, 19),
|
||||
('515', 56.42, 5, 6),
|
||||
('249', 517.47, 6, 15),
|
||||
('230', 512.64, 7, 1),
|
||||
('119', 141.04, 8, 14),
|
||||
('877', 505.73, 9, 4),
|
||||
('172', 451.22, 10, 18),
|
||||
('872', 467.81, 11, 2),
|
||||
('982', 299.08, 12, 8),
|
||||
('945', 770.66, 13, 3),
|
||||
('609', 482.36, 14, 9),
|
||||
('108', 759.37, 15, 13),
|
||||
('463', 277.69, 16, 7),
|
||||
('703', 761.15, 17, 12),
|
||||
('811', 548.29, 18, 10),
|
||||
('959', 639.18, 19, 5);
|
||||
|
||||
CREATE TABLE `manager` (
|
||||
`ID` int(11) NOT NULL,
|
||||
`FIRST_NAME` varchar(255) NOT NULL,
|
||||
`SURNAME` varchar(255) NOT NULL,
|
||||
`PHONE_NUMBER` varchar(255) DEFAULT NULL,
|
||||
`TITLE` varchar(255) NOT NULL,
|
||||
`EMAIL` varchar(255) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
INSERT INTO `manager` (`ID`, `FIRST_NAME`, `SURNAME`, `PHONE_NUMBER`, `TITLE`, `EMAIL`) VALUES
|
||||
(0, 'Blair', 'Sawayn', '(390) 890-3833', 'fuga et alias ut', 'jovani_occaecati@hotmail.com'),
|
||||
(1, 'Arlie', 'Sauer', '794.915.2395', 'officia illum quia ut explicabo dicta dolor eius', 'emily_quo@hotmail.com'),
|
||||
(2, 'Freddie', 'Lakin', '1-460-760-0617', 'et perspiciatis aspernatur', 'eda_quo@yahoo.com'),
|
||||
(3, 'Arthur', 'Ferry', '107.940.6419 x50983', 'vel quia assumenda', 'jermain_eius@yahoo.com'),
|
||||
(4, 'Ole', 'Gorczany', '692.839.8491', 'possimus pariatur laudantium voluptas ut', 'germaine_sed@hotmail.com'),
|
||||
(5, 'Zita', 'Swaniawski', '767-603-6428', 'ut autem qui quasi', 'fritz_at@gmail.com'),
|
||||
(6, 'Lenny', 'OConner', '1-556-436-8613 x244', 'modi alias et accusantium veniam suscipit voluptate', 'hildegard_tempora@yahoo.com'),
|
||||
(7, 'Royal', 'Emmerich', '1-507-785-1757 x405', 'labore voluptates libero', 'elisabeth_nobis@hotmail.com'),
|
||||
(8, 'Yolanda', 'Wiegand', '(331) 807-3192 x214', 'quia culpa quae', 'myrtice_laboriosam@gmail.com'),
|
||||
(9, 'Chet', 'Jones', '320.295.2273 x24098', 'voluptatem explicabo enim inventore quod sapiente accusamus', 'glenda_deserunt@yahoo.com'),
|
||||
(10, 'Mabel', 'Casper', '1-516-229-7076 x343', 'voluptatem dolores nam excepturi consequatur quaerat rem dolorem', 'luigi_aliquam@yahoo.com'),
|
||||
(11, 'Daisha', 'Kirlin', '(362) 773-9634 x44048', 'ut id libero explicabo', 'nannie_vel@gmail.com'),
|
||||
(12, 'Lisandro', 'Bailey', '409.778.8477 x92878', 'impedit optio aut eum dolorem porro cum doloribus sed', 'brent_alias@hotmail.com'),
|
||||
(13, 'Nigel', 'OConnell', '(604) 123-6270', 'consequatur quam quo expedita', 'jess_et@hotmail.com'),
|
||||
(14, 'Sarah', 'Grimes', '(133) 407-0418 x2365', 'mollitia incidunt ut inventore omnis numquam qui rerum', 'stefan_dignissimos@hotmail.com'),
|
||||
(15, 'Chelsey', 'Ullrich', '1-903-140-7781', 'dolor rem aut sint amet consequatur nam rem', 'antonia_natus@yahoo.com'),
|
||||
(16, 'Pearline', 'Farrell', '115.350.0674 x416', 'officia tempore rerum dignissimos harum', 'elta_fuga@yahoo.com'),
|
||||
(17, 'Ellsworth', 'Flatley', '751.766.0531 x92723', 'recusandae nam in dolores illo dolore qui doloribus nesciunt', 'dusty_excepturi@gmail.com'),
|
||||
(18, 'Lorine', 'Durgan', '(664) 738-4165 x4794', 'laboriosam voluptas architecto sit autem molestiae possimus ab', 'isadore_sunt@gmail.com'),
|
||||
(19, 'Loraine', 'Gutkowski', '963-630-0026 x2270', 'in laborum quasi qui placeat eaque voluptatem', 'russel_sit@yahoo.com');
|
||||
|
||||
CREATE TABLE `nutrient` (
|
||||
`ID` int(11) NOT NULL,
|
||||
`FAT` float NOT NULL,
|
||||
`CHOLESTEROL` float NOT NULL,
|
||||
`SODIUM` float NOT NULL,
|
||||
`CARBOHYDRATES` float NOT NULL,
|
||||
`PROTEIN` float NOT NULL,
|
||||
`CALORIES` float NOT NULL,
|
||||
`SERVING_SIZE` float NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
INSERT INTO `nutrient` (`ID`, `FAT`, `CHOLESTEROL`, `SODIUM`, `CARBOHYDRATES`, `PROTEIN`, `CALORIES`, `SERVING_SIZE`) VALUES
|
||||
(0, 65.84, 88.21, 45.41, 88.2, 67.78, 23.74, 82.17),
|
||||
(1, 66.61, 76.33, 75.57, 83.61, 38.75, 87.18, 52.16),
|
||||
(2, 53.45, 94.19, 24.05, 7.22, 96.21, 59.97, 93.16),
|
||||
(3, 89.08, 1.96, 4.66, 82.3, 18.84, 24.45, 67.51),
|
||||
(4, 50.01, 59.42, 50.86, 6.69, 12.34, 50.42, 95.01),
|
||||
(5, 83.29, 74.39, 62.97, 46.19, 70.07, 57.11, 32.91),
|
||||
(6, 16.84, 28.32, 31.3, 30.83, 30.72, 36.45, 22.32),
|
||||
(7, 2.07, 91.14, 59.36, 68.51, 28.82, 51.31, 98.56),
|
||||
(8, 79.96, 97.31, 21.59, 55.25, 86.54, 37.95, 96.4),
|
||||
(9, 70.11, 24.41, 29.83, 31.77, 66.84, 11.2, 56.65),
|
||||
(10, 79.69, 38.05, 26.51, 4.74, 86.28, 5.39, 91.06),
|
||||
(11, 30.34, 9.76, 31.3, 71.21, 66.85, 10.93, 95.19),
|
||||
(12, 95.01, 69.67, 26.25, 21.57, 60.79, 55.65, 24.52),
|
||||
(13, 69.18, 77, 18.21, 8.8, 80.01, 98.48, 73.25),
|
||||
(14, 13.31, 5.01, 18.9, 87.62, 98.72, 84.29, 23.32),
|
||||
(15, 22.04, 54.69, 97.9, 3.06, 57.41, 15.48, 66.29),
|
||||
(16, 34.88, 13.08, 35.79, 12.71, 93.33, 6.89, 27.74),
|
||||
(17, 26.15, 41.94, 12.44, 71.05, 5.53, 22.16, 39.27),
|
||||
(18, 26.05, 97.7, 57.08, 9.84, 14.78, 2.2, 2.69),
|
||||
(19, 82.41, 36.84, 7.9, 40.49, 77.27, 84.37, 42.5);
|
||||
|
||||
CREATE TABLE `process` (
|
||||
`ID` int(11) NOT NULL,
|
||||
`NAME` varchar(255) NOT NULL,
|
||||
`SIZE` float NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
INSERT INTO `process` (`ID`, `NAME`, `SIZE`) VALUES
|
||||
(0, 'placeat quaerat magnam et voluptatem voluptas praesentium', 73.56),
|
||||
(1, 'nisi alias sit dicta', 83.76),
|
||||
(2, 'quaerat ullam quidem similique deleniti nesciunt sequi et', 74.94),
|
||||
(3, 'eum rem aspernatur ut qui incidunt officiis quod consequatur', 64.77),
|
||||
(4, 'aliquid magnam voluptas', 76.97),
|
||||
(5, 'earum quis qui aut impedit', 51.27),
|
||||
(6, 'voluptatem nemo maxime hic nisi voluptatem nam dolores', 80.86),
|
||||
(7, 'ullam accusantium ullam qui voluptatem voluptas voluptatem et illum', 85.94),
|
||||
(8, 'nulla quaerat eaque esse iste est sed voluptatem molestiae', 100),
|
||||
(9, 'rerum aut enim itaque quo vero', 56.24),
|
||||
(10, 'earum qui et', 16.47),
|
||||
(11, 'non cumque reprehenderit iusto numquam', 33.05),
|
||||
(12, 'est perferendis aut ut quia corrupti dolores', 95.58),
|
||||
(13, 'asperiores eaque ut natus amet', 10.87),
|
||||
(14, 'ab quia est velit', 60.83),
|
||||
(15, 'iure quia rerum error praesentium', 77.32),
|
||||
(16, 'aperiam molestias adipisci similique ut eum', 50.41),
|
||||
(17, 'et pariatur et eaque', 49.73),
|
||||
(18, 'modi maxime voluptatem aut consequatur nisi fugiat atque', 38.75),
|
||||
(19, 'eum aut at ut ab molestias consequuntur maxime doloremque', 60.62);
|
||||
|
||||
CREATE TABLE `provider` (
|
||||
`ID` int(11) NOT NULL,
|
||||
`NAME` varchar(255) NOT NULL,
|
||||
`EMAIL` varchar(255) DEFAULT NULL,
|
||||
`PHONE_NUMBER` varchar(255) DEFAULT NULL,
|
||||
`HOMEPAGE` varchar(255) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
INSERT INTO `provider` (`ID`, `NAME`, `EMAIL`, `PHONE_NUMBER`, `HOMEPAGE`) VALUES
|
||||
(0, 'consectetur doloremque asperiores laboriosam', 'aurelia_velit@gmail.com', '716.359.7681 x6186', 'www.vortals.net'),
|
||||
(1, 'quos voluptatibus ea iusto nam vero ut', 'dudley_aspernatur@yahoo.com', '228-967-6029 x523', 'www.synergies.biz'),
|
||||
(2, 'quibusdam consequuntur aut quos architecto suscipit dolor ex qui', 'shanel_laudantium@hotmail.com', '529-163-2716', 'www.users.co'),
|
||||
(3, 'molestiae vitae fuga eum ratione voluptatum', 'dayana_sapiente@hotmail.com', '539-561-0890', 'www.eyeballs.org'),
|
||||
(4, 'consequatur et veritatis cumque fugit', 'tressa_odio@yahoo.com', '(774) 222-9023 x28541', 'www.models.net'),
|
||||
(5, 'labore rerum error doloribus nulla', 'lue_est@gmail.com', '(865) 379-6632 x01957', 'www.functionalities.name'),
|
||||
(6, 'explicabo ad omnis et non voluptate quos assumenda', 'fernando_dolor@yahoo.com', '1-676-497-4906', 'www.platforms.biz'),
|
||||
(7, 'aspernatur illo asperiores', 'lincoln_voluptates@hotmail.com', '1-380-965-9342 x68355', 'www.e-markets.info'),
|
||||
(8, 'qui esse sunt beatae', 'quinten_maxime@gmail.com', '(136) 854-5165 x34534', 'www.applications.co'),
|
||||
(9, 'sit vitae sint', 'dashawn_facilis@gmail.com', '158-268-6130 x067', 'www.metrics.com'),
|
||||
(10, 'non vel possimus rerum exercitationem qui et', 'lavon_vitae@hotmail.com', '986.516.7089 x54731', 'www.markets.name'),
|
||||
(11, 'quis debitis cumque', 'mariane_quo@gmail.com', '177.229.8877 x6764', 'www.e-services.name'),
|
||||
(12, 'aut et aspernatur', 'kaden_in@gmail.com', '1-523-295-4605 x6482', 'www.communities.co'),
|
||||
(13, 'ab earum odit et ut', 'junior_unde@hotmail.com', '1-705-768-9987 x496', 'www.web-services.name'),
|
||||
(14, 'accusamus cum quaerat et', 'keaton_eveniet@gmail.com', '(181) 880-0916 x40690', 'www.solutions.biz'),
|
||||
(15, 'ut rerum consectetur enim qui molestiae asperiores', 'jakob_aut@gmail.com', '(771) 719-4449 x2153', 'www.deliverables.co'),
|
||||
(16, 'debitis dolor rem nihil', 'lucienne_ullam@yahoo.com', '(198) 619-1034 x1317', 'www.e-business.org'),
|
||||
(17, 'eum illum omnis vel fuga et modi corrupti', 'viviane_unde@yahoo.com', '1-248-736-0211 x936', 'www.infomediaries.org'),
|
||||
(18, 'odio officia reiciendis sit error dicta non dolorum', 'delpha_et@yahoo.com', '(520) 773-3109 x23641', 'www.metrics.info'),
|
||||
(19, 'qui velit reiciendis nesciunt', 'tiffany_cum@hotmail.com', '470-203-0313 x2394', 'www.platforms.io');
|
||||
|
||||
CREATE TABLE `recipe_needs_processes` (
|
||||
`FK_PROCESS_ID` int(11) NOT NULL,
|
||||
`FK_ICE_CREAM_RECIPE_ID` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
INSERT INTO `recipe_needs_processes` (`FK_PROCESS_ID`, `FK_ICE_CREAM_RECIPE_ID`) VALUES
|
||||
(0, 10),
|
||||
(1, 8),
|
||||
(2, 11),
|
||||
(3, 4),
|
||||
(4, 14),
|
||||
(5, 6),
|
||||
(6, 13),
|
||||
(7, 15),
|
||||
(8, 18),
|
||||
(9, 16),
|
||||
(10, 3),
|
||||
(11, 0),
|
||||
(12, 12),
|
||||
(13, 17),
|
||||
(14, 9),
|
||||
(15, 1),
|
||||
(16, 5),
|
||||
(17, 7),
|
||||
(18, 19),
|
||||
(19, 2);
|
||||
|
||||
|
||||
ALTER TABLE `factory`
|
||||
ADD PRIMARY KEY (`ID`),
|
||||
ADD UNIQUE KEY `FK_MANAGER_ID` (`FK_MANAGER_ID`);
|
||||
|
||||
ALTER TABLE `factory_supports_processes`
|
||||
ADD PRIMARY KEY (`FK_PROCESS_ID`,`FK_FACTORY_ID`),
|
||||
ADD KEY `FK_FACTORY_ID` (`FK_FACTORY_ID`);
|
||||
|
||||
ALTER TABLE `ice_cream_product`
|
||||
ADD PRIMARY KEY (`ID`),
|
||||
ADD KEY `FK_FACTORY_ID` (`FK_FACTORY_ID`),
|
||||
ADD KEY `FK_ICE_CREAM_RECIPE_ID` (`FK_ICE_CREAM_RECIPE_ID`);
|
||||
|
||||
ALTER TABLE `ice_cream_recipe`
|
||||
ADD PRIMARY KEY (`ID`),
|
||||
ADD UNIQUE KEY `FK_NUTRIENT_ID` (`FK_NUTRIENT_ID`);
|
||||
|
||||
ALTER TABLE `ice_cream_recipe_ingredient`
|
||||
ADD PRIMARY KEY (`FK_INGREDIENT_ID`,`FK_ICE_CREAM_RECIPE_ID`),
|
||||
ADD KEY `FK_ICE_CREAM_RECIPE_ID` (`FK_ICE_CREAM_RECIPE_ID`);
|
||||
|
||||
ALTER TABLE `ice_cream_recipe_instruction`
|
||||
ADD PRIMARY KEY (`ORDERING`,`FK_ICE_CREAM_RECIPE_ID`),
|
||||
ADD KEY `FK_ICE_CREAM_RECIPE_ID` (`FK_ICE_CREAM_RECIPE_ID`);
|
||||
|
||||
ALTER TABLE `ingredient`
|
||||
ADD PRIMARY KEY (`ID`),
|
||||
ADD UNIQUE KEY `FK_NUTRIENT_ID` (`FK_NUTRIENT_ID`);
|
||||
|
||||
ALTER TABLE `ingredient_provider`
|
||||
ADD PRIMARY KEY (`FK_INGREDIENT_ID`,`FK_PROVIDER_ID`),
|
||||
ADD KEY `FK_PROVIDER_ID` (`FK_PROVIDER_ID`);
|
||||
|
||||
ALTER TABLE `manager`
|
||||
ADD PRIMARY KEY (`ID`);
|
||||
|
||||
ALTER TABLE `nutrient`
|
||||
ADD PRIMARY KEY (`ID`);
|
||||
|
||||
ALTER TABLE `process`
|
||||
ADD PRIMARY KEY (`ID`);
|
||||
|
||||
ALTER TABLE `provider`
|
||||
ADD PRIMARY KEY (`ID`);
|
||||
|
||||
ALTER TABLE `recipe_needs_processes`
|
||||
ADD PRIMARY KEY (`FK_PROCESS_ID`,`FK_ICE_CREAM_RECIPE_ID`),
|
||||
ADD KEY `FK_ICE_CREAM_RECIPE_ID` (`FK_ICE_CREAM_RECIPE_ID`);
|
||||
|
||||
|
||||
ALTER TABLE `factory`
|
||||
ADD CONSTRAINT `factory_ibfk_1` FOREIGN KEY (`FK_MANAGER_ID`) REFERENCES `manager` (`ID`);
|
||||
|
||||
ALTER TABLE `factory_supports_processes`
|
||||
ADD CONSTRAINT `factory_supports_processes_ibfk_1` FOREIGN KEY (`FK_PROCESS_ID`) REFERENCES `process` (`ID`),
|
||||
ADD CONSTRAINT `factory_supports_processes_ibfk_2` FOREIGN KEY (`FK_FACTORY_ID`) REFERENCES `factory` (`ID`);
|
||||
|
||||
ALTER TABLE `ice_cream_product`
|
||||
ADD CONSTRAINT `ice_cream_product_ibfk_1` FOREIGN KEY (`FK_FACTORY_ID`) REFERENCES `factory` (`ID`),
|
||||
ADD CONSTRAINT `ice_cream_product_ibfk_2` FOREIGN KEY (`FK_ICE_CREAM_RECIPE_ID`) REFERENCES `ice_cream_recipe` (`ID`);
|
||||
|
||||
ALTER TABLE `ice_cream_recipe`
|
||||
ADD CONSTRAINT `ice_cream_recipe_ibfk_1` FOREIGN KEY (`FK_NUTRIENT_ID`) REFERENCES `nutrient` (`ID`);
|
||||
|
||||
ALTER TABLE `ice_cream_recipe_ingredient`
|
||||
ADD CONSTRAINT `ice_cream_recipe_ingredient_ibfk_1` FOREIGN KEY (`FK_INGREDIENT_ID`) REFERENCES `ingredient` (`ID`),
|
||||
ADD CONSTRAINT `ice_cream_recipe_ingredient_ibfk_2` FOREIGN KEY (`FK_ICE_CREAM_RECIPE_ID`) REFERENCES `ice_cream_recipe` (`ID`);
|
||||
|
||||
ALTER TABLE `ice_cream_recipe_instruction`
|
||||
ADD CONSTRAINT `ice_cream_recipe_instruction_ibfk_1` FOREIGN KEY (`FK_ICE_CREAM_RECIPE_ID`) REFERENCES `ice_cream_recipe` (`ID`);
|
||||
|
||||
ALTER TABLE `ingredient`
|
||||
ADD CONSTRAINT `ingredient_ibfk_1` FOREIGN KEY (`FK_NUTRIENT_ID`) REFERENCES `nutrient` (`ID`);
|
||||
|
||||
ALTER TABLE `ingredient_provider`
|
||||
ADD CONSTRAINT `ingredient_provider_ibfk_1` FOREIGN KEY (`FK_INGREDIENT_ID`) REFERENCES `ingredient` (`ID`),
|
||||
ADD CONSTRAINT `ingredient_provider_ibfk_2` FOREIGN KEY (`FK_PROVIDER_ID`) REFERENCES `provider` (`ID`);
|
||||
|
||||
ALTER TABLE `recipe_needs_processes`
|
||||
ADD CONSTRAINT `recipe_needs_processes_ibfk_1` FOREIGN KEY (`FK_PROCESS_ID`) REFERENCES `process` (`ID`),
|
||||
ADD CONSTRAINT `recipe_needs_processes_ibfk_2` FOREIGN KEY (`FK_ICE_CREAM_RECIPE_ID`) REFERENCES `ice_cream_recipe` (`ID`);
|
||||
COMMIT;
|
||||
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
9
lab1/README.md
Normal file
9
lab1/README.md
Normal file
@ -0,0 +1,9 @@
|
||||
# Lab 1
|
||||
|
||||
Įmonė užsijima ledų gamyba, tai yra nuo produktų gavimo iki pabaigto produkto.
|
||||
|
||||
Produktai gaminami fabrikuose, kiekvienas fabrikas turi limituotą dydį, šis dydis yra aprašomas paviršiaus plotu. Šis dydis nėra absoliutus rodiklis kuris garanuotų, kad kažkokia nauja aparatūra tilptų į fabriką. Bet gali pasakyti kada tikrai netipltų į fabriką, nesvarbu kaip išdėstyta būtų kita aparatūra.
|
||||
|
||||
Ledų matavimo vienetai yra visada "ml", o kiekvienam ingridientiui matavimo vienetai nurodomi ranka ir priklauso nuo to ingriento paskirties.
|
||||
|
||||
Duomenų bazėje nelaikoma istorija sutarčių su teikėjai. Jeigu nutraukiama sutartis, įrašas yra ištrinamas.
|
155
lab1/script.ddl
Normal file
155
lab1/script.ddl
Normal file
@ -0,0 +1,155 @@
|
||||
#@(#) script.ddl
|
||||
|
||||
DROP TABLE IF EXISTS FACTORY_SUPPORTS_PROCESSES;
|
||||
DROP TABLE IF EXISTS RECIPE_NEEDS_PROCESSES;
|
||||
DROP TABLE IF EXISTS INGREDIENT_PROVIDER;
|
||||
DROP TABLE IF EXISTS ICE_CREAM_RECIPE_INSTRUCTION;
|
||||
DROP TABLE IF EXISTS ICE_CREAM_RECIPE_INGREDIENT;
|
||||
DROP TABLE IF EXISTS ICE_CREAM_PRODUCT;
|
||||
DROP TABLE IF EXISTS INGREDIENT;
|
||||
DROP TABLE IF EXISTS ICE_CREAM_RECIPE;
|
||||
DROP TABLE IF EXISTS FACTORY;
|
||||
DROP TABLE IF EXISTS PROVIDER;
|
||||
DROP TABLE IF EXISTS PROCESS;
|
||||
DROP TABLE IF EXISTS NUTRIENT;
|
||||
DROP TABLE IF EXISTS MANAGER;
|
||||
CREATE TABLE MANAGER
|
||||
(
|
||||
ID int NOT NULL,
|
||||
FIRST_NAME varchar (255) NOT NULL,
|
||||
SURNAME varchar (255) NOT NULL,
|
||||
PHONE_NUMBER varchar (255) NULL,
|
||||
TITLE varchar (255) NOT NULL,
|
||||
EMAIL varchar (255) NULL,
|
||||
PRIMARY KEY(ID)
|
||||
);
|
||||
|
||||
CREATE TABLE NUTRIENT
|
||||
(
|
||||
ID int NOT NULL,
|
||||
FAT float NOT NULL,
|
||||
CHOLESTEROL float NOT NULL,
|
||||
SODIUM float NOT NULL,
|
||||
CARBOHYDRATES float NOT NULL,
|
||||
PROTEIN float NOT NULL,
|
||||
CALORIES float NOT NULL,
|
||||
SERVING_SIZE float NOT NULL,
|
||||
PRIMARY KEY(ID)
|
||||
);
|
||||
|
||||
CREATE TABLE PROCESS
|
||||
(
|
||||
ID int NOT NULL,
|
||||
NAME varchar (255) NOT NULL,
|
||||
SIZE float NOT NULL,
|
||||
PRIMARY KEY(ID)
|
||||
);
|
||||
|
||||
CREATE TABLE PROVIDER
|
||||
(
|
||||
ID int NOT NULL,
|
||||
NAME varchar (255) NOT NULL,
|
||||
EMAIL varchar (255) NULL,
|
||||
PHONE_NUMBER varchar (255) NULL,
|
||||
HOMEPAGE varchar (255) NULL,
|
||||
PRIMARY KEY(ID)
|
||||
);
|
||||
|
||||
CREATE TABLE FACTORY
|
||||
(
|
||||
ID int NOT NULL,
|
||||
NAME varchar (255) NOT NULL,
|
||||
LOCATION varchar (255) NOT NULL,
|
||||
FLOOR_SIZE float NOT NULL,
|
||||
FK_MANAGER_ID int NOT NULL,
|
||||
PRIMARY KEY(ID),
|
||||
UNIQUE(FK_MANAGER_ID),
|
||||
FOREIGN KEY(FK_MANAGER_ID) REFERENCES MANAGER (ID)
|
||||
);
|
||||
|
||||
CREATE TABLE ICE_CREAM_RECIPE
|
||||
(
|
||||
ID int NOT NULL,
|
||||
PRICE decimal NOT NULL,
|
||||
FLAVOUR_NAME varchar (255) NOT NULL,
|
||||
DESCRIPTION varchar (255) NOT NULL,
|
||||
FK_NUTRIENT_ID int NOT NULL,
|
||||
PRIMARY KEY(ID),
|
||||
UNIQUE(FK_NUTRIENT_ID),
|
||||
FOREIGN KEY(FK_NUTRIENT_ID) REFERENCES NUTRIENT (ID),
|
||||
TYPE char (11) CHECK(TYPE in ('DESSERT_ICE', 'ICE_CREAM', 'MILK_ICE', 'SHERBET', 'WATER_ICE', 'SORBET'))
|
||||
);
|
||||
|
||||
CREATE TABLE INGREDIENT
|
||||
(
|
||||
ID int NOT NULL,
|
||||
NAME varchar (255) NOT NULL,
|
||||
MEASUREMENT_UNITS char (8) NOT NULL,
|
||||
FK_NUTRIENT_ID int NOT NULL,
|
||||
PRIMARY KEY(ID),
|
||||
UNIQUE(FK_NUTRIENT_ID),
|
||||
FOREIGN KEY(FK_NUTRIENT_ID) REFERENCES NUTRIENT (ID)
|
||||
);
|
||||
|
||||
CREATE TABLE ICE_CREAM_PRODUCT
|
||||
(
|
||||
ID int NOT NULL,
|
||||
PRICE decimal NOT NULL,
|
||||
NAME varchar (255) NOT NULL,
|
||||
DESCRIPTION varchar (255) NOT NULL,
|
||||
ICECREAM_AMOUNT float NOT NULL,
|
||||
FK_FACTORY_ID int NOT NULL,
|
||||
FK_ICE_CREAM_RECIPE_ID int NOT NULL,
|
||||
PRIMARY KEY(ID),
|
||||
FOREIGN KEY(FK_FACTORY_ID) REFERENCES FACTORY (ID),
|
||||
FOREIGN KEY(FK_ICE_CREAM_RECIPE_ID) REFERENCES ICE_CREAM_RECIPE (ID),
|
||||
PACKAGING_TYPE char (8) CHECK(PACKAGING_TYPE in ('CONE', 'BOX', 'CUP', 'ON_STICK'))
|
||||
);
|
||||
|
||||
CREATE TABLE ICE_CREAM_RECIPE_INGREDIENT
|
||||
(
|
||||
AMOUNT float NOT NULL,
|
||||
FK_INGREDIENT_ID int NOT NULL,
|
||||
FK_ICE_CREAM_RECIPE_ID int NOT NULL,
|
||||
PRIMARY KEY(FK_INGREDIENT_ID, FK_ICE_CREAM_RECIPE_ID),
|
||||
FOREIGN KEY(FK_INGREDIENT_ID) REFERENCES INGREDIENT (ID),
|
||||
FOREIGN KEY(FK_ICE_CREAM_RECIPE_ID) REFERENCES ICE_CREAM_RECIPE (ID)
|
||||
);
|
||||
|
||||
CREATE TABLE ICE_CREAM_RECIPE_INSTRUCTION
|
||||
(
|
||||
ORDERING int NOT NULL,
|
||||
CONTENT varchar (255) NOT NULL,
|
||||
FK_ICE_CREAM_RECIPE_ID int NOT NULL,
|
||||
PRIMARY KEY(ORDERING, FK_ICE_CREAM_RECIPE_ID),
|
||||
FOREIGN KEY(FK_ICE_CREAM_RECIPE_ID) REFERENCES ICE_CREAM_RECIPE (ID)
|
||||
);
|
||||
|
||||
CREATE TABLE INGREDIENT_PROVIDER
|
||||
(
|
||||
MONTHLY_PRICE decimal NOT NULL,
|
||||
MONTHLY_SUPPLY float NOT NULL,
|
||||
FK_INGREDIENT_ID int NOT NULL,
|
||||
FK_PROVIDER_ID int NOT NULL,
|
||||
PRIMARY KEY(FK_INGREDIENT_ID, FK_PROVIDER_ID),
|
||||
FOREIGN KEY(FK_INGREDIENT_ID) REFERENCES INGREDIENT (ID),
|
||||
FOREIGN KEY(FK_PROVIDER_ID) REFERENCES PROVIDER (ID)
|
||||
);
|
||||
|
||||
CREATE TABLE RECIPE_NEEDS_PROCESSES
|
||||
(
|
||||
FK_PROCESS_ID int NOT NULL,
|
||||
FK_ICE_CREAM_RECIPE_ID int NOT NULL,
|
||||
PRIMARY KEY(FK_PROCESS_ID, FK_ICE_CREAM_RECIPE_ID),
|
||||
FOREIGN KEY(FK_PROCESS_ID) REFERENCES PROCESS (ID),
|
||||
FOREIGN KEY(FK_ICE_CREAM_RECIPE_ID) REFERENCES ICE_CREAM_RECIPE (ID)
|
||||
);
|
||||
|
||||
CREATE TABLE FACTORY_SUPPORTS_PROCESSES
|
||||
(
|
||||
FK_PROCESS_ID int NOT NULL,
|
||||
FK_FACTORY_ID int NOT NULL,
|
||||
PRIMARY KEY(FK_PROCESS_ID, FK_FACTORY_ID),
|
||||
FOREIGN KEY(FK_PROCESS_ID) REFERENCES PROCESS (ID),
|
||||
FOREIGN KEY(FK_FACTORY_ID) REFERENCES FACTORY (ID)
|
||||
);
|
1
lab2/.gitignore
vendored
Normal file
1
lab2/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
node_modules
|
7
lab2/.vscode/extensions.json
vendored
Normal file
7
lab2/.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"svelte.svelte-vscode",
|
||||
"tauri-apps.tauri-vscode",
|
||||
"rust-lang.rust-analyzer"
|
||||
]
|
||||
}
|
7
lab2/README.md
Normal file
7
lab2/README.md
Normal file
@ -0,0 +1,7 @@
|
||||
# ICE Management
|
||||
|
||||
ICE - Ice Cream Emporium
|
||||
|
||||
## Recommended IDE Setup
|
||||
|
||||
[VS Code](https://code.visualstudio.com/) + [Svelte](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer).
|
BIN
lab2/database.sqlite
Normal file
BIN
lab2/database.sqlite
Normal file
Binary file not shown.
13
lab2/index.html
Normal file
13
lab2/index.html
Normal file
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>ICE - Management</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
32
lab2/package.json
Normal file
32
lab2/package.json
Normal file
@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "icecream-emporium",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"check": "svelte-check --tsconfig ./tsconfig.json",
|
||||
"tauri": "tauri"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "^1.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sveltejs/vite-plugin-svelte": "^2.0.0",
|
||||
"@tauri-apps/cli": "^1.2.2",
|
||||
"@tsconfig/svelte": "^3.0.0",
|
||||
"@types/node": "^18.7.10",
|
||||
"@unocss/transformer-directives": "^0.50.4",
|
||||
"carbon-components-svelte": "^0.73.3",
|
||||
"svelte": "^3.54.0",
|
||||
"svelte-check": "^3.0.0",
|
||||
"svelte-preprocess": "^5.0.0",
|
||||
"svelte-spa-router": "^3.3.0",
|
||||
"tslib": "^2.4.1",
|
||||
"typescript": "^4.6.4",
|
||||
"unocss": "^0.50.4",
|
||||
"vite": "^4.0.0"
|
||||
}
|
||||
}
|
1586
lab2/pnpm-lock.yaml
generated
Normal file
1586
lab2/pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
4
lab2/src-tauri/.gitignore
vendored
Normal file
4
lab2/src-tauri/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
/target/
|
||||
|
4167
lab2/src-tauri/Cargo.lock
generated
Normal file
4167
lab2/src-tauri/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
26
lab2/src-tauri/Cargo.toml
Normal file
26
lab2/src-tauri/Cargo.toml
Normal file
@ -0,0 +1,26 @@
|
||||
[package]
|
||||
name = "ice-management"
|
||||
version = "0.0.0"
|
||||
description = "ICE DB management"
|
||||
authors = ["Roka Puzonas"]
|
||||
license = ""
|
||||
repository = ""
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "1.2", features = [] }
|
||||
|
||||
[dependencies]
|
||||
tauri = { version = "1.2", features = ["shell-open"] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
sqlx = { version = "0.6.2", features = ["runtime-async-std-native-tls", "mysql", "sqlite", "macros"] }
|
||||
async-std = {version = "1.12.0", features = ["attributes"] }
|
||||
serde_json = "1.0"
|
||||
dotenv = "0.15.0"
|
||||
|
||||
[features]
|
||||
# this feature is used for production builds or when `devPath` points to the filesystem
|
||||
# DO NOT REMOVE!!
|
||||
custom-protocol = ["tauri/custom-protocol"]
|
3
lab2/src-tauri/build.rs
Normal file
3
lab2/src-tauri/build.rs
Normal file
@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
tauri_build::build()
|
||||
}
|
1
lab2/src-tauri/rustfmt.toml
Normal file
1
lab2/src-tauri/rustfmt.toml
Normal file
@ -0,0 +1 @@
|
||||
hard_tabs = true
|
83
lab2/src-tauri/src/main.rs
Normal file
83
lab2/src-tauri/src/main.rs
Normal file
@ -0,0 +1,83 @@
|
||||
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
use std::{env, process::exit};
|
||||
use dotenv::dotenv;
|
||||
|
||||
use serde::{Serialize, Deserialize};
|
||||
use sqlx::{SqlitePool, sqlite::SqlitePoolOptions, Pool, Sqlite};
|
||||
use tauri::State;
|
||||
|
||||
struct Manager {
|
||||
id: i64,
|
||||
first_name: String,
|
||||
surname: String,
|
||||
phone_number: Option<String>,
|
||||
title: String,
|
||||
email: Option<String>
|
||||
}
|
||||
|
||||
struct Database {
|
||||
pool: Pool<Sqlite>
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
enum AddResponse {
|
||||
Success(i64)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn add_manager(
|
||||
first_name: &str,
|
||||
surname: &str,
|
||||
phone_number: Option<&str>,
|
||||
title: &str,
|
||||
email: Option<&str>,
|
||||
database: State<'_, Database>
|
||||
) -> Result<AddResponse, ()> {
|
||||
let id = sqlx::query_as!(
|
||||
Manager,
|
||||
r#"
|
||||
INSERT INTO manager
|
||||
(`FIRST_NAME`, `SURNAME`, `PHONE_NUMBER`, `TITLE`, `EMAIL`)
|
||||
VALUES
|
||||
(?, ?, ?, ?, ?)
|
||||
"#,
|
||||
first_name,
|
||||
surname,
|
||||
phone_number,
|
||||
title,
|
||||
email
|
||||
).execute(&database.pool)
|
||||
.await.map_err(|_| ())?
|
||||
.last_insert_rowid();
|
||||
|
||||
Ok(AddResponse::Success(id))
|
||||
}
|
||||
|
||||
#[async_std::main]
|
||||
async fn main() {
|
||||
dotenv().ok();
|
||||
|
||||
let database_url = match env::var("DATABASE_URL") {
|
||||
Err(_) => {
|
||||
println!("Error: DATABASE_URL not defined");
|
||||
exit(1);
|
||||
},
|
||||
Ok(url) => url,
|
||||
};
|
||||
|
||||
let pool = SqlitePoolOptions::new()
|
||||
.max_connections(10)
|
||||
.connect(&database_url)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
tauri::Builder::default()
|
||||
.manage(Database { pool })
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
add_manager
|
||||
])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
49
lab2/src-tauri/tauri.conf.json
Normal file
49
lab2/src-tauri/tauri.conf.json
Normal file
@ -0,0 +1,49 @@
|
||||
{
|
||||
"build": {
|
||||
"beforeDevCommand": "pnpm dev",
|
||||
"beforeBuildCommand": "pnpm build",
|
||||
"devPath": "http://localhost:1420",
|
||||
"distDir": "../dist",
|
||||
"withGlobalTauri": false
|
||||
},
|
||||
"package": {
|
||||
"productName": "icecream-emporium",
|
||||
"version": "0.0.0"
|
||||
},
|
||||
"tauri": {
|
||||
"allowlist": {
|
||||
"all": false,
|
||||
"shell": {
|
||||
"all": false,
|
||||
"open": true
|
||||
}
|
||||
},
|
||||
"bundle": {
|
||||
"active": true,
|
||||
"icon": [
|
||||
"icons/32x32.png",
|
||||
"icons/128x128.png",
|
||||
"icons/128x128@2x.png",
|
||||
"icons/icon.icns",
|
||||
"icons/icon.ico"
|
||||
],
|
||||
"identifier": "com.tauri.dev",
|
||||
"targets": "all"
|
||||
},
|
||||
"security": {
|
||||
"csp": null
|
||||
},
|
||||
"updater": {
|
||||
"active": false
|
||||
},
|
||||
"windows": [
|
||||
{
|
||||
"fullscreen": false,
|
||||
"resizable": true,
|
||||
"title": "icecream-emporium",
|
||||
"width": 800,
|
||||
"height": 600
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
24
lab2/src/.gitignore
vendored
Normal file
24
lab2/src/.gitignore
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
29
lab2/src/App.svelte
Normal file
29
lab2/src/App.svelte
Normal file
@ -0,0 +1,29 @@
|
||||
<script lang="ts">
|
||||
import Greet from './lib/Greet.svelte'
|
||||
import { Content } from "carbon-components-svelte";
|
||||
|
||||
import Router, {location} from "svelte-spa-router"
|
||||
|
||||
import { Header, HeaderNav, HeaderNavItem } from "carbon-components-svelte";
|
||||
import Home from './routes/Home.svelte'
|
||||
import Managers from './routes/Managers.svelte'
|
||||
import Factories from './routes/Factories.svelte'
|
||||
</script>
|
||||
|
||||
<Header href="/#/" company="ICE" platformName="Management">
|
||||
<HeaderNav>
|
||||
<HeaderNavItem href="/#/factories" text="Factories" />
|
||||
<HeaderNavItem href="/#/managers" text="Managers" />
|
||||
</HeaderNav>
|
||||
</Header>
|
||||
|
||||
<Content>
|
||||
<Router routes={{
|
||||
"/": Home,
|
||||
"/managers": Managers,
|
||||
"/factories": Factories,
|
||||
}} />
|
||||
|
||||
<hr>
|
||||
{$location}
|
||||
</Content>
|
21
lab2/src/lib/Greet.svelte
Normal file
21
lab2/src/lib/Greet.svelte
Normal file
@ -0,0 +1,21 @@
|
||||
<script lang="ts">
|
||||
import { invoke } from "@tauri-apps/api/tauri"
|
||||
|
||||
let name = "";
|
||||
let greetMsg = ""
|
||||
|
||||
async function greet(){
|
||||
// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
|
||||
greetMsg = await invoke("greet", { name })
|
||||
}
|
||||
</script>
|
||||
|
||||
<div>
|
||||
<div class="row">
|
||||
<input id="greet-input" placeholder="Enter a name..." bind:value={name} />
|
||||
<button on:click={greet}>
|
||||
Greet
|
||||
</button>
|
||||
</div>
|
||||
<p>{greetMsg}</p>
|
||||
</div>
|
9
lab2/src/main.ts
Normal file
9
lab2/src/main.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import 'uno.css'
|
||||
import "carbon-components-svelte/css/g90.css";
|
||||
import App from "./App.svelte";
|
||||
|
||||
const app = new App({
|
||||
target: document.getElementById("app"),
|
||||
});
|
||||
|
||||
export default app;
|
1
lab2/src/routes/Factories.svelte
Normal file
1
lab2/src/routes/Factories.svelte
Normal file
@ -0,0 +1 @@
|
||||
Factories
|
2
lab2/src/routes/Home.svelte
Normal file
2
lab2/src/routes/Home.svelte
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
Home
|
34
lab2/src/routes/Managers.svelte
Normal file
34
lab2/src/routes/Managers.svelte
Normal file
@ -0,0 +1,34 @@
|
||||
<script lang="ts">
|
||||
import {
|
||||
Form,
|
||||
Button,
|
||||
TextInput
|
||||
} from "carbon-components-svelte";
|
||||
import { invoke } from '@tauri-apps/api/tauri';
|
||||
|
||||
let firstName = ""
|
||||
let surname = ""
|
||||
let phoneNumber = ""
|
||||
let title = ""
|
||||
let email = ""
|
||||
|
||||
let onSubmit = async (e) => {
|
||||
e.preventDefault()
|
||||
|
||||
const result = await invoke('add_manager', {
|
||||
firstName, surname, phoneNumber, title, email
|
||||
})
|
||||
console.log("submit")
|
||||
console.log(result)
|
||||
}
|
||||
</script>
|
||||
|
||||
<Form on:submit={onSubmit} class="flex flex-col gap-1rem">
|
||||
<TextInput bind:value={firstName} required labelText="First name" />
|
||||
<TextInput bind:value={surname} required labelText="Surname" />
|
||||
<TextInput bind:value={phoneNumber} labelText="Phone number" />
|
||||
<TextInput bind:value={title} required labelText="Title" />
|
||||
<TextInput bind:value={email} labelText="Email" />
|
||||
|
||||
<Button type="submit">Submit</Button>
|
||||
</Form>
|
2
lab2/src/vite-env.d.ts
vendored
Normal file
2
lab2/src/vite-env.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/// <reference types="svelte" />
|
||||
/// <reference types="vite/client" />
|
21
lab2/tsconfig.json
Normal file
21
lab2/tsconfig.json
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"extends": "@tsconfig/svelte/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"target": "ESNext",
|
||||
"useDefineForClassFields": true,
|
||||
"module": "ESNext",
|
||||
"resolveJsonModule": true,
|
||||
"baseUrl": ".",
|
||||
/**
|
||||
* Typecheck JS in `.svelte` and `.js` files by default.
|
||||
* Disable checkJs if you'd like to use dynamic types in JS.
|
||||
* Note that setting allowJs false does not prevent the use
|
||||
* of JS in `.svelte` files.
|
||||
*/
|
||||
"allowJs": true,
|
||||
"checkJs": true,
|
||||
"isolatedModules": true
|
||||
},
|
||||
"include": ["src/**/*.d.ts", "src/**/*.ts", "src/**/*.js", "src/**/*.svelte"],
|
||||
"references": [{ "path": "./tsconfig.node.json" }]
|
||||
}
|
8
lab2/tsconfig.node.json
Normal file
8
lab2/tsconfig.node.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Node"
|
||||
},
|
||||
"include": ["vite.config.ts"]
|
||||
}
|
14
lab2/unocss.config.ts
Normal file
14
lab2/unocss.config.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import {
|
||||
defineConfig,
|
||||
presetUno,
|
||||
} from 'unocss'
|
||||
|
||||
export default defineConfig({
|
||||
presets: [
|
||||
presetUno(),
|
||||
],
|
||||
// preprocess(matcher: string) {
|
||||
// const prefix = 'sa:'
|
||||
// return matcher.startsWith(prefix) ? matcher.slice(prefix.length) : undefined
|
||||
// }
|
||||
})
|
47
lab2/vite.config.ts
Normal file
47
lab2/vite.config.ts
Normal file
@ -0,0 +1,47 @@
|
||||
import { defineConfig } from "vite";
|
||||
import { svelte } from "@sveltejs/vite-plugin-svelte";
|
||||
import sveltePreprocess from "svelte-preprocess";
|
||||
import transformerDirective from '@unocss/transformer-directives'
|
||||
import Unocss from 'unocss/vite'
|
||||
|
||||
const mobile =
|
||||
process.env.TAURI_PLATFORM === "android" ||
|
||||
process.env.TAURI_PLATFORM === "ios";
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig(async () => ({
|
||||
plugins: [
|
||||
svelte({
|
||||
preprocess: [
|
||||
sveltePreprocess({
|
||||
typescript: true,
|
||||
}),
|
||||
],
|
||||
}),
|
||||
Unocss({
|
||||
transformers: [
|
||||
transformerDirective()
|
||||
]
|
||||
}),
|
||||
],
|
||||
|
||||
// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
|
||||
// prevent vite from obscuring rust errors
|
||||
clearScreen: false,
|
||||
// tauri expects a fixed port, fail if that port is not available
|
||||
server: {
|
||||
port: 1420,
|
||||
strictPort: true,
|
||||
},
|
||||
// to make use of `TAURI_DEBUG` and other env variables
|
||||
// https://tauri.studio/v1/api/config#buildconfig.beforedevcommand
|
||||
envPrefix: ["VITE_", "TAURI_"],
|
||||
build: {
|
||||
// Tauri supports es2021
|
||||
target: process.env.TAURI_PLATFORM == "windows" ? "chrome105" : "safari13",
|
||||
// don't minify for debug builds
|
||||
minify: !process.env.TAURI_DEBUG ? "esbuild" : false,
|
||||
// produce sourcemaps for debug builds
|
||||
sourcemap: !!process.env.TAURI_DEBUG,
|
||||
},
|
||||
}));
|
Loading…
Reference in New Issue
Block a user