Newer
Older

Yassine Doghri
committed

Yassine Doghri
committed
declare(strict_types=1);
* Class AddPlatforms Creates platforms table in database
* @copyright 2020 Ad Aures
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
* @link https://castopod.org/
*/
class AddPlatforms extends BaseMigration

Yassine Doghri
committed
public function up(): void
'slug' => [
'type' => 'VARCHAR',
'constraint' => 32,
],
'type' => [
'type' => 'ENUM',
'constraint' => ['podcasting', 'social', 'funding'],
'type' => 'VARCHAR',
'constraint' => 32,
'type' => 'VARCHAR',
'constraint' => 255,
'type' => 'VARCHAR',
'constraint' => 512,
'null' => true,

Yassine Doghri
committed
$this->forge->addField('`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP()');
$this->forge->addField(
'`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP() ON UPDATE CURRENT_TIMESTAMP()',

Yassine Doghri
committed
);
$this->forge->addPrimaryKey('slug');
$this->forge->createTable('platforms');
}

Yassine Doghri
committed
public function down(): void
{
$this->forge->dropTable('platforms');
}
}