2020-06-08 16:25:23 +02:00
|
|
|
<?php
|
2020-08-04 11:25:22 +00:00
|
|
|
|
2021-06-08 09:52:11 +00:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2020-06-08 16:25:23 +02:00
|
|
|
/**
|
2021-05-19 16:35:13 +00:00
|
|
|
* Class AddPlatforms Creates platforms table in database
|
2020-06-10 15:00:12 +00:00
|
|
|
*
|
2022-02-19 16:06:11 +00:00
|
|
|
* @copyright 2020 Ad Aures
|
2020-06-08 16:25:23 +02:00
|
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
|
|
|
* @link https://castopod.org/
|
|
|
|
*/
|
2020-06-10 15:00:12 +00:00
|
|
|
|
2020-06-08 16:25:23 +02:00
|
|
|
namespace App\Database\Migrations;
|
|
|
|
|
2020-06-10 15:00:12 +00:00
|
|
|
use CodeIgniter\Database\Migration;
|
2020-06-08 16:25:23 +02:00
|
|
|
|
|
|
|
class AddPlatforms extends Migration
|
|
|
|
{
|
2021-05-06 14:00:48 +00:00
|
|
|
public function up(): void
|
2020-06-08 16:25:23 +02:00
|
|
|
{
|
|
|
|
$this->forge->addField([
|
2020-11-18 17:17:56 +00:00
|
|
|
'slug' => [
|
2020-06-08 16:25:23 +02:00
|
|
|
'type' => 'VARCHAR',
|
2020-10-29 15:45:19 +00:00
|
|
|
'constraint' => 32,
|
2020-11-18 17:17:56 +00:00
|
|
|
],
|
|
|
|
'type' => [
|
|
|
|
'type' => 'ENUM',
|
|
|
|
'constraint' => ['podcasting', 'social', 'funding'],
|
2020-06-08 16:25:23 +02:00
|
|
|
],
|
2020-08-27 10:05:44 +00:00
|
|
|
'label' => [
|
2020-06-08 16:25:23 +02:00
|
|
|
'type' => 'VARCHAR',
|
2020-10-29 15:45:19 +00:00
|
|
|
'constraint' => 32,
|
2020-06-08 16:25:23 +02:00
|
|
|
],
|
2020-08-27 10:05:44 +00:00
|
|
|
'home_url' => [
|
2020-06-08 16:25:23 +02:00
|
|
|
'type' => 'VARCHAR',
|
2020-10-29 15:45:19 +00:00
|
|
|
'constraint' => 255,
|
2020-06-08 16:25:23 +02:00
|
|
|
],
|
2020-08-27 10:05:44 +00:00
|
|
|
'submit_url' => [
|
2020-06-08 16:25:23 +02:00
|
|
|
'type' => 'VARCHAR',
|
2020-10-29 15:45:19 +00:00
|
|
|
'constraint' => 512,
|
2020-06-08 16:25:23 +02:00
|
|
|
'null' => true,
|
|
|
|
],
|
|
|
|
]);
|
2022-04-14 14:33:53 +00: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()'
|
|
|
|
);
|
2021-04-02 17:20:02 +00:00
|
|
|
$this->forge->addPrimaryKey('slug');
|
2020-06-08 16:25:23 +02:00
|
|
|
$this->forge->createTable('platforms');
|
|
|
|
}
|
|
|
|
|
2021-05-06 14:00:48 +00:00
|
|
|
public function down(): void
|
2020-06-08 16:25:23 +02:00
|
|
|
{
|
|
|
|
$this->forge->dropTable('platforms');
|
|
|
|
}
|
|
|
|
}
|