activerecord-clean-db-structure 0.2.5 → 0.2.6

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
- SHA1:
3
- metadata.gz: 10dea719bd9d1f2c4fba1129d5144b80f70aff09
4
- data.tar.gz: 90d2c2073efc8e115e224628348d329331177e35
2
+ SHA256:
3
+ metadata.gz: d36c390340cb86023df909cb5566610d47881767c746a118307f64c697e1153d
4
+ data.tar.gz: bc70ca9657712e25e5b925cc4184142831a83ffd36e103df6043c3713168005e
5
5
  SHA512:
6
- metadata.gz: 9015f92b1b1e619e91ad64fee4963805daf4c241014add49423b0637adcfa2e0ff662c208d44f19441be9ef6f644424a47efd91cc2c62030ff73d52a8dfeaeee
7
- data.tar.gz: f47aba5110e6a6f9e072f43e16077a1167a92b820a7cb287a6cc77e7d4dd82ff8493d1e61af312a6128a9a85d19c0828b6b2d4f6733e355ae5ca0e8848eacab9
6
+ metadata.gz: ffa80995355e8d0e5404ea8f51eb82646e3b41a6c9ab95bd29db194a5fbbcdedce3e71c9f1da67f9ab8f6ca8b32ee336dc701e9f6a732e63b3c86e2a885ec8a7
7
+ data.tar.gz: b810eecc4cae33f4a1c0785188282264e0ad43a6975b28bf0bde9a3d1594e624f78f327ec343b9e679debe726d72856b323aef4a3004fb448e5683889d4f512b
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.6 2018-03-11
4
+
5
+ * Fix regular expressions to support schema qualification changes in 10.3
6
+
7
+
3
8
  ## 0.2.5 2017-11-15
4
9
 
5
10
  * Filter out indices belonging partitioned tables
@@ -1,31 +1,31 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- activerecord-clean-db-structure (0.2.5)
4
+ activerecord-clean-db-structure (0.2.6)
5
5
  activerecord (>= 4.2)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (5.1.4)
11
- activesupport (= 5.1.4)
12
- activerecord (5.1.4)
13
- activemodel (= 5.1.4)
14
- activesupport (= 5.1.4)
10
+ activemodel (5.1.5)
11
+ activesupport (= 5.1.5)
12
+ activerecord (5.1.5)
13
+ activemodel (= 5.1.5)
14
+ activesupport (= 5.1.5)
15
15
  arel (~> 8.0)
16
- activesupport (5.1.4)
16
+ activesupport (5.1.5)
17
17
  concurrent-ruby (~> 1.0, >= 1.0.2)
18
18
  i18n (~> 0.7)
19
19
  minitest (~> 5.1)
20
20
  tzinfo (~> 1.1)
21
21
  arel (8.0.0)
22
22
  concurrent-ruby (1.0.5)
23
- i18n (0.9.1)
23
+ i18n (0.9.5)
24
24
  concurrent-ruby (~> 1.0)
25
- minitest (5.10.3)
25
+ minitest (5.11.3)
26
26
  rake (0.9.6)
27
27
  thread_safe (0.3.6)
28
- tzinfo (1.2.4)
28
+ tzinfo (1.2.5)
29
29
  thread_safe (~> 0.1)
30
30
 
31
31
  PLATFORMS
@@ -36,4 +36,4 @@ DEPENDENCIES
36
36
  rake (~> 0)
37
37
 
38
38
  BUNDLED WITH
39
- 1.16.0
39
+ 1.16.1
@@ -38,24 +38,24 @@ module ActiveRecordCleanDbStructure
38
38
  # This is a bit optimistic, but works as long as you don't have an id field thats not a sequence/uuid
39
39
  dump.gsub!(/^ id integer NOT NULL(,)?$/, ' id SERIAL PRIMARY KEY\1')
40
40
  dump.gsub!(/^ id bigint NOT NULL(,)?$/, ' id BIGSERIAL PRIMARY KEY\1')
41
- dump.gsub!(/^ id uuid DEFAULT uuid_generate_v4\(\) NOT NULL(,)?$/, ' id uuid DEFAULT uuid_generate_v4() PRIMARY KEY\1')
42
- dump.gsub!(/^ id uuid DEFAULT gen_random_uuid\(\) NOT NULL(,)?$/, ' id uuid DEFAULT gen_random_uuid() PRIMARY KEY\1')
43
- dump.gsub!(/^CREATE SEQUENCE \w+_id_seq\s+(AS integer\s+)?START WITH 1\s+INCREMENT BY 1\s+NO MINVALUE\s+NO MAXVALUE\s+CACHE 1;$/, '')
44
- dump.gsub!(/^ALTER SEQUENCE \w+_id_seq OWNED BY .*;$/, '')
45
- dump.gsub!(/^ALTER TABLE ONLY \w+ ALTER COLUMN id SET DEFAULT nextval\('\w+_id_seq'::regclass\);$/, '')
46
- dump.gsub!(/^ALTER TABLE ONLY \w+\s+ADD CONSTRAINT \w+_pkey PRIMARY KEY \(id\);$/, '')
41
+ dump.gsub!(/^ id uuid DEFAULT (public\.)?uuid_generate_v4\(\) NOT NULL(,)?$/, ' id uuid DEFAULT \1uuid_generate_v4() PRIMARY KEY\2')
42
+ dump.gsub!(/^ id uuid DEFAULT (public\.)?gen_random_uuid\(\) NOT NULL(,)?$/, ' id uuid DEFAULT \1gen_random_uuid() PRIMARY KEY\2')
43
+ dump.gsub!(/^CREATE SEQUENCE [\w\.]+_id_seq\s+(AS integer\s+)?START WITH 1\s+INCREMENT BY 1\s+NO MINVALUE\s+NO MAXVALUE\s+CACHE 1;$/, '')
44
+ dump.gsub!(/^ALTER SEQUENCE [\w\.]+_id_seq OWNED BY .*;$/, '')
45
+ dump.gsub!(/^ALTER TABLE ONLY [\w\.]+ ALTER COLUMN id SET DEFAULT nextval\('[\w\.]+_id_seq'::regclass\);$/, '')
46
+ dump.gsub!(/^ALTER TABLE ONLY [\w\.]+\s+ADD CONSTRAINT [\w\.]+_pkey PRIMARY KEY \(id\);$/, '')
47
47
  dump.gsub!(/^-- Name: (\w+\s+)?id; Type: DEFAULT$/, '')
48
48
  dump.gsub!(/^-- .*_id_seq; Type: SEQUENCE.*/, '')
49
49
  dump.gsub!(/^-- Name: (\w+\s+)?\w+_pkey; Type: CONSTRAINT$/, '')
50
50
 
51
51
  # Remove inherited tables
52
- inherited_tables_regexp = /-- Name: ([\w_]+); Type: TABLE\n\n[^;]+?INHERITS \([\w_]+\);/m
52
+ inherited_tables_regexp = /-- Name: ([\w_\.]+); Type: TABLE\n\n[^;]+?INHERITS \([\w_\.]+\);/m
53
53
  inherited_tables = dump.scan(inherited_tables_regexp).map(&:first)
54
54
  dump.gsub!(inherited_tables_regexp, '')
55
55
  inherited_tables.each do |inherited_table|
56
- dump.gsub!(/ALTER TABLE ONLY #{inherited_table}[^;]+;/, '')
56
+ dump.gsub!(/ALTER TABLE ONLY (public\.)?#{inherited_table}[^;]+;/, '')
57
57
 
58
- index_regexp = /CREATE INDEX ([\w_]+) ON #{inherited_table}[^;]+;/m
58
+ index_regexp = /CREATE INDEX ([\w_]+) ON (public\.)?#{inherited_table}[^;]+;/m
59
59
  dump.scan(index_regexp).map(&:first).each do |inherited_table_index|
60
60
  dump.gsub!("-- Name: #{inherited_table_index}; Type: INDEX", '')
61
61
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveRecordCleanDbStructure
2
- VERSION = '0.2.5'
2
+ VERSION = '0.2.6'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-clean-db-structure
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lukas Fittl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-15 00:00:00.000000000 Z
11
+ date: 2018-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
77
  version: '0'
78
78
  requirements: []
79
79
  rubyforge_project:
80
- rubygems_version: 2.6.13
80
+ rubygems_version: 2.7.6
81
81
  signing_key:
82
82
  specification_version: 4
83
83
  summary: Automatic cleanup for the Rails db/structure.sql file (ActiveRecord/PostgreSQL)