You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
causes exception DateTimeImmutable::__construct(): Failed to parse time string (addtime(`Date`,'2:00:00')) at position 0 (a): The timezone could not be found in the database.
Full backtrace:
Exception: DateTimeImmutable::__construct(): Failed to parse time string (addtime(`Date`,'2:00:00')) at position 0 (a): The timezone could not be found in the database in ~/vendor/cycle/database/src/Schema/AbstractColumn.php:754
Stack trace:
#0 ~/vendor/cycle/database/src/Schema/AbstractColumn.php(754): DateTimeImmutable->__construct()
#1 ~/vendor/cycle/database/src/Driver/MySQL/Schema/MySQLColumn.php(372): Cycle\Database\Schema\AbstractColumn->formatDatetime()
#2 ~/vendor/cycle/database/src/Schema/AbstractColumn.php(370): Cycle\Database\Driver\MySQL\Schema\MySQLColumn->formatDatetime()
#3 ~/vendor/cycle/database/src/Schema/AbstractColumn.php(666): Cycle\Database\Schema\AbstractColumn->getDefaultValue()
#4 ~/vendor/cycle/database/src/Driver/MySQL/Schema/MySQLColumn.php(299): Cycle\Database\Schema\AbstractColumn->compare()
#5 ~/vendor/cycle/database/src/Schema/Comparator.php(108): Cycle\Database\Driver\MySQL\Schema\MySQLColumn->compare()
#6 ~/vendor/cycle/database/src/Schema/AbstractTable.php(705): Cycle\Database\Schema\Comparator->alteredColumns()
#7 ~/vendor/cycle/database/src/Schema/AbstractTable.php(619): Cycle\Database\Schema\AbstractTable->normalizeSchema()
#8 ~/vendor/cycle/migrations/src/Operation/Table/Update.php(28): Cycle\Database\Schema\AbstractTable->save()
#9 ~/vendor/cycle/migrations/src/Capsule.php(69): Cycle\Migrations\Operation\Table\Update->execute()
#10 ~/vendor/cycle/migrations/src/TableBlueprint.php(243): Cycle\Migrations\Capsule->execute()
#11 ~/vendor/cycle/migrations/src/TableBlueprint.php(197): Cycle\Migrations\TableBlueprint->execute()
#12 ~/schema/inv/20231013.155347_0_inv.ip_ipmi_role.php(32): Cycle\Migrations\TableBlueprint->update()
#13 ~/dev/seeding-executor.php(73): ~\Migrations\inv\migrationclass->up()
#14 ~/vendor/cycle/database/src/Database.php(188): ~\Migrations\{closure}()
#15 ~/dev/seeding-executor.php(74): Cycle\Database\Database->transaction()
#16 {main}
Is this a regression?
Not that I know.
To Reproduce
classMigrationClassextendsMigration {
/** * Create tables, add columns or insert data here */publicfunctionup() {
$this->table('table_a')
->addColumn('ttl', 'timestamp', [
'nullable' => true,
'default' => newFragment('ADDTIME(`Date`, \'2:00:00\')'),
])
->update();
}
/** * Drop created, columns and etc here */publicfunctiondown() {
$this->table('table_a')
->dropColumn('ttl')
->update();
}
}
Expected behaviour
A column should be added with default value set to +2 hours from time of row creation.
Media prove
No response
Database
MySQL
Your environment
OS: CentOs Stream
PHP 8.0.30
cycle/migrations 3.1.0
cycle/database 2.7.0
Additional context
No response
The text was updated successfully, but these errors were encountered:
After some additional investigation, it turned out the issue arise when Cycle tries to understand the database structure.
I.e.:
Step#1: Creating database with such column: it's fine.
Step#2: Reading the table from database (f.e. to further modify it) in the next migration: fails.
No duplicates 🥲.
Describe the bug
Trying to execute migration with default value set as Fragment
causes exception
DateTimeImmutable::__construct(): Failed to parse time string (addtime(`Date`,'2:00:00')) at position 0 (a): The timezone could not be found in the database
.Full backtrace:
Is this a regression?
Not that I know.
To Reproduce
Expected behaviour
A column should be added with default value set to +2 hours from time of row creation.
Media prove
No response
Database
MySQL
Your environment
Additional context
No response
The text was updated successfully, but these errors were encountered: