hi there, i have a problem
i'm writing something and reading a lot, but i cannot solve this problem:
in migrations i use install_schema
it's ok, tables are correctly created.
in the meantime i use install_data too, to populate one of my table.
i use custom_function like explained in https://area51.phpbb.com/docs/dev/3.3.x ... anges.html
so in my install_data i have:if i use this sql query...it doesn't works. it's like it uses update_data before the install schema. it says that table where to put my values doesn't exist.
so i've thinked about dependencies? to order before the file:
install_schema
and after
install_data
is that the solution? i've tryied up to put in install_data this code:it creates a loop...timout for more 120 sec...maybe too much!
anyone has solution?
thanks!
i'm writing something and reading a lot, but i cannot solve this problem:
in migrations i use install_schema
it's ok, tables are correctly created.
in the meantime i use install_data too, to populate one of my table.
i use custom_function like explained in https://area51.phpbb.com/docs/dev/3.3.x ... anges.html
so in my install_data i have:
Code:
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(){$sql = "INSERT INTO " . $this->table_prefix . "_mytable (`id`, `icon_id`, `icon_url`, `icon_width`, `icon_height`, `icon_alt`) VALUES(1, 1, 'like.png', 32, 32, 'Like'),(2, 2, 'heart.png', 32, 32, 'Heart'),(3, 3, 'laugh.png', 32, 32, 'Laught'),(4, 4, 'sad.png', 32, 32, 'Sad'),(5, 5, 'angry.png', 32, 32, 'Angry'),(6, 6, 'surprise.png', 32, 32, 'Suprise');";$this->db->sql_query($sql);}
Table 'my_db.phpbb_mytable' doesn't exist [1146]
so i've thinked about dependencies? to order before the file:
install_schema
and after
install_data
is that the solution? i've tryied up to put in install_data this code:
Code:
public static function depends_on(){return ['\phpbb\db\migration\data\v320\v320','my_name\my_ext\migrations\install_schema'];}
anyone has solution?
thanks!
Statistics: Posted by sebo — Sat Jul 27, 2024 11:09 am