The database [mysql] is spinning on the server - new files with migrations have appeared, about a few dozen. Question: Is it possible to roll all these migrations to the base with the help of some script for mysql or mysqldump (perhaps somehow with the help of a workbench) in order not to perform them one by one?)
1 answer
If someone comes in handy. Python script:
import os current_directory = "ваш_путь_к_файлам" # чтобы mysql работала с консоли, добавьте # путь к mysql_folder в path for filename in os.listdir(current_directory): full_path = current_directory + filename query = "mysql -u username -puserpass dbname < " + full_path os.system(query);
|
cat *.sql | mysql -u пользователь -pпароль имя-базы
cat *.sql | mysql -u пользователь -pпароль имя-базы
mask*.sql
only to make it so that it captures all the necessary files - Mike