Voyager: Error when adding new fields to table of existing bread

Created on 31 Dec 2019  路  5Comments  路  Source: the-control-group/voyager

Version information

  • Laravel: v6.9.0
  • Voyager: v1.3.x-dev 05f5a4f
  • PHP: 7.3.6
  • Database: MySQL 5.7

Description


When adding a new field in database to the table with existing bread, saving bread produces following error:

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'display_name' cannot be null (SQL: insert into data_rows (field, data_type_id, browse, read, edit, add, delete, required, type, details, display_name, order) values (test, 24, 1, 1, 1, 1, 1, 0, text, {}, ?, 13))

Steps To Reproduce

Steps to reproduce the behavior:

  1. Create a table and model
  2. Add bread for that table and save
  3. Go to the table and add new column for that table
  4. Edit the bread for that table and save

Expected behavior

No error

addressed bug

All 5 comments

As the error says display_name cannot be null.
When you create a BREAD all field names are auto populated with column name but when you add a new field the display name is empty and need to be set manually.

Not sure if it would be easy to match the behaviour on edit as on create.

I would count this as an improvement rather than a bug.

Solution
When you add a field in database set the name for that field on BREAD before saving.

I just checked and since on edit there is i18n involved for translations I can't implement a quick fix as I hoped.

@mrhn2005 I just had the same issue following your steps to reproduce. My error notice was "model doesn't exist", so I deleted the bread & table entirely, had to manually delete the Model before then trying to recreate both, now the bread comes up blank after creation/save, can't add relationship etc.

@mrhn2005 I just had the same issue following your steps to reproduce. My error notice was "model doesn't exist",.

That's another issue and it normally means what it says, so you have to check if you are setting the rightModel and namespace is correct.

For the blank problem you could open another issue but 99% you are doing something wrong.
Try to create another BREAD with another name, if you have the same problem try asking on Voyager Slack group.

This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.

Was this page helpful?
0 / 5 - 0 ratings