voomify_tasks 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/run_psql.rb +2 -2
- data/lib/tasks/sql_schema_seeds_databases.rake +5 -5
- metadata +3 -3
data/lib/run_psql.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module RunPSQL
|
2
2
|
def db_file_path(filename)
|
3
|
-
"#{Rails.root}/db
|
3
|
+
"#{Rails.root}/db/#{filename}"
|
4
4
|
end
|
5
5
|
def run_psql_file(config, filename)
|
6
6
|
file_with_path = db_file_path(filename)
|
@@ -15,6 +15,6 @@ module RunPSQL
|
|
15
15
|
port = config["port"]
|
16
16
|
password = config["password"]
|
17
17
|
pipe_to_file = output_file ? "> #{output_file}" : ""
|
18
|
-
`export PGPASSWORD="#{password}";#{command} -U #{username} -h #{host} -p
|
18
|
+
`export PGPASSWORD="#{password}";#{command} -U #{username} -h #{host} #{port ? '-p '+-port : ''} #{database} #{pipe_to_file};export PGPASSWORD=""`
|
19
19
|
end
|
20
20
|
end
|
@@ -7,11 +7,11 @@ require 'fileutils'
|
|
7
7
|
namespace :db do
|
8
8
|
namespace :schema do
|
9
9
|
override_task :load => :environment do
|
10
|
-
run_psql_file(current_env, "schema.sql")
|
10
|
+
run_psql_file(current_env, "sql/schema.sql")
|
11
11
|
end
|
12
12
|
|
13
13
|
override_task :dump => :environment do
|
14
|
-
output_file = db_file_path("schema.sql")
|
14
|
+
output_file = db_file_path("sql/schema.sql")
|
15
15
|
FileUtils.mv(output_file, "#{output_file}.last") if FileTest.exists?(output_file)
|
16
16
|
run_pg_command(current_env, "pg_dump -c -o -O -x -s", output_file)
|
17
17
|
puts "Schema has been updated from the database. Last schema backed up to #{output_file}.last"
|
@@ -19,7 +19,7 @@ namespace :db do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
override_task :seed => :environment do
|
22
|
-
run_psql_file(current_env, "seed.sql")
|
22
|
+
run_psql_file(current_env, "sql/seed.sql")
|
23
23
|
end
|
24
24
|
|
25
25
|
namespace :test do
|
@@ -28,8 +28,8 @@ namespace :db do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
override_task :load => :environment do
|
31
|
-
run_psql_file(ActiveRecord::Base.configurations["test"], "schema.sql")
|
32
|
-
run_psql_file(ActiveRecord::Base.configurations["test"], "seed.sql")
|
31
|
+
run_psql_file(ActiveRecord::Base.configurations["test"], "sql/schema.sql")
|
32
|
+
run_psql_file(ActiveRecord::Base.configurations["test"], "sql/seed.sql")
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: voomify_tasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 8
|
10
|
+
version: 0.1.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Russell Edens
|