How to implement DbDongle::convertTimestamps as workaround of invalid timestamps with MySql strict
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?
Answer
If you want to stay on an older version of October:
- Ignore these instructions
- Add
'strict' => false
to your database config
If you are using the latest version of October (Laravel LTS):
- Fresh installs using
->timestamps()
are created to be nullable from the start - No action is required
If you are upgrading from an old version of October to the latest:
- Use the
convertTimestamps
method to patch the database
Related Questions
- → OctoberCMS Backend Loging Hash Error
- → "failed to open stream" error when executing "migrate:make"
- → OctoberCMS - How to make collapsible list default to active only on non-mobile
- → Create plugin that makes objects from model in back-end
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → How to install console for plugin development in October CMS
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → How to update data attribute on Ajax complete
- → October CMS - Conditionally Load a Different Page