Welcome Guest, Not a member yet? Register   Sign In
Database Migrations - The charset and collation properties.
#3

kenjis thank you very much for your help and your contribution to Codeigniter development!

I will leave the code who, thanks to the reply of kenjis, I was able to write and answer my question:
PHP Code:
<?php
namespace App\Database\Migrations;

use 
CodeIgniter\Database\Migration;

class 
CreateSysUrlTable extends Migration
{
    public function up()
    {
        // Other columns...
        $this->forge->addField("mini_info varchar(45) COLLATE utf8mb4_bin DEFAULT NULL");
        $this->forge->addField("user_description text COLLATE utf8mb4_general_ci");
        $this->forge->addUniqueKey('id');
        $attributes = [
            'ENGINE' => 'InnoDB',
            'CHARSET' => 'utf8mb4',
            'COLLATE' => 'utf8mb4_general_ci'

        ];
        $this->forge->createTable('user_test'false$attributes);
    }

    public function down()
    {
        $this->forge->dropTable('user_test');
    }

Reply


Messages In This Thread
RE: Database Migrations - The charset and collation properties. - by Haliburton - 03-26-2024, 07:38 PM



Theme © iAndrew 2016 - Forum software by © MyBB