Merge branch '28-datenbankscript-auf-utf8mb4_bin-umstellen' into 'develop'

Resolve "Datenbankscript auf utf8mb4_bin umstellen"

See merge request bluekay/shopping-list!16
This commit is contained in:
Tim Krehan 2019-06-03 12:26:49 +00:00
commit c65695e986
5 changed files with 14 additions and 12 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)
# 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

View file

@ -42,9 +42,9 @@ if (!is_null($connection->connect_error))
$CONFIG["installed"] = true;
$CONFIG["host"] = $_POST['dbhost'];
$CONFIG["database"] = $_POST['database'];
$CONFIG["username"] = $_POST['username'];
$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?>");
@ -54,14 +54,14 @@ CREATE TABLE `Einheit` (
`ID` int(11) NOT NULL,
`Name` varchar(255) NOT NULL,
`Standard` tinyint(1) NOT NULL
);");
) ENGINE = InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;");
array_push($SQLStatements, "
CREATE TABLE `Einheit` (
`ID` int(11) NOT NULL,
`Name` varchar(255) NOT NULL,
`Standard` tinyint(1) NOT NULL
);");
) ENGINE = InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;");
array_push($SQLStatements, "
CREATE TABLE `Einkauf` (
@ -70,7 +70,7 @@ CREATE TABLE `Einkauf` (
`Einheit` int(11) NOT NULL DEFAULT '5',
`Name` varchar(255) NOT NULL,
`Erledigt` tinyint(1) NOT NULL DEFAULT '0'
);");
) ENGINE = InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;");
array_push($SQLStatements, "
CREATE TABLE `users` (
@ -81,14 +81,14 @@ CREATE TABLE `users` (
`password` char(128) NOT NULL,
`salt` char(64) NOT NULL,
`last_login` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
);");
) ENGINE = InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;");
array_push($SQLStatements, "
CREATE TABLE `sessions` (
`session_id` varchar(255),
`user` INT NOT NULL,
`expires` datetime NOT NULL
);");
) ENGINE = InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;");
array_push($SQLStatements, "
CREATE TABLE `Rezept` (
@ -96,7 +96,7 @@ CREATE TABLE `Rezept` (
`Name` varchar(255) NOT NULL,
`Dauer` int(11) NOT NULL,
`Beschreibung` text NOT NULL
);");
) ENGINE = InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;");
array_push($SQLStatements, "
CREATE TABLE `RezeptZutat` (
@ -105,13 +105,13 @@ CREATE TABLE `RezeptZutat` (
`Menge` float NOT NULL,
`Einheit` int(11) NOT NULL,
`Zutat` int(11) NOT NULL
);");
) ENGINE = InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;");
array_push($SQLStatements, "
CREATE TABLE `Zutat` (
`ID` int(11) NOT NULL,
`Name` varchar(255) NOT NULL
);");
) ENGINE = InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;");
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`))) ;");

View file

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

View file

@ -102,15 +102,14 @@ function changeListItem(){
function checkItem() {
var dataId = $(this).data("id");
var dataIdSelector = (`[data-id='${dataId}']`);
$.post({
url: "api/list/check",
data: {
// function: "check",
id: dataId,
status: $(this).prop("checked")
},
success: function () {
var dataIdSelector = (`[data-id='${dataId}']`);
var color = $(dataIdSelector).data("color");
$(dataIdSelector).parent().parent().removeClass("bg-danger");
$(dataIdSelector).parent().parent().find(".dropdown-menu-button").removeClass("btn-danger");

View file

@ -6,6 +6,7 @@
$passwd = $CONFIG['passwd'],
$database = $CONFIG['database']
);
$mysqli->set_charset("utf8");
if (!is_null($mysqli->connect_error))
{
header("Location: /error/DBConnFailed");