mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'feat/wiki' into 'main'
Feat/wiki See merge request jjimenez/safekat!582
This commit is contained in:
@ -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()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user