مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2025-11-30 21:32:30 +00:00
feat: add "postal:update" task
this will load the schema if no schema exists or update it if it does
هذا الالتزام موجود في:
11
bin/postal
11
bin/postal
@@ -25,12 +25,15 @@ case "$1" in
|
|||||||
|
|
||||||
initialize)
|
initialize)
|
||||||
echo 'Initializing database'
|
echo 'Initializing database'
|
||||||
run "bundle exec rake db:create db:schema:load db:seed"
|
run "bundle exec rake db:create postal:update"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
upgrade)
|
upgrade)
|
||||||
echo 'Migrating database'
|
run "bundle exec rake postal:update"
|
||||||
run "bundle exec rake db:migrate"
|
;;
|
||||||
|
|
||||||
|
update)
|
||||||
|
run "bundle exec rake postal:update"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
console)
|
console)
|
||||||
@@ -65,7 +68,7 @@ case "$1" in
|
|||||||
echo "Setup/upgrade tools:"
|
echo "Setup/upgrade tools:"
|
||||||
echo
|
echo
|
||||||
echo -e " * \033[32minitialize\033[0m - create and load the DB schema"
|
echo -e " * \033[32minitialize\033[0m - create and load the DB schema"
|
||||||
echo -e " * \033[32mupgrade\033[0m - upgrade the DB schema"
|
echo -e " * \033[32mupdate\033[0m - upgrade the DB schema"
|
||||||
echo
|
echo
|
||||||
echo "Other tools:"
|
echo "Other tools:"
|
||||||
echo
|
echo
|
||||||
|
|||||||
@@ -27,6 +27,19 @@ namespace :postal do
|
|||||||
task generate_helm_env_vars: :environment do
|
task generate_helm_env_vars: :environment do
|
||||||
puts Postal::HelmConfigExporter.new(Postal::ConfigSchema).export
|
puts Postal::HelmConfigExporter.new(Postal::ConfigSchema).export
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc "Update the database"
|
||||||
|
task update: :environment do
|
||||||
|
mysql = ActiveRecord::Base.connection
|
||||||
|
if mysql.table_exists?("schema_migrations") &&
|
||||||
|
mysql.select_all("select * from schema_migrations").any?
|
||||||
|
puts "Database schema is already loaded. Running migrations with db:migrate"
|
||||||
|
Rake::Task["db:migrate"].invoke
|
||||||
|
else
|
||||||
|
puts "No schema migrations exist. Loading schema with db:schema:load"
|
||||||
|
Rake::Task["db:schema:load"].invoke
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Rake::Task["db:migrate"].enhance do
|
Rake::Task["db:migrate"].enhance do
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم