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