mysql_to_pg_dump 0.2.2 → 0.2.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 160e1106cef142459155ba93913b8d51167f0466
4
- data.tar.gz: 5d18eeb1fd90091f3641592e7a5ea953cb7e0bd0
3
+ metadata.gz: 5acd5ed19362efef222f8318314e2c188a808a10
4
+ data.tar.gz: 2bb835504ec023ca2959c76a8fbe370b33bd332f
5
5
  SHA512:
6
- metadata.gz: 78af3a96e3fb0b9f3ad25053a5981d68554644aada594e2e73f027b94098fc8a755e1ec754b8bb289b10432ec2073278c9045634715025202d0459d64127a169
7
- data.tar.gz: 272349542e887547ab27d406233367fdfb2f77c7ea213f2bc223202bbb12b2f41c9ce467f66a67d76db5c73bd5eaa2bbe8212e94e0217b378f65397d3a0e391e
6
+ metadata.gz: e6f42515310b89fe6b57603445e784bd10562c1c083f6f56fdecfc8c81d6afe5be4a39066f07130946fff174c6d04d5f287f5a48d5f255739b2ef4adf6d267b9
7
+ data.tar.gz: 64fa2dacc7ad04a8d46d0e84503e2e2aa264a7437635b34c3a428d5ffa8f090bce53f30578206cf29e13160958389fddd282b6c1f6170fb1f881b9dd18ba1219
@@ -18,7 +18,12 @@ module MysqlToPgDump
18
18
  def psql_import_query table_name
19
19
  "\\copy #{table_name} from " \
20
20
  "'tmp/db_server_data/#{production['database']}_#{table_name}.csv' " \
21
- "delimiter E'\\t' null as 'NULL' csv header"
21
+ "delimiter E'\\t' null as 'NULL' csv header;"
22
+ end
23
+
24
+ def psql_set_sequence table_name
25
+ "SELECT setval(pg_get_serial_sequence('#{table_name}', 'id'), " \
26
+ "coalesce(max(id),0) + 1, false) FROM #{table_name};"
22
27
  end
23
28
 
24
29
  def clean_database
@@ -1,3 +1,3 @@
1
1
  module MysqlToPgDump
2
- VERSION = '0.2.2'
2
+ VERSION = '0.2.5'
3
3
  end
data/lib/tasks/db.rake CHANGED
@@ -45,7 +45,9 @@ namespace :db do
45
45
  if input == 'y'
46
46
  if data_already_pulled?
47
47
  clean_database
48
- db_tables.each { |t| system %(psql -d #{dev['database']} -c "#{psql_import_query(t)}") }
48
+ db_tables.each do |t|
49
+ system %(psql -d #{dev['database']} -c "#{psql_import_query(t)} #{psql_set_sequence(t)}")
50
+ end
49
51
  printf "Your db data now is equal to production\n".green
50
52
  else
51
53
  printf "No pulled data. Run 'rake db:pull' first\n".yellow
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mysql_to_pg_dump
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dimkarodinz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-30 00:00:00.000000000 Z
11
+ date: 2016-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -52,7 +52,7 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.0.5
55
- description: Loads mysql db data from the remote server to the local postgres db
55
+ description: Loads mysql db data from the remote server to local postgres db
56
56
  email:
57
57
  - dimkarodin@gmail.com
58
58
  executables: []