mirror of
https://github.com/tim-krehan/shopping-list.git
synced 2024-11-23 22:30:41 +01:00
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:
commit
c65695e986
5 changed files with 14 additions and 12 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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`))) ;");
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -102,15 +102,14 @@ function changeListItem(){
|
||||||
|
|
||||||
function checkItem() {
|
function checkItem() {
|
||||||
var dataId = $(this).data("id");
|
var dataId = $(this).data("id");
|
||||||
|
var dataIdSelector = (`[data-id='${dataId}']`);
|
||||||
$.post({
|
$.post({
|
||||||
url: "api/list/check",
|
url: "api/list/check",
|
||||||
data: {
|
data: {
|
||||||
// function: "check",
|
|
||||||
id: dataId,
|
id: dataId,
|
||||||
status: $(this).prop("checked")
|
status: $(this).prop("checked")
|
||||||
},
|
},
|
||||||
success: function () {
|
success: function () {
|
||||||
var dataIdSelector = (`[data-id='${dataId}']`);
|
|
||||||
var color = $(dataIdSelector).data("color");
|
var color = $(dataIdSelector).data("color");
|
||||||
$(dataIdSelector).parent().parent().removeClass("bg-danger");
|
$(dataIdSelector).parent().parent().removeClass("bg-danger");
|
||||||
$(dataIdSelector).parent().parent().find(".dropdown-menu-button").removeClass("btn-danger");
|
$(dataIdSelector).parent().parent().find(".dropdown-menu-button").removeClass("btn-danger");
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
$passwd = $CONFIG['passwd'],
|
$passwd = $CONFIG['passwd'],
|
||||||
$database = $CONFIG['database']
|
$database = $CONFIG['database']
|
||||||
);
|
);
|
||||||
|
$mysqli->set_charset("utf8");
|
||||||
if (!is_null($mysqli->connect_error))
|
if (!is_null($mysqli->connect_error))
|
||||||
{
|
{
|
||||||
header("Location: /error/DBConnFailed");
|
header("Location: /error/DBConnFailed");
|
||||||
|
|
Loading…
Reference in a new issue