added utf8mb4 support in install script

This commit is contained in:
Tim Krehan 2019-06-03 14:19:01 +02:00
parent 12a64f38d6
commit 287da38f69
3 changed files with 12 additions and 10 deletions

View file

@ -3,6 +3,8 @@ We Use BrowserStack for cross browser testing, as it provides full testing capab
[ ![BrowserStack](https://live.browserstack.com/favicon.ico) BrowserStack](https://www.browserstack.com) [ ![BrowserStack](https://live.browserstack.com/favicon.ico) BrowserStack](https://www.browserstack.com)
# Recomendations
We strongly recomment to use a ` utf8mb4 ` database collation, as it has the best compatibillity with smileys and other non standard symbols. (You can't tell the enduser, that they can't use smileys. Trust me, I tried.)
# Requirements # Requirements

View file

@ -42,9 +42,9 @@ if (!is_null($connection->connect_error))
$CONFIG["installed"] = true; $CONFIG["installed"] = true;
$CONFIG["host"] = $_POST['dbhost']; $CONFIG["host"] = $_POST['dbhost'];
$CONFIG["database"] = $_POST['database'];
$CONFIG["username"] = $_POST['username']; $CONFIG["username"] = $_POST['username'];
$CONFIG["passwd"] = $_POST['passwd']; $CONFIG["passwd"] = $_POST['passwd'];
$CONFIG["database"] = $_POST['database'];
file_put_contents($_SESSION["docroot"].'/config/config.php', '<?php '."\r\n".'$CONFIG = '.var_export($CONFIG, true).";\n\r?>"); file_put_contents($_SESSION["docroot"].'/config/config.php', '<?php '."\r\n".'$CONFIG = '.var_export($CONFIG, true).";\n\r?>");
@ -54,14 +54,14 @@ CREATE TABLE `Einheit` (
`ID` int(11) NOT NULL, `ID` int(11) NOT NULL,
`Name` varchar(255) NOT NULL, `Name` varchar(255) NOT NULL,
`Standard` tinyint(1) NOT NULL `Standard` tinyint(1) NOT NULL
);"); ) ENGINE = InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;");
array_push($SQLStatements, " array_push($SQLStatements, "
CREATE TABLE `Einheit` ( CREATE TABLE `Einheit` (
`ID` int(11) NOT NULL, `ID` int(11) NOT NULL,
`Name` varchar(255) NOT NULL, `Name` varchar(255) NOT NULL,
`Standard` tinyint(1) NOT NULL `Standard` tinyint(1) NOT NULL
);"); ) ENGINE = InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;");
array_push($SQLStatements, " array_push($SQLStatements, "
CREATE TABLE `Einkauf` ( CREATE TABLE `Einkauf` (
@ -70,7 +70,7 @@ CREATE TABLE `Einkauf` (
`Einheit` int(11) NOT NULL DEFAULT '5', `Einheit` int(11) NOT NULL DEFAULT '5',
`Name` varchar(255) NOT NULL, `Name` varchar(255) NOT NULL,
`Erledigt` tinyint(1) NOT NULL DEFAULT '0' `Erledigt` tinyint(1) NOT NULL DEFAULT '0'
);"); ) ENGINE = InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;");
array_push($SQLStatements, " array_push($SQLStatements, "
CREATE TABLE `users` ( CREATE TABLE `users` (
@ -81,14 +81,14 @@ CREATE TABLE `users` (
`password` char(128) NOT NULL, `password` char(128) NOT NULL,
`salt` char(64) NOT NULL, `salt` char(64) NOT NULL,
`last_login` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP `last_login` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
);"); ) ENGINE = InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;");
array_push($SQLStatements, " array_push($SQLStatements, "
CREATE TABLE `sessions` ( CREATE TABLE `sessions` (
`session_id` varchar(255), `session_id` varchar(255),
`user` INT NOT NULL, `user` INT NOT NULL,
`expires` datetime NOT NULL `expires` datetime NOT NULL
);"); ) ENGINE = InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;");
array_push($SQLStatements, " array_push($SQLStatements, "
CREATE TABLE `Rezept` ( CREATE TABLE `Rezept` (
@ -96,7 +96,7 @@ CREATE TABLE `Rezept` (
`Name` varchar(255) NOT NULL, `Name` varchar(255) NOT NULL,
`Dauer` int(11) NOT NULL, `Dauer` int(11) NOT NULL,
`Beschreibung` text NOT NULL `Beschreibung` text NOT NULL
);"); ) ENGINE = InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;");
array_push($SQLStatements, " array_push($SQLStatements, "
CREATE TABLE `RezeptZutat` ( CREATE TABLE `RezeptZutat` (
@ -105,13 +105,13 @@ CREATE TABLE `RezeptZutat` (
`Menge` float NOT NULL, `Menge` float NOT NULL,
`Einheit` int(11) NOT NULL, `Einheit` int(11) NOT NULL,
`Zutat` int(11) NOT NULL `Zutat` int(11) NOT NULL
);"); ) ENGINE = InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;");
array_push($SQLStatements, " array_push($SQLStatements, "
CREATE TABLE `Zutat` ( CREATE TABLE `Zutat` (
`ID` int(11) NOT NULL, `ID` int(11) NOT NULL,
`Name` varchar(255) NOT NULL `Name` varchar(255) NOT NULL
);"); ) ENGINE = InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;");
array_push($SQLStatements, " array_push($SQLStatements, "
CREATE VIEW `ViewEinkauf` AS select `Einkauf`.`ID` AS `ID`,`Einkauf`.`Anzahl` AS `Anzahl`,`Einheit`.`Name` AS `Einheit`,`Einkauf`.`Name` AS `Name`,`Einkauf`.`Erledigt` AS `Erledigt` from (`Einkauf` join `Einheit` on((`Einkauf`.`Einheit` = `Einheit`.`ID`))) ;"); CREATE VIEW `ViewEinkauf` AS select `Einkauf`.`ID` AS `ID`,`Einkauf`.`Anzahl` AS `Anzahl`,`Einheit`.`Name` AS `Einheit`,`Einkauf`.`Name` AS `Name`,`Einkauf`.`Erledigt` AS `Erledigt` from (`Einkauf` join `Einheit` on((`Einkauf`.`Einheit` = `Einheit`.`ID`))) ;");

View file

@ -32,6 +32,6 @@
</div> </div>
<script src="bin/bootstrap.bundle.min.js"></script> <script src="js/bootstrap.bundle.min.js"></script>
</body> </body>
</html> </html>