Added valid_since and valid_until columns to shoirt_urls table

This commit is contained in:
Alejandro Celaya
2017-10-21 11:39:27 +02:00
parent 97a54aef06
commit 68b4cfbae0
5 changed files with 49 additions and 18 deletions

View File

@@ -0,0 +1,41 @@
<?php
declare(strict_types=1);
namespace ShlinkMigrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\SchemaException;
use Doctrine\DBAL\Types\Type;
/**
* Auto-generated Migration: Please modify to your needs!
*/
class Version20171021093246 extends AbstractMigration
{
/**
* @param Schema $schema
* @throws SchemaException
*/
public function up(Schema $schema)
{
$shortUrls = $schema->getTable('short_urls');
$shortUrls->addColumn('valid_since', Type::DATETIME, [
'notnull' => false,
]);
$shortUrls->addColumn('valid_until', Type::DATETIME, [
'notnull' => false,
]);
}
/**
* @param Schema $schema
* @throws SchemaException
*/
public function down(Schema $schema)
{
$shortUrls = $schema->getTable('short_urls');
$shortUrls->dropColumn('valid_since');
$shortUrls->dropColumn('valid_until');
}
}