mirror of
https://code.castopod.org/adaures/castopod
synced 2025-04-23 01:01:20 +00:00
58 lines
1.3 KiB
PHP
58 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* Class AddPages Creates pages table in database
|
|
*
|
|
* @copyright 2020 Ad Aures
|
|
* @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
|
|
{
|
|
public function up(): void
|
|
{
|
|
$this->forge->addField([
|
|
'id' => [
|
|
'type' => 'INT',
|
|
'unsigned' => true,
|
|
'auto_increment' => true,
|
|
],
|
|
'title' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 255,
|
|
],
|
|
'slug' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 128,
|
|
'unique' => true,
|
|
],
|
|
'content_markdown' => [
|
|
'type' => 'TEXT',
|
|
],
|
|
'content_html' => [
|
|
'type' => 'TEXT',
|
|
],
|
|
'created_at' => [
|
|
'type' => 'DATETIME',
|
|
],
|
|
'updated_at' => [
|
|
'type' => 'DATETIME',
|
|
],
|
|
]);
|
|
$this->forge->addPrimaryKey('id');
|
|
$this->forge->createTable('pages');
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
$this->forge->dropTable('pages');
|
|
}
|
|
}
|