typed_uuid 3.1 → 3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/db/migrate/20191222234546_add_typed_uuid_function.rb +15 -13
- data/lib/typed_uuid/version.rb +1 -1
- data/typed_uuid.gemspec +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9b97eecee8303b2863faf3982c4080d347c9dabc4b0fca45c2c5dc7c74b6172
|
4
|
+
data.tar.gz: 72d70bc0bc247987141c6ee4710a5ef34257693179b1d526dcc6fbf427e414f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 204697bd0dc2c7dd64b62dc7b7955cb5d83242c5966bc447c84d79d343f3b0825cc8bd1bb450525a3acc3405a61a1740b06f127a9df6f5f5830f9a063a75f18a
|
7
|
+
data.tar.gz: cba9d2425930e678e4c44bfc163392fb749c249f5e2930b62998f22fae5ad10cdaa9e8df5df013b6155eac8c1c242056e4ff67b65dfb63140f82f545b24d38d4
|
@@ -1,18 +1,20 @@
|
|
1
1
|
class AddTypedUuidFunction < ActiveRecord::Migration[6.0]
|
2
2
|
def up
|
3
|
-
|
3
|
+
if connection.is_a?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
|
4
|
+
enable_extension 'pgcrypto'
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
6
|
+
execute <<-SQL
|
7
|
+
CREATE OR REPLACE FUNCTION typed_uuid(t bytea) RETURNS uuid AS $$
|
8
|
+
DECLARE
|
9
|
+
bytes bytea := gen_random_bytes(16);
|
10
|
+
uuid bytea;
|
11
|
+
BEGIN
|
12
|
+
bytes := set_byte(bytes, 6, (get_byte(bytes, 4) # get_byte(bytes, 8)) # get_byte(t, 0));
|
13
|
+
bytes := set_byte(bytes, 7, (get_byte(bytes, 5) # get_byte(bytes, 9)) # get_byte(t, 1));
|
14
|
+
RETURN encode( bytes, 'hex') :: uuid;
|
15
|
+
END;
|
16
|
+
$$ LANGUAGE plpgsql;
|
17
|
+
SQL
|
18
|
+
end
|
17
19
|
end
|
18
20
|
end
|
data/lib/typed_uuid/version.rb
CHANGED
data/typed_uuid.gemspec
CHANGED
@@ -24,8 +24,8 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.add_development_dependency 'byebug'
|
25
25
|
s.add_development_dependency 'activesupport', '>= 6.0.0'
|
26
26
|
s.add_development_dependency 'rails', '>= 6.0.0'
|
27
|
+
s.add_development_dependency 'pg'
|
27
28
|
|
28
29
|
# Runtime
|
29
|
-
s.add_runtime_dependency 'pg'
|
30
30
|
s.add_runtime_dependency 'activerecord', '>= 6.0.0'
|
31
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: typed_uuid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '3.
|
4
|
+
version: '3.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Bracy
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -143,7 +143,7 @@ dependencies:
|
|
143
143
|
- - ">="
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '0'
|
146
|
-
type: :
|
146
|
+
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
@@ -190,7 +190,7 @@ files:
|
|
190
190
|
homepage: https://github.com/malomalo/typed_uuid
|
191
191
|
licenses: []
|
192
192
|
metadata: {}
|
193
|
-
post_install_message:
|
193
|
+
post_install_message:
|
194
194
|
rdoc_options: []
|
195
195
|
require_paths:
|
196
196
|
- lib
|
@@ -205,8 +205,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
205
205
|
- !ruby/object:Gem::Version
|
206
206
|
version: '0'
|
207
207
|
requirements: []
|
208
|
-
rubygems_version: 3.
|
209
|
-
signing_key:
|
208
|
+
rubygems_version: 3.1.4
|
209
|
+
signing_key:
|
210
210
|
specification_version: 4
|
211
211
|
summary: Typed UUIDs for ActiveRecord
|
212
212
|
test_files:
|