Ad

How To Implement DbDongle::convertTimestamps As Workaround Of Invalid Timestamps With MySql Strict

- 1 answer

Coming from here: https://octobercms.com/support/article/rn-4

This question comes to mind: do all tables originally made with ...

$table->timestamps();

... needs to be updated with the solution stated in the article?

And also, do I have to re-write the old migration scripts to make all custom timestamp columns nullable? Like:

$table->timestamp('col_name')->nullable();

Note: using the new method from the article

DbDongle::convertTimestamps('users', ['created_at', 'updated_at', 'last_login']);

... renders the plugin useless for older October instances. This is a huge drawback imho. How do other authors deal with this?

Ad

Answer

If you want to stay on an older version of October:

  1. Ignore these instructions
  2. Add 'strict' => false to your database config

If you are using the latest version of October (Laravel LTS):

  1. Fresh installs using ->timestamps() are created to be nullable from the start
  2. No action is required

If you are upgrading from an old version of October to the latest:

  1. Use the convertTimestamps method to patch the database
Ad
source: stackoverflow.com
Ad