-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
schema: Fix broken upgrade script 1.3.0
#856
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. That should not have happened. Thanks to @alamp1360 for trying out the current development state.
The fix looks good. To make sure, I have compared the schema change and update script from #792 again.
Thanks for fixing!
PR #792 mistakenly added a `NOT NULL` clause to a nullable columns. This PR corrects that by dropping that clause and adding a `DEFAULT NULL` clause, making it consistent the actual schema file.
d9cc373
to
f7cef36
Compare
Sorry, but I had to force push again because of this :), but it should be fine now! 4c4
< -- Host: localhost Database: icingadb
---
> -- Host: localhost Database: test_test
99c99
< `argument_key_override` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
---
> `argument_key_override` varchar(255) DEFAULT NULL,
393c393
< `argument_key_override` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
---
> `argument_key_override` varchar(255) DEFAULT NULL,
726c726
< ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC;
---
> ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC;
931c931
< `argument_key_override` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
---
> `argument_key_override` varchar(255) DEFAULT NULL,
1478c1478
< -- Dump completed on 2024-11-20 12:39:24
---
> -- Dump completed on 2024-11-20 12:39:36 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$ docker run --name mariadb -e MARIADB_ROOT_PASSWORD=supersicher -p 3306:3306 -d mariadb:latest
$ docker exec -it mariadb mariadb --password=supersicher --binary-as-hex
MariaDB [(none)]> create database icingadb;
MariaDB [(none)]> ^D
$ git checkout v1.2.0
$ docker exec -i mariadb mariadb -p --password=supersicher --binary-as-hex icingadb < schema/mysql/schema.sql
$ git checkout broken-upgrade-script
$ git rev-parse HEAD
f7cef3679980f36b466258783db98826d08dd253
$ docker exec -i mariadb mariadb -p --password=supersicher --binary-as-hex icingadb < schema/mysql/upgrades/1.3.0.sql
$ docker exec -it mariadb mariadb-dump -p --password=supersicher icingadb > pr856-after-upgrade.sql
$ docker exec -it mariadb mariadb --password=supersicher --binary-as-hex
MariaDB [(none)]> drop database icingadb;
MariaDB [(none)]> create database icingadb;
MariaDB [(none)]> ^D
$ docker exec -i mariadb mariadb -p --password=supersicher --binary-as-hex icingadb < schema/mysql/schema.sql
$ docker exec -it mariadb mariadb-dump -p --password=supersicher icingadb > pr856-schema-import.sql
$ diff -u pr856-*
--- pr856-after-upgrade.sql 2024-12-06 11:28:12.326222486 +0100
+++ pr856-schema-import.sql 2024-12-06 11:29:34.374459652 +0100
@@ -966,7 +966,7 @@
`version` smallint(5) unsigned NOT NULL,
`timestamp` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC;
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;
--
@@ -976,8 +976,7 @@
LOCK TABLES `icingadb_schema` WRITE;
/*!40000 ALTER TABLE `icingadb_schema` DISABLE KEYS */;
INSERT INTO `icingadb_schema` VALUES
-(1,5,1733480520000),
-(2,6,1733480684000);
+(1,6,1733480964000);
/*!40000 ALTER TABLE `icingadb_schema` ENABLE KEYS */;
UNLOCK TABLES;
@@ -2027,4 +2026,4 @@
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*M!100616 SET NOTE_VERBOSITY=@OLD_NOTE_VERBOSITY */;
--- Dump completed on 2024-12-06 10:28:12
+-- Dump completed on 2024-12-06 10:29:34
PR #792 mistakenly added a
NOT NULL
clause to a nullable columns. This PR corrects that by dropping that clause and adding aDEFAULT NULL
clause, making it consistent the actual schema file.fixes #855