debian-mirror-gitlab/lib/tasks/migrate/setup_postgresql.rake

26 lines
952 B
Ruby
Raw Normal View History

2015-10-24 18:46:33 +05:30
desc 'GitLab | Sets up PostgreSQL'
task setup_postgresql: :environment do
2018-03-17 18:26:18 +05:30
require Rails.root.join('db/migrate/20180215181245_users_name_lower_index.rb')
2018-11-08 19:23:39 +05:30
require Rails.root.join('db/migrate/20180504195842_project_name_lower_index.rb')
2018-05-09 12:01:36 +05:30
require Rails.root.join('db/post_migrate/20180306164012_add_path_index_to_redirect_routes.rb')
2018-03-17 18:26:18 +05:30
UsersNameLowerIndex.new.up
2018-11-08 19:23:39 +05:30
ProjectNameLowerIndex.new.up
2018-05-09 12:01:36 +05:30
AddPathIndexToRedirectRoutes.new.up
2015-10-24 18:46:33 +05:30
end
2018-11-08 19:23:39 +05:30
desc 'GitLab | Generate PostgreSQL Password Hash'
task :postgresql_md5_hash do
require 'digest'
username = ENV.fetch('USERNAME') do |missing|
puts "You must provide an username with '#{missing}' ENV variable"
exit(1)
end
password = ENV.fetch('PASSWORD') do |missing|
puts "You must provide a password with '#{missing}' ENV variable"
exit(1)
end
hash = Digest::MD5.hexdigest("#{password}#{username}")
puts "The MD5 hash of your database password for user: #{username} -> #{hash}"
end