mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-14 14:24:24 +00:00
add time to field date, prepare and run migration script
This commit is contained in:
parent
d123e4137f
commit
7b8f2d1206
@ -12,7 +12,7 @@ Chill\EventBundle\Entity\Event:
|
||||
type: string
|
||||
length: '150'
|
||||
date:
|
||||
type: date
|
||||
type: datetime
|
||||
oneToMany:
|
||||
participations:
|
||||
targetEntity: Chill\EventBundle\Entity\Participation
|
||||
|
29
Resources/migrations/Version20190110140538.php
Normal file
29
Resources/migrations/Version20190110140538.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Application\Migrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Switch event date to datetime
|
||||
*/
|
||||
final class Version20190110140538 extends AbstractMigration
|
||||
{
|
||||
public function up(Schema $schema) : void
|
||||
{
|
||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
|
||||
|
||||
$this->addSql('ALTER TABLE chill_event_event ALTER date TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
|
||||
$this->addSql('ALTER TABLE chill_event_event ALTER date DROP DEFAULT');
|
||||
|
||||
}
|
||||
|
||||
public function down(Schema $schema) : void
|
||||
{
|
||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
|
||||
|
||||
$this->addSql('ALTER TABLE chill_event_event ALTER date TYPE DATE');
|
||||
$this->addSql('ALTER TABLE chill_event_event ALTER date DROP DEFAULT');
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user