This repository was archived by the owner on Jun 4, 2024. It is now read-only.
This repository was archived by the owner on Jun 4, 2024. It is now read-only.
timestamp migrations do not work in MariaDB #100
Description
Customer:
description: customer is the one that orders a campaign
type: object
required:
- id
- name
- created_at
properties:
id:
type: integer
name:
type: string
maxLength: 100
created_at:
type: string
format: datetime
nullable: false
x-db-type: datetime
default: CURRENT_TIMESTAMP
updated_at:
type: string
format: datetime
default: null
nullable: true
x-db-type: datetime
generates a migration:
class m220524_140002_change_table_customers extends \yii\db\Migration
{
public function up()
{
$this->alterColumn('{{%customers}}', 'created_at', $this->timestamp()->notNull()->defaultExpression("CURRENT_TIMESTAMP"));
}
public function down()
{
$this->alterColumn('{{%customers}}', 'created_at', $this->timestamp()->notNull()->defaultExpression("CURRENT_TIMESTAMP"));
}
}