typed_uuid 2.2 → 2.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42ecd88d5a86ad89fe9a8c0cd8ec275bfded2d66ce7a7bd240f43184d0fe65ab
|
4
|
+
data.tar.gz: 2b32e8528b4d5dc750c54b8818ccb0fcbb99ea4d5276ece385d8af8f2f70c259
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bacb4da4092347b9a483711e7e4530979bf2b135d03bc77f03599851463c21041dbef6b566c0ba6d151c1d2c516a4ca98caa150592888f2a3c85ec941dd060d
|
7
|
+
data.tar.gz: 7e4dd50dbd81e87934f04daf4bf94ed89f7bac9f024e23886bc3c401d626137de664aa8a8e087d02cb57f1193309159a5c6a97ac5b9258ab326c787669f427dc
|
@@ -4,7 +4,7 @@ module TypedUUID::PsqlColumnMethods
|
|
4
4
|
if type == :typed_uuid
|
5
5
|
klass_enum = ::ActiveRecord::Base.uuid_type_from_table_name(self.name)
|
6
6
|
options[:id] = :uuid
|
7
|
-
options[:default] ||= -> { "typed_uuid('\\x#{klass_enum.to_s(16).
|
7
|
+
options[:default] ||= -> { "typed_uuid('\\x#{klass_enum.to_s(16).rjust(4, '0')}')" }
|
8
8
|
super(name, :uuid, **options)
|
9
9
|
else
|
10
10
|
super
|
data/lib/typed_uuid/version.rb
CHANGED
data/test/typed_uuid_test.rb
CHANGED
@@ -5,7 +5,7 @@ class FilterTest < ActiveSupport::TestCase
|
|
5
5
|
schema do
|
6
6
|
ActiveRecord::Base.register_uuid_types({
|
7
7
|
listings: 0,
|
8
|
-
buildings:
|
8
|
+
buildings: 592
|
9
9
|
})
|
10
10
|
|
11
11
|
create_table :listings, id: :typed_uuid do |t|
|
@@ -29,7 +29,7 @@ class FilterTest < ActiveSupport::TestCase
|
|
29
29
|
})
|
30
30
|
|
31
31
|
exprexted_sql = <<-SQL
|
32
|
-
CREATE TABLE "properties" ("id" uuid DEFAULT typed_uuid('\\
|
32
|
+
CREATE TABLE "properties" ("id" uuid DEFAULT typed_uuid('\\x0001') NOT NULL PRIMARY KEY, "name" character varying(255))
|
33
33
|
SQL
|
34
34
|
|
35
35
|
assert_sql exprexted_sql do
|
@@ -58,12 +58,12 @@ class FilterTest < ActiveSupport::TestCase
|
|
58
58
|
test 'uuid_type from table_name' do
|
59
59
|
assert_equal 0, ::ActiveRecord::Base.uuid_type_from_table_name(:listings)
|
60
60
|
assert_equal 0, ::ActiveRecord::Base.uuid_type_from_table_name('listings')
|
61
|
-
assert_equal
|
61
|
+
assert_equal 592, ::ActiveRecord::Base.uuid_type_from_table_name(:buildings)
|
62
62
|
end
|
63
63
|
|
64
64
|
test 'class from uuid_type' do
|
65
65
|
assert_equal FilterTest::Listing, ::ActiveRecord::Base.class_from_uuid_type(0)
|
66
|
-
assert_equal FilterTest::Building, ::ActiveRecord::Base.class_from_uuid_type(
|
66
|
+
assert_equal FilterTest::Building, ::ActiveRecord::Base.class_from_uuid_type(592)
|
67
67
|
end
|
68
68
|
|
69
69
|
end
|