safe-pg-migrations 1.4.0 → 1.4.1
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
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d05d2e6c8647af8e618652235043dfde1b104065e71113f9f55c25117dd6ab6
|
4
|
+
data.tar.gz: 1f67d82d62855e6566f39c92b3cfdf4e9d6f68cc2bd0b9105c3e61ba32fd8ddf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: daeed81cfc524ad80427179930e86b9ba71d4743e390dc8c5ce805d01ea3fdbb9866c30707f76d6b7578c9370b9761564b784813f165c52e1512afdffd9d74ed
|
7
|
+
data.tar.gz: cb4346bcaf47707bb811cefcace498683f63a7854d80c47487dac462b1e79ec62ee702a75fd18985b114a0ab4b69a8863274eb2af86517f166f50795dff3cc55
|
@@ -5,7 +5,7 @@ module SafePgMigrations
|
|
5
5
|
ruby2_keywords def add_index(table_name, column_name, *args)
|
6
6
|
options = args.last.is_a?(Hash) ? args.last : {}
|
7
7
|
|
8
|
-
index_definition
|
8
|
+
index_definition = index_definition(table_name, column_name, **options)
|
9
9
|
|
10
10
|
return super unless index_name_exists?(index_definition.table, index_definition.name)
|
11
11
|
|
@@ -70,6 +70,13 @@ module SafePgMigrations
|
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
|
+
protected
|
74
|
+
|
75
|
+
def index_definition(table_name, column_name, **options)
|
76
|
+
index_definition, = add_index_options(table_name, column_name, **options)
|
77
|
+
index_definition
|
78
|
+
end
|
79
|
+
|
73
80
|
private
|
74
81
|
|
75
82
|
def index_valid?(index_name)
|
@@ -14,6 +14,19 @@ module SafePgMigrations
|
|
14
14
|
super(from_table, to_table, **options)
|
15
15
|
end
|
16
16
|
|
17
|
+
protected
|
18
|
+
|
19
|
+
IndexDefinition = Struct.new(:table, :name)
|
20
|
+
|
21
|
+
def index_definition(table_name, column_name, **options)
|
22
|
+
return super(table_name, column_name, **options) if satisfied? '>=6.1.0'
|
23
|
+
|
24
|
+
index_name = options.key?(:name) ? options[:name].to_s : index_name(table_name, index_column_names(column_name))
|
25
|
+
validate_index_length!(table_name, index_name, options.fetch(:internal, false))
|
26
|
+
|
27
|
+
IndexDefinition.new(table_name, index_name)
|
28
|
+
end
|
29
|
+
|
17
30
|
private
|
18
31
|
|
19
32
|
def satisfied?(version)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: safe-pg-migrations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthieu Prat
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2022-
|
13
|
+
date: 2022-03-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|
@@ -54,118 +54,6 @@ dependencies:
|
|
54
54
|
- - ">="
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: 0.0.4
|
57
|
-
- !ruby/object:Gem::Dependency
|
58
|
-
name: bundler
|
59
|
-
requirement: !ruby/object:Gem::Requirement
|
60
|
-
requirements:
|
61
|
-
- - ">="
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
version: '0'
|
64
|
-
type: :development
|
65
|
-
prerelease: false
|
66
|
-
version_requirements: !ruby/object:Gem::Requirement
|
67
|
-
requirements:
|
68
|
-
- - ">="
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
version: '0'
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
name: minitest
|
73
|
-
requirement: !ruby/object:Gem::Requirement
|
74
|
-
requirements:
|
75
|
-
- - ">="
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: '0'
|
78
|
-
type: :development
|
79
|
-
prerelease: false
|
80
|
-
version_requirements: !ruby/object:Gem::Requirement
|
81
|
-
requirements:
|
82
|
-
- - ">="
|
83
|
-
- !ruby/object:Gem::Version
|
84
|
-
version: '0'
|
85
|
-
- !ruby/object:Gem::Dependency
|
86
|
-
name: mocha
|
87
|
-
requirement: !ruby/object:Gem::Requirement
|
88
|
-
requirements:
|
89
|
-
- - ">="
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
version: '0'
|
92
|
-
type: :development
|
93
|
-
prerelease: false
|
94
|
-
version_requirements: !ruby/object:Gem::Requirement
|
95
|
-
requirements:
|
96
|
-
- - ">="
|
97
|
-
- !ruby/object:Gem::Version
|
98
|
-
version: '0'
|
99
|
-
- !ruby/object:Gem::Dependency
|
100
|
-
name: pg
|
101
|
-
requirement: !ruby/object:Gem::Requirement
|
102
|
-
requirements:
|
103
|
-
- - ">="
|
104
|
-
- !ruby/object:Gem::Version
|
105
|
-
version: '0'
|
106
|
-
type: :development
|
107
|
-
prerelease: false
|
108
|
-
version_requirements: !ruby/object:Gem::Requirement
|
109
|
-
requirements:
|
110
|
-
- - ">="
|
111
|
-
- !ruby/object:Gem::Version
|
112
|
-
version: '0'
|
113
|
-
- !ruby/object:Gem::Dependency
|
114
|
-
name: pry
|
115
|
-
requirement: !ruby/object:Gem::Requirement
|
116
|
-
requirements:
|
117
|
-
- - ">="
|
118
|
-
- !ruby/object:Gem::Version
|
119
|
-
version: '0'
|
120
|
-
type: :development
|
121
|
-
prerelease: false
|
122
|
-
version_requirements: !ruby/object:Gem::Requirement
|
123
|
-
requirements:
|
124
|
-
- - ">="
|
125
|
-
- !ruby/object:Gem::Version
|
126
|
-
version: '0'
|
127
|
-
- !ruby/object:Gem::Dependency
|
128
|
-
name: pry-coolline
|
129
|
-
requirement: !ruby/object:Gem::Requirement
|
130
|
-
requirements:
|
131
|
-
- - ">="
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
version: '0'
|
134
|
-
type: :development
|
135
|
-
prerelease: false
|
136
|
-
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
requirements:
|
138
|
-
- - ">="
|
139
|
-
- !ruby/object:Gem::Version
|
140
|
-
version: '0'
|
141
|
-
- !ruby/object:Gem::Dependency
|
142
|
-
name: rake
|
143
|
-
requirement: !ruby/object:Gem::Requirement
|
144
|
-
requirements:
|
145
|
-
- - ">="
|
146
|
-
- !ruby/object:Gem::Version
|
147
|
-
version: '0'
|
148
|
-
type: :development
|
149
|
-
prerelease: false
|
150
|
-
version_requirements: !ruby/object:Gem::Requirement
|
151
|
-
requirements:
|
152
|
-
- - ">="
|
153
|
-
- !ruby/object:Gem::Version
|
154
|
-
version: '0'
|
155
|
-
- !ruby/object:Gem::Dependency
|
156
|
-
name: rubocop
|
157
|
-
requirement: !ruby/object:Gem::Requirement
|
158
|
-
requirements:
|
159
|
-
- - ">="
|
160
|
-
- !ruby/object:Gem::Version
|
161
|
-
version: '0'
|
162
|
-
type: :development
|
163
|
-
prerelease: false
|
164
|
-
version_requirements: !ruby/object:Gem::Requirement
|
165
|
-
requirements:
|
166
|
-
- - ">="
|
167
|
-
- !ruby/object:Gem::Version
|
168
|
-
version: '0'
|
169
57
|
description: Make your PG migrations safe.
|
170
58
|
email:
|
171
59
|
executables: []
|