webdack-uuid_migration 1.2.0 → 1.3.0

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
  SHA256:
3
- metadata.gz: b709b9d34a4056a5ff2c795042d350b1e4647bcb3b07ab506865bdec674ea91f
4
- data.tar.gz: f3393d180b72879821e52595c64cc19617986b136eed305d28b10ebaeb78798e
3
+ metadata.gz: b3954bb0c6c9a9722b6ed24293b37a4bc644b47c48d63bad5a1950f2ecd9f9c3
4
+ data.tar.gz: 57f8f13689f5706525e6fd5bdd0f757b6708868a78b9ae275c625ee0bd6f515f
5
5
  SHA512:
6
- metadata.gz: beaff06732e3687f9694294bf6f0b140a335fd3156ced708dfb025f7263099789ffe2b0b2de00f6ffa480994e7513af7710b1bfc3ab69c505c32afe85c2ef518
7
- data.tar.gz: 3adf61a3fc37ff339b26d6f204f790150ed5843c9daeb74022498b3c0a72251c4d51eef9d89481389d49f03f68aabfbbc75bde47e0b2c4c5d9e69e1b23bd798e
6
+ metadata.gz: c04960961a11f997c245afb2975647146b45cc5101efdcfeaf78685d56c9475efee6327a30eb3523f0df9c2cbcf50c8280321bfc13ff3af6919e1ba6558d5c79
7
+ data.tar.gz: b0ac076d70cfdf22c6081f4871c77e370b99ad7359ca4026e339c5a8044786a02d414c62e35ac013ab30d74d9a4c69d7f6ba58f4a8d3989a5db8a44b736ebe92
@@ -1,14 +1,20 @@
1
1
  rvm:
2
- - 2.3.6
3
- - 2.4.3
4
- - 2.5.0
2
+ - 2.6.5
3
+ - 2.5.7
4
+ - 2.4.9
5
5
 
6
6
  gemfile:
7
- - gemfiles/rails42.gemfile
8
- - gemfiles/rails50.gemfile
7
+ - gemfiles/rails60.gemfile
8
+ - gemfiles/rails52.gemfile
9
9
  - gemfiles/rails51.gemfile
10
+ - gemfiles/rails42.gemfile
11
+
12
+ matrix:
13
+ exclude:
14
+ - rvm: 2.4.9
15
+ gemfile: gemfiles/rails60.gemfile
10
16
 
11
17
  script: bundle exec rspec spec
12
18
 
13
19
  addons:
14
- postgresql: "9.4"
20
+ postgresql: "9.4"
data/README.md CHANGED
@@ -3,31 +3,46 @@
3
3
  [![Build Status](https://travis-ci.org/kreatio-sw/webdack-uuid_migration.svg?branch=master)](https://travis-ci.org/kreatio-sw/webdack-uuid_migration)
4
4
 
5
5
  **This project is actively maintained. Please report issues and/or create
6
- pull requests if you face any issues.**
6
+ pull requests if you face any issues.**
7
7
 
8
- Helper methods to migrate Integer columns to UUID columns during migrations in PostgreSQL.
9
- It supports migrating primary key columns as well.
8
+ There are plenty of tutorials around the web on how to use UUIDs with Rails.
9
+ However, there is no reliable tutorial to help convert an in-production Rails application
10
+ from Integer ids to UUIDs.
11
+
12
+ This gem has helper methods to convert Integer columns to UUIDs during migrations.
13
+ It supports migrating primary key columns, relations, and polymorphic relations as well.
14
+
15
+ It is designed to be very fast and is suitable for inplace migration of schema and data.
16
+ It has been used in production since 2014.
17
+
18
+ This only supports PostgreSQL.
10
19
 
11
20
  ## Documentation
12
21
 
13
- http://www.rubydoc.info/gems/webdack-uuid_migration
22
+ http://www.rubydoc.info/gems/webdack-uuid_migration (Link is dead).
14
23
 
15
24
  ## Installation
16
25
 
17
26
  Add this line to your application's Gemfile:
18
27
 
28
+ ```ruby
19
29
  gem 'webdack-uuid_migration'
30
+ ```
20
31
 
21
32
  And then execute:
22
33
 
34
+ ```bash
23
35
  $ bundle
36
+ ```
24
37
 
25
38
  Or install it yourself as:
26
39
 
40
+ ```bash
27
41
  $ gem install webdack-uuid_migration
28
-
29
- This gem is needed only during database migrations.
30
- Once the database has been migrated in all environments,
42
+ ```
43
+
44
+ This gem is needed only during database migrations.
45
+ Once the database has been migrated in all environments,
31
46
  this gem can safely be removed from your applications Gemfile.
32
47
 
33
48
  ## Usage
@@ -38,6 +53,7 @@ this gem can safely be removed from your applications Gemfile.
38
53
 
39
54
  Example:
40
55
 
56
+ ```ruby
41
57
  # You must explicitly require it in your migration file
42
58
  require 'webdack/uuid_migration/helpers'
43
59
 
@@ -62,6 +78,7 @@ Example:
62
78
  end
63
79
  end
64
80
  end
81
+ ```
65
82
 
66
83
  Integer values are converted to UUID by padding 0's to the left. This makes it possible to
67
84
  retrieve old id in future.
@@ -78,7 +95,7 @@ This function will only work with Rails 4.2 or newer.
78
95
  To update a primary key and all columns referencing it please use
79
96
  {Webdack::UUIDMigration::Helpers#primary_key_and_all_references_to_uuid}. For example:
80
97
 
81
- ```
98
+ ```ruby
82
99
  class MigrateWithFk < ActiveRecord::Migration
83
100
  def change
84
101
  reversible do |dir|
@@ -118,6 +135,7 @@ following steps:
118
135
 
119
136
  Example:
120
137
 
138
+ ```ruby
121
139
  # Student -- belongs_to :institution, :polymorphic => true
122
140
  # An institution is either a School or a College
123
141
  # College is migrated to use UUID as primary key
@@ -133,18 +151,13 @@ Example:
133
151
  columns_to_uuid :students, :institution_id
134
152
 
135
153
  # See the rspec test case in spec folder for full example
136
-
154
+ ```
137
155
 
138
156
  ## Compatibility
139
157
 
140
- Works only with Rails 4 & Rails 5. It uses Rails4's out-of-the-box UUID support for PostgreSQL. Works with following
141
- Ruby versions:
158
+ Works with Rails 4.2+, 5 & 6. It uses Rails 4's out-of-the-box UUID support for PostgreSQL.
142
159
 
143
- - 2.3.6
144
- - 2.4.3
145
- - 2.5.0
146
-
147
- Tested with Rails 5.0.x and 5.1.x. Reported working with 5.2.0 alpha.
160
+ See https://travis-ci.org/kreatio-sw/webdack-uuid_migration for current build matrix.
148
161
 
149
162
  To run the test suite:
150
163
 
@@ -156,7 +169,7 @@ To run the test suite:
156
169
 
157
170
  - Users of the Gem
158
171
  - [Felix Bünemann](https://github.com/felixbuenemann) for checking compatibility with Rails 4.1
159
- - [Nick Schwaderer](https://github.com/Schwad) Rials 5.2.x compatibility
172
+ - [Nick Schwaderer](https://github.com/Schwad) Rails 5.2.x compatibility
160
173
  - [Kelsey Hannan](https://github.com/KelseyDH) Upgrading to `pgcrypto`
161
174
 
162
175
  ## Contributing
@@ -2,4 +2,7 @@ source "https://rubygems.org"
2
2
 
3
3
  gem "activerecord", "~>4.2.0"
4
4
 
5
+ # This version of ActiveRecrod does not support higher
6
+ gem "pg", '< 1.0'
7
+
5
8
  gemspec :path=>"../"
@@ -1,5 +1,5 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem "activerecord", "~>5.2.0"
3
+ gem 'activerecord', '~>5.2.0'
4
4
 
5
5
  gemspec :path=>"../"
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem 'activerecord', '~>6.0.0'
4
+
5
+ gemspec :path=>"../"
@@ -5,13 +5,14 @@ module Webdack
5
5
  to_primary_key = primary_key(to_table_name)
6
6
 
7
7
 
8
- fk_info = select_all <<-SQL.strip_heredoc
9
- SELECT t2.oid::regclass::text AS to_table, a2.attname AS primary_key, t1.relname as from_table, a1.attname AS column, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete FROM pg_constraint c
10
- JOIN pg_class t1 ON c.conrelid = t1.oid
11
- JOIN pg_class t2 ON c.confrelid = t2.oid
12
- JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
13
- JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
14
- JOIN pg_namespace t3 ON c.connamespace = t3.oid
8
+ fk_info = select_all <<-SQL
9
+ SELECT t2.oid::regclass::text AS to_table, a2.attname AS primary_key, t1.relname as from_table, a1.attname AS column, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
10
+ FROM pg_constraint c
11
+ JOIN pg_class t1 ON c.conrelid = t1.oid
12
+ JOIN pg_class t2 ON c.confrelid = t2.oid
13
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
14
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
15
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
15
16
  WHERE c.contype = 'f'
16
17
  AND t2.oid::regclass::text = #{quote(to_table_name)}
17
18
  AND a2.attname = #{quote(to_primary_key)}
@@ -2,6 +2,6 @@
2
2
  module Webdack
3
3
  #
4
4
  module UUIDMigration
5
- VERSION = "1.2.0"
5
+ VERSION = "1.3.0"
6
6
  end
7
7
  end
@@ -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", '< 1.0'
25
+ spec.add_development_dependency "pg", '< 2.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.2.0
4
+ version: 1.3.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: 2018-01-23 00:00:00.000000000 Z
11
+ date: 2019-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "<"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.0'
75
+ version: '2.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: '1.0'
82
+ version: '2.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: gem-release
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -126,6 +126,7 @@ files:
126
126
  - gemfiles/rails50.gemfile
127
127
  - gemfiles/rails51.gemfile
128
128
  - gemfiles/rails52.gemfile
129
+ - gemfiles/rails60.gemfile
129
130
  - lib/webdack/uuid_migration.rb
130
131
  - lib/webdack/uuid_migration/helpers.rb
131
132
  - lib/webdack/uuid_migration/schema_helpers.rb
@@ -161,8 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
162
  - !ruby/object:Gem::Version
162
163
  version: '0'
163
164
  requirements: []
164
- rubyforge_project:
165
- rubygems_version: 2.7.3
165
+ rubygems_version: 3.0.1
166
166
  signing_key:
167
167
  specification_version: 4
168
168
  summary: Useful helpers to migrate Integer id columns to UUID in PostgreSql.