webdack-uuid_migration 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: dfced37886b6889ece73a47e8d03d57c93890753
4
- data.tar.gz: 3a65cc8443ebd721be24a2dc21d919ccac67d339
2
+ SHA256:
3
+ metadata.gz: b709b9d34a4056a5ff2c795042d350b1e4647bcb3b07ab506865bdec674ea91f
4
+ data.tar.gz: f3393d180b72879821e52595c64cc19617986b136eed305d28b10ebaeb78798e
5
5
  SHA512:
6
- metadata.gz: 44273137d0dbefe4da856e0d2e0813176cc4e600936a347117eec69d65c86ba443bd5aa679f28c7edc4667bc25f6c394e5bb8071f058dfe191c78b6697e2beca
7
- data.tar.gz: fdba841d3643e172fdbc9dd691298830a2ec9d9056b3048cf4bad0984eac20798dd72249cc4a3fc5bafe6e25dbfd35710291d4cfe8d7b2456d901487d206dc19
6
+ metadata.gz: beaff06732e3687f9694294bf6f0b140a335fd3156ced708dfb025f7263099789ffe2b0b2de00f6ffa480994e7513af7710b1bfc3ab69c505c32afe85c2ef518
7
+ data.tar.gz: 3adf61a3fc37ff339b26d6f204f790150ed5843c9daeb74022498b3c0a72251c4d51eef9d89481389d49f03f68aabfbbc75bde47e0b2c4c5d9e69e1b23bd798e
data/.travis.yml CHANGED
@@ -1,29 +1,14 @@
1
1
  rvm:
2
- - 2.0.0
3
- - 2.1.10
4
- - 2.2.8
5
- - 2.3.5
6
- - 2.4.2
2
+ - 2.3.6
3
+ - 2.4.3
4
+ - 2.5.0
7
5
 
8
6
  gemfile:
9
- - gemfiles/rails40.gemfile
10
- - gemfiles/rails41.gemfile
11
7
  - gemfiles/rails42.gemfile
8
+ - gemfiles/rails50.gemfile
9
+ - gemfiles/rails51.gemfile
12
10
 
13
11
  script: bundle exec rspec spec
14
12
 
15
- matrix:
16
- include:
17
- - rvm: 2.3.5
18
- gemfile: gemfiles/rails50.gemfile
19
- - rvm: 2.4.2
20
- gemfile: gemfiles/rails50.gemfile
21
- - rvm: 2.3.5
22
- gemfile: gemfiles/rails51.gemfile
23
- - rvm: 2.4.2
24
- gemfile: gemfiles/rails51.gemfile
25
- exclude:
26
- - rvm: 2.4.2
27
- gemfile: gemfiles/rails40.gemfile
28
- - rvm: 2.4.2
29
- gemfile: gemfiles/rails41.gemfile
13
+ addons:
14
+ postgresql: "9.4"
data/README.md CHANGED
@@ -8,6 +8,10 @@ pull requests if you face any issues.**
8
8
  Helper methods to migrate Integer columns to UUID columns during migrations in PostgreSQL.
9
9
  It supports migrating primary key columns as well.
10
10
 
11
+ ## Documentation
12
+
13
+ http://www.rubydoc.info/gems/webdack-uuid_migration
14
+
11
15
  ## Installation
12
16
 
13
17
  Add this line to your application's Gemfile:
@@ -29,7 +33,7 @@ this gem can safely be removed from your applications Gemfile.
29
33
  ## Usage
30
34
 
31
35
  - Put `require 'webdack/uuid_migration/helpers'` in your migration file.
32
- - Enable `'uuid-ossp'` directly in Postgres database or by adding `enable_extension 'uuid-ossp'` to your migration.
36
+ - Enable `'pgcrypto'` directly in Postgres database or by adding `enable_extension 'pgcrypto'` to your migration.
33
37
  - Use methods from {Webdack::UUIDMigration::Helpers} as appropriate.
34
38
 
35
39
  Example:
@@ -43,7 +47,7 @@ Example:
43
47
  dir.up do
44
48
  # Good idea to do the following, needs superuser rights in the database
45
49
  # Alternatively the extension needs to be manually enabled in the RDBMS
46
- enable_extension 'uuid-ossp'
50
+ enable_extension 'pgcrypto'
47
51
 
48
52
  primary_key_to_uuid :students
49
53
 
@@ -79,7 +83,7 @@ class MigrateWithFk < ActiveRecord::Migration
79
83
  def change
80
84
  reversible do |dir|
81
85
  dir.up do
82
- enable_extension 'uuid-ossp'
86
+ enable_extension 'pgcrypto'
83
87
 
84
88
  primary_key_and_all_references_to_uuid :cities
85
89
  end
@@ -136,11 +140,9 @@ Example:
136
140
  Works only with Rails 4 & Rails 5. It uses Rails4's out-of-the-box UUID support for PostgreSQL. Works with following
137
141
  Ruby versions:
138
142
 
139
- - 2.0.0
140
- - 2.1.10
141
- - 2.2.8
142
- - 2.3.5
143
- - 2.4.2
143
+ - 2.3.6
144
+ - 2.4.3
145
+ - 2.5.0
144
146
 
145
147
  Tested with Rails 5.0.x and 5.1.x. Reported working with 5.2.0 alpha.
146
148
 
@@ -155,6 +157,7 @@ To run the test suite:
155
157
  - Users of the Gem
156
158
  - [Felix Bünemann](https://github.com/felixbuenemann) for checking compatibility with Rails 4.1
157
159
  - [Nick Schwaderer](https://github.com/Schwad) Rials 5.2.x compatibility
160
+ - [Kelsey Hannan](https://github.com/KelseyDH) Upgrading to `pgcrypto`
158
161
 
159
162
  ## Contributing
160
163
 
@@ -7,16 +7,16 @@ module Webdack
7
7
 
8
8
 
9
9
  # Converts primary key from Serial Integer to UUID, migrates all data by left padding with 0's
10
- # sets uuid_generate_v4() as default for the column
10
+ # sets gen_random_uuid() as default for the column
11
11
  #
12
12
  # @param table [Symbol]
13
13
  # @param options [hash]
14
14
  # @option options [Symbol] :primary_key if not supplied queries the schema (should work most of the times)
15
- # @option options [String] :default mechanism to generate UUID for new records, default uuid_generate_v4(),
15
+ # @option options [String] :default mechanism to generate UUID for new records, default gen_random_uuid(),
16
16
  # which is Rails 4.0.0 default as well
17
17
  # @return [none]
18
18
  def primary_key_to_uuid(table, options={})
19
- default= options[:default] || 'uuid_generate_v4()'
19
+ default= options[:default] || 'gen_random_uuid()'
20
20
 
21
21
  column= connection.primary_key(table)
22
22
 
@@ -2,6 +2,6 @@
2
2
  module Webdack
3
3
  #
4
4
  module UUIDMigration
5
- VERSION = "1.1.0"
5
+ VERSION = "1.2.0"
6
6
  end
7
7
  end
@@ -3,7 +3,7 @@
3
3
  PG_SPEC = {
4
4
  :adapter => 'postgresql',
5
5
  :database => 'webdack_uuid_migration_helper_test',
6
- :username => 'kdeepak',
6
+ :username => 'postgres',
7
7
  :encoding => 'utf8'
8
8
  }
9
9
 
@@ -6,7 +6,7 @@ class MigrationBase < ActiveRecordMigration
6
6
  t.string :name
7
7
  end
8
8
 
9
- enable_extension 'uuid-ossp'
9
+ enable_extension 'pgcrypto'
10
10
  end
11
11
  end
12
12
 
@@ -42,7 +42,7 @@ class Migration03 < ActiveRecordMigration
42
42
  def change
43
43
  reversible do |dir|
44
44
  dir.up do
45
- primary_key_to_uuid :states, default: 'uuid_generate_v1()'
45
+ primary_key_to_uuid :states, default: 'gen_random_uuid()'
46
46
  end
47
47
 
48
48
  dir.down do
@@ -111,7 +111,7 @@ describe Webdack::UUIDMigration::Helpers do
111
111
  }
112
112
 
113
113
  default_function = State.connection.columns(:states).find { |c| c.name == 'stateid' }.default_function
114
- expect(default_function).to eq 'uuid_generate_v1()'
114
+ expect(default_function).to eq 'gen_random_uuid()'
115
115
  end
116
116
 
117
117
  end
@@ -4,7 +4,7 @@ class BasicMigration < ActiveRecordMigration
4
4
  def change
5
5
  reversible do |dir|
6
6
  dir.up do
7
- enable_extension 'uuid-ossp'
7
+ enable_extension 'pgcrypto'
8
8
 
9
9
  primary_key_to_uuid :students
10
10
  columns_to_uuid :students, :city_id, :institution_id
@@ -21,7 +21,7 @@ class MigrateAllOneGo < ActiveRecordMigration
21
21
  def change
22
22
  reversible do |dir|
23
23
  dir.up do
24
- enable_extension 'uuid-ossp'
24
+ enable_extension 'pgcrypto'
25
25
 
26
26
  primary_key_to_uuid :cities
27
27
  primary_key_to_uuid :colleges
@@ -42,7 +42,7 @@ class MigrateWithFk < ActiveRecordMigration
42
42
  def change
43
43
  reversible do |dir|
44
44
  dir.up do
45
- enable_extension 'uuid-ossp'
45
+ enable_extension 'pgcrypto'
46
46
 
47
47
  primary_key_and_all_references_to_uuid :cities
48
48
  end
@@ -58,7 +58,7 @@ class MigrateStep01 < ActiveRecordMigration
58
58
  def change
59
59
  reversible do |dir|
60
60
  dir.up do
61
- enable_extension 'uuid-ossp'
61
+ enable_extension 'pgcrypto'
62
62
 
63
63
  primary_key_to_uuid :cities
64
64
  primary_key_to_uuid :colleges
@@ -157,7 +157,7 @@ describe Webdack::UUIDMigration::Helpers do
157
157
  end
158
158
 
159
159
  # Verify that primary key has correct default
160
- expect(columns.find{|c| c.name == 'id'}.default_function).to eq 'uuid_generate_v4()'
160
+ expect(columns.find{|c| c.name == 'id'}.default_function).to eq 'gen_random_uuid()'
161
161
  end
162
162
  end
163
163
 
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency "rake"
23
23
  spec.add_development_dependency "yard"
24
24
  spec.add_development_dependency "rspec"
25
- spec.add_development_dependency "pg"
25
+ spec.add_development_dependency "pg", '< 1.0'
26
26
  spec.add_development_dependency 'gem-release'
27
27
 
28
28
  spec.add_dependency 'activerecord', '>= 4.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webdack-uuid_migration
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Deepak Kumar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-13 00:00:00.000000000 Z
11
+ date: 2018-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -70,16 +70,16 @@ dependencies:
70
70
  name: pg
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "<"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: '1.0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "<"
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: '1.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: gem-release
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -122,8 +122,6 @@ files:
122
122
  - LICENSE.txt
123
123
  - README.md
124
124
  - Rakefile
125
- - gemfiles/rails40.gemfile
126
- - gemfiles/rails41.gemfile
127
125
  - gemfiles/rails42.gemfile
128
126
  - gemfiles/rails50.gemfile
129
127
  - gemfiles/rails51.gemfile
@@ -164,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
162
  version: '0'
165
163
  requirements: []
166
164
  rubyforge_project:
167
- rubygems_version: 2.6.13
165
+ rubygems_version: 2.7.3
168
166
  signing_key:
169
167
  specification_version: 4
170
168
  summary: Useful helpers to migrate Integer id columns to UUID in PostgreSql.
@@ -1,5 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "activerecord", "~>4.0.0"
4
-
5
- gemspec :path=>"../"
@@ -1,5 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "activerecord", "~>4.1.0"
4
-
5
- gemspec :path=>"../"