2021-02-10 16:20:01 +00:00
|
|
|
<?php
|
|
|
|
|
2021-06-08 09:52:11 +00:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2021-02-10 16:20:01 +00:00
|
|
|
/**
|
2021-05-19 16:35:13 +00:00
|
|
|
* Class Persons Creates persons table in database
|
2021-02-10 16:20:01 +00:00
|
|
|
*
|
2022-02-19 16:06:11 +00:00
|
|
|
* @copyright 2020 Ad Aures
|
2021-02-10 16:20:01 +00:00
|
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
|
|
|
* @link https://castopod.org/
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
|
|
|
|
|
|
class AddPersons extends Migration
|
|
|
|
{
|
2021-05-06 14:00:48 +00:00
|
|
|
public function up(): void
|
2021-02-10 16:20:01 +00:00
|
|
|
{
|
|
|
|
$this->forge->addField([
|
|
|
|
'id' => [
|
2023-06-12 14:47:38 +00:00
|
|
|
'type' => 'INT',
|
|
|
|
'unsigned' => true,
|
2021-02-10 16:20:01 +00:00
|
|
|
'auto_increment' => true,
|
|
|
|
],
|
|
|
|
'full_name' => [
|
2023-06-12 14:47:38 +00:00
|
|
|
'type' => 'VARCHAR',
|
2021-02-10 16:20:01 +00:00
|
|
|
'constraint' => 192,
|
2023-06-12 14:47:38 +00:00
|
|
|
'comment' => 'This is the full name or alias of the person.',
|
2021-02-10 16:20:01 +00:00
|
|
|
],
|
|
|
|
'unique_name' => [
|
2023-06-12 14:47:38 +00:00
|
|
|
'type' => 'VARCHAR',
|
2021-02-10 16:20:01 +00:00
|
|
|
'constraint' => 192,
|
2023-06-12 14:47:38 +00:00
|
|
|
'comment' => 'This is the slug name or alias of the person.',
|
|
|
|
'unique' => true,
|
2021-02-10 16:20:01 +00:00
|
|
|
],
|
|
|
|
'information_url' => [
|
2023-06-12 14:47:38 +00:00
|
|
|
'type' => 'VARCHAR',
|
2021-02-10 16:20:01 +00:00
|
|
|
'constraint' => 512,
|
2023-06-12 14:47:38 +00:00
|
|
|
'comment' => 'The url to a relevant resource of information about the person, such as a homepage or third-party profile platform.',
|
|
|
|
'null' => true,
|
2021-02-10 16:20:01 +00:00
|
|
|
],
|
2021-12-14 16:41:10 +00:00
|
|
|
'avatar_id' => [
|
2023-06-12 14:47:38 +00:00
|
|
|
'type' => 'INT',
|
2021-12-14 16:41:10 +00:00
|
|
|
'unsigned' => true,
|
2023-06-12 14:47:38 +00:00
|
|
|
'null' => true,
|
2021-04-02 17:20:02 +00:00
|
|
|
],
|
2021-02-10 16:20:01 +00:00
|
|
|
'created_by' => [
|
2023-06-12 14:47:38 +00:00
|
|
|
'type' => 'INT',
|
2021-02-10 16:20:01 +00:00
|
|
|
'unsigned' => true,
|
|
|
|
],
|
|
|
|
'updated_by' => [
|
2023-06-12 14:47:38 +00:00
|
|
|
'type' => 'INT',
|
2021-02-10 16:20:01 +00:00
|
|
|
'unsigned' => true,
|
|
|
|
],
|
|
|
|
'created_at' => [
|
|
|
|
'type' => 'DATETIME',
|
|
|
|
],
|
|
|
|
'updated_at' => [
|
|
|
|
'type' => 'DATETIME',
|
|
|
|
],
|
|
|
|
]);
|
|
|
|
|
|
|
|
$this->forge->addKey('id', true);
|
2021-12-17 17:14:37 +00:00
|
|
|
$this->forge->addForeignKey('avatar_id', 'media', 'id', '', 'SET NULL');
|
2021-02-10 16:20:01 +00:00
|
|
|
$this->forge->addForeignKey('created_by', 'users', 'id');
|
|
|
|
$this->forge->addForeignKey('updated_by', 'users', 'id');
|
|
|
|
$this->forge->createTable('persons');
|
|
|
|
}
|
|
|
|
|
2021-05-06 14:00:48 +00:00
|
|
|
public function down(): void
|
2021-02-10 16:20:01 +00:00
|
|
|
{
|
|
|
|
$this->forge->dropTable('persons');
|
|
|
|
}
|
|
|
|
}
|