SQL: missing field_id in Globals from entries Type

when I create a field of type “entries” in my Global section…I get the following error.

"SQLSTATE[HY000]: General error: 1 no such column: landingpage_id (SQL: update "tailor_globals" set "content" = {"website_name":"","favicon":"","logo":""}, "landingpage_id" = 1, "updated_at" = 2022-07-11 12:19:36 where "id" = 2)"

is this a bug or am I doing something wrong? my form-field looks like this:

  landingpage:
    maxItems: 1
    label: Home Page
    type: entries
    source: Content\Page

Make sure you migrate the database so the column is added to the table.

php artisan october:migrate

Hi daftspunky, of course I have already done that :man_shrugging:

Check the database table to see what is happening. The table name is based on the uuid. So if the uuid is:

uuid: 4d7fd1e4-85f2-48f5-947e-92819fc8664b

The table will be

xc_4d7fd1e485f248f5947e92819fc8664bc

You should be able to see if a landingpage_id column exists, or has been renamed to something else.

It is unusual for the column not to exist if the migration has run because Tailor uses a comparison process to compare fields it wants with fields the table has.

ok, I have found the issue.

when I create a field of “type: entries” and use the command “php artisan october:migrate” in VScode it does not work.

however, if I save the file via the oc-editor it works.

Just a follow up here. Turns out this was a bad bug in the code that should be fixed in v3.0.62. Two things were happening:

  • Globals were not accepting something_id column names, which is fixed.

  • The Editor was allowing globals to be migrated, so the generic global table had blueprint columns added to it, which should not happen.

The extra columns should not be a problem. However, if you want to keep the table clean, you can recreate the tailor_globals table. Code to recreate table as of July 2022:

Schema::dropIfExists('tailor_globals');
Schema::create('tailor_globals', function ($table) {
    $table->increments('id');
    $table->integer('site_id')->nullable()->index();
    $table->string('blueprint_uuid')->nullable()->index();
    $table->longText('content')->nullable();
    $table->timestamp('deleted_at')->nullable();
    $table->timestamps();
});

You can paste this into php artisan tinker and it will recreate the table, but also delete all the data for every global blueprint type.

1 Like