School extension - Compatibility issues with Joomla 4 - Please help

Be informed that this forum is not an official support forum for Joomla! 4.0. Any issues regarding Joomla! 4.0 must be reported at https://issues.joomla.org/.

Joomla 4.0 is still in Beta stage. This forum should be used for sharing information about Joomla! 4.0.

Moderator: ooffick

Forum rules
Locked
laest
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Tue Nov 17, 2020 12:24 pm

School extension - Compatibility issues with Joomla 4 - Please help

Post by laest » Tue Nov 17, 2020 12:55 pm

Hello everybody!

We use Joomla as CMS for our school's website for years and we are really happy with it. For the new Joomla 4 release we plan do redesign und tidy up our school's website. Therefore, I already set up a testing installation of J4 to anticipate possible compatibility issues. As expected we have a big issue with a pretty old, yet funktioning version (works well with joomla 3.9.22) of our school-management extension.

As soon as I upload the .zip to joomla 4 there is an issue with the import of the initial database tables (see screenshots).

Code: Select all

JInstaller: :Install: SQL-Fehler Field 'anfang' doesn't have a default value
I found out that with joomla 4 some things have changed regarding the database scheme, but I am not able to fix this problem, as I am not a professional software developer. Therefore, it would very kind if someone could give me kind of a hint or assist me to get this extension back working on joomla 4 since we heavily rely on this extention.


Thank you in advance for your time and your help! Best regards

Wolfi
You do not have the required permissions to view the files attached to this post.

User avatar
ceford
Joomla! Hero
Joomla! Hero
Posts: 2762
Joined: Mon Feb 24, 2014 10:38 pm
Location: Edinburgh, Scotland
Contact:

Re: School extension - Compatibility issues with Joomla 4 - Please help

Post by ceford » Tue Nov 17, 2020 1:11 pm

I guess anfang is a date field. If you look at the backward compatibility issues:

https://docs.joomla.org/Potential_backw ... _Extension

you will see that a default date should be null or a specific date. So setting a date NOT NULL but not giving a default will not work.

laest
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Tue Nov 17, 2020 12:24 pm

Re: School extension - Compatibility issues with Joomla 4 - Please help

Post by laest » Tue Nov 17, 2020 1:54 pm

ceford wrote:
Tue Nov 17, 2020 1:11 pm
I guess anfang is a date field. If you look at the backward compatibility issues:

https://docs.joomla.org/Potential_backw ... _Extension

you will see that a default date should be null or a specific date. So setting a date NOT NULL but not giving a default will not work.
Thank you for your quick reply. So I just changed the two fields 'anfang' from NOT NULL to NULL which then brought me to the same error for another field with a date. Therefore, I also set 'ende' to NULL. This led me to the following error:

Code: Select all

BLOB/TEXT column 'params' can't have a default value
which I hope to have resolved correctly be simply deleting the DEFAULT in the corresponding line. This in turn brought up

Code: Select all

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8' at line 11
and I have no clue how to fix this. I quickly checked the MySQL 5.6.44 manual as suggested, but I did not find a solution since line 11 is a blank line. Maybe you can help me out again.

Thanks in advance!

Edit: Here are the lines 1 to 12 of the install sql file:

Code: Select all

DROP TABLE IF EXISTS `#__schule_schueler`;

CREATE TABLE `#__schule_schueler` (
	`id` INT(11) NOT NULL AUTO_INCREMENT,
	`klasse` VARCHAR(10) NOT NULL,
	`name` VARCHAR(255) NOT NULL,
	`schueleremail` VARCHAR(100) NOT NULL,
	`elternemail` VARCHAR(100) NOT NULL,
	PRIMARY KEY (id)
	) ENGINE=MyISAM DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `#__schule_user_eltern_map`;

User avatar
ceford
Joomla! Hero
Joomla! Hero
Posts: 2762
Joined: Mon Feb 24, 2014 10:38 pm
Location: Edinburgh, Scotland
Contact:

Re: School extension - Compatibility issues with Joomla 4 - Please help

Post by ceford » Tue Nov 17, 2020 2:10 pm

Here is an extract of Joomla create table sql:

Code: Select all

CREATE TABLE IF NOT EXISTS `#__banners` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `cid` int(11) NOT NULL DEFAULT 0,
  `type` int(11) NOT NULL DEFAULT 0,
  `name` varchar(255) NOT NULL DEFAULT '',
...
  `version` int(10) unsigned NOT NULL DEFAULT 1,
  PRIMARY KEY (`id`),
...
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
Use that as guide to how to revise your sql statements. Note that there are good reasons to use the InnoDB engine in Joomla 4. And utf8mb4 rather than utf8.

laest
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Tue Nov 17, 2020 12:24 pm

Re: School extension - Compatibility issues with Joomla 4 - Please help

Post by laest » Tue Nov 17, 2020 2:51 pm

ceford wrote:
Tue Nov 17, 2020 2:10 pm
Here is an extract of Joomla create table sql:

Code: Select all

CREATE TABLE IF NOT EXISTS `#__banners` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `cid` int(11) NOT NULL DEFAULT 0,
  `type` int(11) NOT NULL DEFAULT 0,
  `name` varchar(255) NOT NULL DEFAULT '',
...
  `version` int(10) unsigned NOT NULL DEFAULT 1,
  PRIMARY KEY (`id`),
...
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
Use that as guide to how to revise your sql statements. Note that there are good reasons to use the InnoDB engine in Joomla 4. And utf8mb4 rather than utf8.
Thanks again for your assistance, I really appreciate it. I tried to figure out what I am doing wrong for a good while now, but I can not get it to work. I adjusted my table creation script regarding your template, but It still shows the same error. At the moment I just edited the first table creation part as I expected the error to jump from line 11 to the next table at line 19, but that was not the case. Here is what I ended up with:

Code: Select all

DROP TABLE IF EXISTS `#__schule_schueler`;

CREATE TABLE IF NOT EXISTS `#__schule_schueler` (
	`id` int(11) NOT NULL AUTO_INCREMENT,
	`klasse` varchar(10) NOT NULL DEFAULT '',
	`name` varchar(255) NOT NULL DEFAULT '',
	`schueleremail` varchar(100) NOT NULL DEFAULT '',
	`elternemail` varchar(100) NOT NULL DEFAULT '',
	PRIMARY KEY (`id`)
	) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
Other tables are created without any problems as far as I have seen in the database itself.

User avatar
ceford
Joomla! Hero
Joomla! Hero
Posts: 2762
Joined: Mon Feb 24, 2014 10:38 pm
Location: Edinburgh, Scotland
Contact:

Re: School extension - Compatibility issues with Joomla 4 - Please help

Post by ceford » Tue Nov 17, 2020 4:13 pm

As the errors get reported just go through the sql and make obvious corrections. Here are some:

Code: Select all

	`anfang` VARCHAR(6) NOT NULL DEFAULT '',

	`ende` VARCHAR(6) NOT NULL DEFAULT '',
	
	`params` TEXT NOT NULL,
Eventually it will install and you will be able to deal with the coding errors.

Your code does not have Joomla 4 structure so it looks like you have a long way to go. I suggest you look at the tutorials: https://docs.joomla.org/JDOC:Joomla_4_Tutorials_Project

There is one on Joomla 3.x to 4.x Step by Step Migration and my own offering J4 Component example - Mywalks - Updated for Beta 4


Locked

Return to “Joomla! 4 Related”