Welcome Guest, Not a member yet? Register   Sign In
How to Run Migration via PHP Code?
#1

Hi, i already use migration via cli, now i want to run php spark migrate --all via php controller. How can i do this? Thank you
Reply
#2

(This post was last modified: 03-21-2024, 11:09 PM by luckmoshy.)

(03-21-2024, 08:43 AM)RedWd Wrote: Hi, i already use migration via cli, now i want to run php spark migrate --all via php controller. How can i do this? Thank you

maybe you can do something like this
PHP Code:
$this->migrate = \Config\Services::migrations()


private function 
runAllMaigrate (){
        try {
            if($this->migrate){
 
$this->migrate->latest();
 }
        } catch (\Throwable $e) {
            die('there is a critical issue on running migration '.$e->getMessage());
 exit();
        }
 } 
Codeigniter First, Codeigniter Then You!!
yekrinaDigitals

Reply




Theme © iAndrew 2016 - Forum software by © MyBB