Skip to content

Conversation

@laoneo
Copy link
Member

@laoneo laoneo commented Mar 5, 2018

It's not possible to create a module in J4. An error is displayed:
Save failed with the following error: Field 'content' doesn't have a default value

I guess it is not required to have a content for the module, so we can remove it from the table structure.

@alikon can you help me out with the update script of postgres?

@wilsonge
Copy link
Contributor

wilsonge commented Mar 5, 2018

Looks good to me. Can you do some update files as well please - I want to start gearing up for a 3.9 alpha 1 where you can upgrade to 4.0

@laoneo
Copy link
Member Author

laoneo commented Mar 6, 2018

There is an update file. Only the one for postgres is missing.

"title" varchar(100) DEFAULT '' NOT NULL,
"note" varchar(255) DEFAULT '' NOT NULL,
"content" text DEFAULT '' NOT NULL,
"content" text DEFAULT '' NULL,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't make sense to have a default value specified if the field is allowed to be NULL, right?

@alikon
Copy link
Contributor

alikon commented Mar 6, 2018

add in administrator/components/com_admin/sql/updates/postgresql/4.0.0-2018-03-05.sql
ALTER TABLE "#__modules" ALTER COLUMN "content" DROP NOT NULL;

but shouldn't work without #19707

p.s
unable to open pr on your branch

@laoneo
Copy link
Member Author

laoneo commented Mar 7, 2018

Thanks @alikon, added the script. Can you double check the changes in the joomla.sql of postgres? Are they ok?

"title" varchar(100) DEFAULT '' NOT NULL,
"note" varchar(255) DEFAULT '' NOT NULL,
"content" text DEFAULT '' NOT NULL,
"content" text NULL,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be
"content" text,

@laoneo
Copy link
Member Author

laoneo commented Mar 7, 2018

I guess we are here fine.

@alikon
Copy link
Contributor

alikon commented Mar 7, 2018

#19707 apart yes

@anuragteapot
Copy link
Contributor

@laoneo its fine modules save success :)

@wilsonge
Copy link
Contributor

wilsonge commented Mar 8, 2018

You need to use Alter Column in the mysql change please otherwise the schema checker (https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/src/Schema/ChangeItem/MysqlChangeItem.php) won't pick it up

@laoneo
Copy link
Member Author

laoneo commented Mar 8, 2018

There is no Alter Column or do I miss something here?

@wilsonge
Copy link
Contributor

wilsonge commented Mar 8, 2018

OK I'm just being dumb. We also have support for change https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/src/Schema/ChangeItem/MysqlChangeItem.php#L168

But looks like currently it's only going to work for changing column types. Not for swapping things to not null. In fact the "kludge" for integer unsigned is going to trigger with TEXT NULL tho right? https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/src/Schema/ChangeItem/MysqlChangeItem.php#L170-L176

@brianteeman
Copy link
Contributor

Isnt this the same as #17752 ??

@laoneo
Copy link
Member Author

laoneo commented Apr 8, 2018

This one here is a subset of it and solves one purpose to fix creating modules. #17752 does more and needs carefully be tested as there should basically be a test case for every change in the install scripts which got changed. #17752 is also not finished as the update scripts are missing.

@laoneo
Copy link
Member Author

laoneo commented May 8, 2018

Where do we stay here? I think it would be not bad when we release the next alpha to be able to create modules.

@Quy
Copy link
Contributor

Quy commented May 22, 2018

But looks like currently it's only going to work for changing column types. Not for swapping things to not null. In fact the "kludge" for integer unsigned is going to trigger with TEXT NULL tho right?

After PR and database fix, the modules table stayed the same.
Tested with 5.5.5-10.1.29-MariaDB

@wilsonge wilsonge merged commit 69734e4 into joomla:4.0-dev May 30, 2018
@wilsonge wilsonge deleted the j4/fix/module branch May 30, 2018 22:51
@wilsonge wilsonge added this to the Joomla 4.0 milestone May 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants