Quantcast
Channel: phpBB.com
Viewing all articles
Browse latest Browse all 1709

Extension Writers Discussion • Re: populate a table while migrations

$
0
0
thanks for answer...but still not working. i've edited the dependencies and insertion mode!

here my files:
install_sample-schema

Code:

public function effectively_installed(){return $this->db_tools->sql_table_exists($this->table_prefix . 'sebo_postreact_table');}public static function depends_on(){return ['\phpbb\db\migration\data\v320\v320'];}public function update_schema(){return ['add_tables'=> [$this->table_prefix . 'my_table2'=> ['COLUMNS'=> [........],'PRIMARY_KEY'=> 'postreact_id',],$this->table_prefix . 'my_table'=> ['COLUMNS'=> ['id'=> ['UINT', null, 'auto_increment'],'icon_id'=> ['UINT', 0],'icon_url'=> ['VCHAR:200', ''],'icon_width'=> ['UINT', 0],'icon_height'=> ['UINT', 0],'icon_alt'=> ['VCHAR:100', ''],'status'=> ['UINT:1', 0],'active'=> ['UINT:1', 0],],'PRIMARY_KEY'=> 'id',],],];}
my install_sample_data

Code:

public function effectively_installed(){return $this->db_tools->sql_table_exists($this->table_prefix . 'my_table2');}public static function depends_on(){return ['\my_vendor\my_ext\migration\install_sample_schema'];}public function update_data(){return [                           ......// Call a custom callable function to perform more complex operations.['custom', [[$this, 'table_pr_install']]],];}public function table_pr_install(){$data = [['id'            => 1,'icon_id'       => 1,'icon_url'      => 'like.png','icon_width'    => 32,'icon_height'   => 32,'icon_alt'      => 'Like','status'        => '1','active'        => '0',],['id'            => 2,'icon_id'       => 2,'icon_url'      => 'heart.png','icon_width'    => 32,'icon_height'   => 32,'icon_alt'      => 'Heart','status'        => '1','active'        => '0',],....];$this->db->sql_multi_insert($this->table_prefix . 'my_table', $data);}
gives me the error:
Table 'my_table' doesn't exist [1146] :!: :cry:

Statistics: Posted by sebo — Mon Jul 29, 2024 10:44 am



Viewing all articles
Browse latest Browse all 1709

Trending Articles