mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
SQL MODE code may fail in other drivers, use Dongle instead
This commit is contained in:
parent
f45c04a3aa
commit
f5633c1bc6
@ -2,6 +2,12 @@
|
||||
|
||||
use October\Rain\Database\Updates\Migration;
|
||||
|
||||
/**
|
||||
* This migration addresses a MySQL specific issue around STRICT MODE.
|
||||
* In past versions, Laravel would give timestamps a bad default value
|
||||
* of "0" considered invalid by MySQL. Strict mode is disabled and the
|
||||
* the timestamps are patched up. Credit for this work: Dave Shoreman.
|
||||
*/
|
||||
class DbBackendTimestampFix extends Migration
|
||||
{
|
||||
protected $backendTables = [
|
||||
@ -12,9 +18,7 @@ class DbBackendTimestampFix extends Migration
|
||||
|
||||
public function up()
|
||||
{
|
||||
// Disable all special modes such as NO_ZERO_DATE to prevent any
|
||||
// errors from MySQL before we can update the timestamp columns.
|
||||
Db::statement("SET @@SQL_MODE=''");
|
||||
DbDongle::disableStrictMode();
|
||||
|
||||
foreach ($this->backendTables as $table) {
|
||||
DbDongle::convertTimestamps($table);
|
||||
|
@ -2,13 +2,18 @@
|
||||
|
||||
use October\Rain\Database\Updates\Migration;
|
||||
|
||||
/**
|
||||
* This migration addresses a MySQL specific issue around STRICT MODE.
|
||||
* In past versions, Laravel would give timestamps a bad default value
|
||||
* of "0" considered invalid by MySQL. Strict mode is disabled and the
|
||||
* the timestamps are patched up. Credit for this work: Dave Shoreman.
|
||||
*/
|
||||
class DbCmsTimestampFix extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
// Disable all special modes such as NO_ZERO_DATE to prevent any
|
||||
// errors from MySQL before we can update the timestamp columns.
|
||||
Db::statement("SET @@SQL_MODE=''");
|
||||
DbDongle::disableStrictMode();
|
||||
|
||||
DbDongle::convertTimestamps('cms_theme_data');
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,9 @@ class DbSystemPluginHistoryDetailText extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
// Migration occurs before timestamps are patched (see next migration)
|
||||
DbDongle::disableStrictMode();
|
||||
|
||||
Schema::table('system_plugin_history', function (Blueprint $table) {
|
||||
$table->text('detail')->nullable()->change();
|
||||
});
|
||||
|
@ -2,6 +2,12 @@
|
||||
|
||||
use October\Rain\Database\Updates\Migration;
|
||||
|
||||
/**
|
||||
* This migration addresses a MySQL specific issue around STRICT MODE.
|
||||
* In past versions, Laravel would give timestamps a bad default value
|
||||
* of "0" considered invalid by MySQL. Strict mode is disabled and the
|
||||
* the timestamps are patched up. Credit for this work: Dave Shoreman.
|
||||
*/
|
||||
class DbSystemTimestampFix extends Migration
|
||||
{
|
||||
protected $coreTables = [
|
||||
@ -19,9 +25,7 @@ class DbSystemTimestampFix extends Migration
|
||||
|
||||
public function up()
|
||||
{
|
||||
// Disable all special modes such as NO_ZERO_DATE to prevent any
|
||||
// errors from MySQL before we can update the timestamp columns.
|
||||
Db::statement("SET @@SQL_MODE=''");
|
||||
DbDongle::disableStrictMode();
|
||||
|
||||
foreach ($this->coreTables as $table => $columns) {
|
||||
if (is_int($table)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user