add name translation wiki-section

This commit is contained in:
amazuecos
2025-03-02 13:44:10 +01:00
parent 18700b6c96
commit 24412c63ca
10 changed files with 76 additions and 15 deletions

View File

@ -0,0 +1,36 @@
<?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()
{
}
}