You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Simone Viani (JIRA)" <ji...@apache.org> on 2014/01/22 12:49:19 UTC

[jira] [Updated] (OFBIZ-5503) New not-null/pk columns created nullable

     [ https://issues.apache.org/jira/browse/OFBIZ-5503?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Simone Viani updated OFBIZ-5503:
--------------------------------

    Description: 
Newly not-nullable or pk fields are always created as nullable columns
in the database, they are correctly created only with new tables.

See differences in:
{code}
org.ofbiz.entity.jdbc.DatabaseUtil.createTable(ModelEntity, Map<String, ModelEntity>, boolean)
org.ofbiz.entity.jdbc.DatabaseUtil.addColumn(ModelEntity, ModelField)
{code}

Method addColumn is missing the following:
{code}
if (field.getIsNotNull() || field.getIsPk()) { ... }
{code}

I think it's worth to try creating a not-null column with default value at least when resizing:
{code}
org.ofbiz.entity.jdbc.DatabaseUtil.repairColumnSize(ModelEntity, ModelField, List<String>)
{code}


  was:
Newly not-nullable or pk fields are always created as nullable columns
in the database, they are correctly created only with new tables.

See differences in:
{code}
org.ofbiz.entity.jdbc.DatabaseUtil.createTable(ModelEntity, Map<String, ModelEntity>, boolean)
org.ofbiz.entity.jdbc.DatabaseUtil.addColumn(ModelEntity, ModelField)
{code}

Method addColumn is missing the following:
{code}
if (field.getIsNotNull() || field.getIsPk()) { ... }
{code}



> New not-null/pk columns created nullable
> ----------------------------------------
>
>                 Key: OFBIZ-5503
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-5503
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Simone Viani
>
> Newly not-nullable or pk fields are always created as nullable columns
> in the database, they are correctly created only with new tables.
> See differences in:
> {code}
> org.ofbiz.entity.jdbc.DatabaseUtil.createTable(ModelEntity, Map<String, ModelEntity>, boolean)
> org.ofbiz.entity.jdbc.DatabaseUtil.addColumn(ModelEntity, ModelField)
> {code}
> Method addColumn is missing the following:
> {code}
> if (field.getIsNotNull() || field.getIsPk()) { ... }
> {code}
> I think it's worth to try creating a not-null column with default value at least when resizing:
> {code}
> org.ofbiz.entity.jdbc.DatabaseUtil.repairColumnSize(ModelEntity, ModelField, List<String>)
> {code}



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)