2020-08-18 16:31:28 +00:00
|
|
|
<?php
|
|
|
|
|
2021-06-08 09:52:11 +00:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2020-08-18 16:31:28 +00:00
|
|
|
/**
|
2021-05-19 16:35:13 +00:00
|
|
|
* Class AddPages Creates pages table in database
|
2020-08-18 16:31:28 +00:00
|
|
|
*
|
2022-02-19 16:06:11 +00:00
|
|
|
* @copyright 2020 Ad Aures
|
2020-08-18 16:31:28 +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 AddPages extends Migration
|
|
|
|
{
|
2021-05-06 14:00:48 +00:00
|
|
|
public function up(): void
|
2020-08-18 16:31:28 +00:00
|
|
|
{
|
|
|
|
$this->forge->addField([
|
|
|
|
'id' => [
|
|
|
|
'type' => 'INT',
|
|
|
|
'unsigned' => true,
|
|
|
|
'auto_increment' => true,
|
|
|
|
],
|
|
|
|
'title' => [
|
|
|
|
'type' => 'VARCHAR',
|
2020-10-29 15:45:19 +00:00
|
|
|
'constraint' => 255,
|
2020-08-18 16:31:28 +00:00
|
|
|
],
|
|
|
|
'slug' => [
|
|
|
|
'type' => 'VARCHAR',
|
2021-08-13 11:07:29 +00:00
|
|
|
'constraint' => 128,
|
2020-08-18 16:31:28 +00:00
|
|
|
'unique' => true,
|
|
|
|
],
|
2021-05-12 14:00:25 +00:00
|
|
|
'content_markdown' => [
|
|
|
|
'type' => 'TEXT',
|
|
|
|
],
|
|
|
|
'content_html' => [
|
2020-08-18 16:31:28 +00:00
|
|
|
'type' => 'TEXT',
|
|
|
|
],
|
|
|
|
'created_at' => [
|
2020-10-29 15:45:19 +00:00
|
|
|
'type' => 'DATETIME',
|
2020-08-18 16:31:28 +00:00
|
|
|
],
|
|
|
|
'updated_at' => [
|
2020-10-29 15:45:19 +00:00
|
|
|
'type' => 'DATETIME',
|
2020-08-18 16:31:28 +00:00
|
|
|
],
|
|
|
|
]);
|
2021-04-02 17:20:02 +00:00
|
|
|
$this->forge->addPrimaryKey('id');
|
2020-08-18 16:31:28 +00:00
|
|
|
$this->forge->createTable('pages');
|
|
|
|
}
|
|
|
|
|
2021-05-06 14:00:48 +00:00
|
|
|
public function down(): void
|
2020-08-18 16:31:28 +00:00
|
|
|
{
|
|
|
|
$this->forge->dropTable('pages');
|
|
|
|
}
|
|
|
|
}
|