castopod/app/Database/Migrations/2020-06-05-190000_add_platf...

59 lines
1.5 KiB
PHP
Raw Normal View History

2020-06-08 16:25:23 +02:00
<?php
2020-06-08 16:25:23 +02:00
/**
* Class AddPlatforms
* Creates platforms table in database
*
2020-06-08 16:25:23 +02:00
* @copyright 2020 Podlibre
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
* @link https://castopod.org/
*/
2020-06-08 16:25:23 +02:00
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
2020-06-08 16:25:23 +02:00
class AddPlatforms extends Migration
{
public function up()
{
$this->forge->addField([
'slug' => [
2020-06-08 16:25:23 +02:00
'type' => 'VARCHAR',
'constraint' => 32,
],
'type' => [
'type' => 'ENUM',
'constraint' => ['podcasting', 'social', 'funding'],
2020-06-08 16:25:23 +02:00
],
'label' => [
2020-06-08 16:25:23 +02:00
'type' => 'VARCHAR',
'constraint' => 32,
2020-06-08 16:25:23 +02:00
],
'home_url' => [
2020-06-08 16:25:23 +02:00
'type' => 'VARCHAR',
'constraint' => 255,
2020-06-08 16:25:23 +02:00
],
'submit_url' => [
2020-06-08 16:25:23 +02:00
'type' => 'VARCHAR',
'constraint' => 512,
2020-06-08 16:25:23 +02:00
'null' => true,
'default' => null,
2020-06-08 16:25:23 +02:00
],
]);
$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()'
);
$this->forge->addKey('slug', true);
2020-06-08 16:25:23 +02:00
$this->forge->createTable('platforms');
}
public function down()
{
$this->forge->dropTable('platforms');
}
}