Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
If the sql-base is already ready and you just need to fill it in, then here is the option:
$this->db->createCommand(file_get_contents('console/migrations/sqls/cities.sql'))->execute();
If in the form of sql - then it's easier to go to phpMyAdmin and import. Why migrations? Migrations are convenient in terms of creating a table.
But filling from the sql file is not very good.
Here are the docs:
www.yiiframework.com/doc-2.0/guide-db-migrations.h...
Here you will have to parse your sql file, sort through the array through foreach and form the syntax necessary for migrations. So it's possible of course, but why?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question