defualt value none for database fields #602

Closed
opened 2020-09-19 23:20:55 +00:00 by derakhshana · 3 comments
derakhshana commented 2020-09-19 23:20:55 +00:00 (Migrated from github.com)

Steps to reproduce the issue

When set none for default value for a filed in database tap

Expected result

'column1' INT NULL,

Actual result

'column1' INT NULL DEFAULT '',

System information (as much as possible)

  • OS Name & Version:
  • MySql Version:
  • Apache Version:
  • PHP Version:
  • Joomla Version: 3.9.20
  • JCB Version: 2.11.4
  • Browser:

Additional comments

we expect that when set none for default value it means that no DEFAULT keyword will not appear in the sql install script for that filed but the DEFAULT '' is inserted!

### Steps to reproduce the issue When set none for default value for a filed in database tap ### Expected result 'column1' INT NULL, ### Actual result 'column1' INT NULL DEFAULT '', ### System information (as much as possible) - OS Name & Version: - MySql Version: - Apache Version: - PHP Version: - Joomla Version: 3.9.20 - JCB Version: 2.11.4 - Browser: ### Additional comments we expect that when set none for default value it means that no DEFAULT keyword will not appear in the sql install script for that filed but the DEFAULT '' is inserted!

Let see, yes that seems to be the case. What we can try and do to please as many as possible. Se will need to look at the expected behavior, and then see if we can change things not to break that.

So I initially said if field is NOT NULL and default of none, then we give it a DEFAULT '' which is the expected behavior. But you are saying it is NULL and then I agree it should not add a empty default, since no value should be NULL. Lets see if I can change that.

Would you agree with making only that change?

Let see, yes that seems to be the case. What we can try and do to please as many as possible. Se will need to look at the expected behavior, and then see if we can change things not to break that. So I initially said if field is `NOT NULL` and default of none, then we give it a `DEFAULT ''` which is the expected behavior. But you are saying it is `NULL` and then I agree it should not add a empty default, since no value should be `NULL`. Lets see if I can change that. Would you agree with making only that change?

Okay I am looking over the code, and I am wondering if you can do some tests for me?

So on line 10009 we are checking if the default is "EMPTY" and then adding the null switch. So this EMPTY is set in the Other value like this:
image

Can you try this and see if it resolves your issue.

Okay I am looking over the code, and I am wondering if you can do some tests for me? So on line [10009](https://github.com/vdm-io/Joomla-Component-Builder/blob/staging/admin/helpers/compiler/e_Interpretation.php#L10009) we are checking if the default is "EMPTY" and then adding the null switch. So this EMPTY is set in the Other value like this: ![image](https://user-images.githubusercontent.com/5607939/95269309-6ffde380-0839-11eb-92db-749de3aa8003.png) Can you try this and see if it resolves your issue.

I am closing this, should the solution not work for you, just bump the closed issue again.

I am closing this, should the solution not work for you, just bump the closed issue again.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: joomla/Component-Builder#602
No description provided.