Skip to content
Snippets Groups Projects
2020-08-17-150000_add_pages.php 1.3 KiB
Newer Older
  • Learn to ignore specific revisions
  •  * Class AddPages
     * Creates pages table in database
    
     *
     * @copyright  2020 Podlibre
     * @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()
        {
            $this->forge->addField([
                'id' => [
                    'type' => 'INT',
                    'unsigned' => true,
                    'auto_increment' => true,
                ],
                'title' => [
                    'type' => 'VARCHAR',
    
                ],
                'slug' => [
                    'type' => 'VARCHAR',
                    'constraint' => 191,
                    'unique' => true,
                ],
                'content' => [
                    'type' => 'TEXT',
                ],
                'created_at' => [
    
            $this->forge->createTable('pages');
        }
    
        public function down()
        {
            $this->forge->dropTable('pages');
        }
    }