mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
37 lines
858 B
PHP
Executable File
37 lines
858 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
use CodeIgniter\Database\RawSql;
|
|
|
|
class WikiSectionNameMigration extends Migration
|
|
{
|
|
|
|
|
|
public function up()
|
|
{
|
|
$sections = $this->db->table('wiki_sections')->select()->get()->getResultArray();
|
|
$this->forge->dropColumn('wiki_sections','name');
|
|
$this->forge->addColumn('wiki_sections',[
|
|
'name' => [
|
|
'type' => 'LONGTEXT',
|
|
'null' => false,
|
|
]
|
|
]);
|
|
foreach ($sections as $key => $value) {
|
|
$this->db->table('wiki_sections')->update(
|
|
[
|
|
"name" => json_encode(["es" => $value['name'],"en" => $value['name']])
|
|
],
|
|
'id = '.$value['id']
|
|
);
|
|
}
|
|
}
|
|
|
|
public function down()
|
|
{
|
|
|
|
}
|
|
}
|