I would like to run db: migrate VERSION = 0 and then db: do the migration inside my own rake task. I am confused about how to do this. Do I need a special request? My rake task will be in the lib / tasks directory of the Rails application. Thanks.
Is your task simply dependent on having pure db? If this is the case, then you can do:
task: my_task => [: environment, 'db: reset']
EDIT: Rake:: Task [] , ENV. , .
ENV['VERSION']= '0' Rake::Task['db:migrate'].invoke Rake::Task['db:migrate'].reenable ENV.delete 'VERSION' Rake::Task["db:migrate"].invoke
. Rake:: Task.reenable Rake 0.8.2 .
Check rake db:resetout as this will accomplish what you are trying to do.
rake db:reset
To find out what all your rake tasks do, run rake -T
rake -T
Source: https://habr.com/ru/post/1704210/More articles:Theory of GUI Creation Code Layout? - javaOpening a database connection once or with each database transaction? - databaseHow do you access a web page and get its content in C #? - httpWhat are the options for XML on iPhone? - xmlHow to provide easy editing of basic ASP.NET pages for designers? - asp.netHow to manage processes in the Hyper-V VM console? - powershellCan you name the C ++ functions from Ada? - c ++Как переписать номера телефонов в T-SQL? - validationFirefox this function - javascriptВ любом случае, чтобы проверить ошибку PHP в Dreamweaver? - phpAll Articles