activerecord-clean-db-structure 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +8 -1
- data/Gemfile.lock +2 -82
- data/activerecord-clean-db-structure.gemspec +1 -1
- data/lib/activerecord-clean-db-structure/clean_dump.rb +2 -2
- data/lib/activerecord-clean-db-structure/tasks/clean_db_structure.rake +9 -8
- data/lib/activerecord-clean-db-structure/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b826ee2d0030bf2cb6fbedbfb05847320fa903fd
|
4
|
+
data.tar.gz: 3105bcadcc1e63393398a5f2f450f0f0d63d2718
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5105b9ec5ea3cb872dc2d9b04beb83fc3718acb79d1797d8aea9fbe5d511010a33656cd8a5b0c1e9d77d35b843ab535f29bc32afe4b97c4ae0fd2f069393ef00
|
7
|
+
data.tar.gz: b259cee87ae4cbc9b75d8fcc6439fe30f37e05c9737e564baa03b1e25825cf64ab42b4eb78bb88b74621218dcb7383daef5bf8419c57a83b674b6f9b81df32ed
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
pkg
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
## 0.0
|
3
|
+
## 0.2.0 2017-03-20
|
4
|
+
|
5
|
+
* Reduce dependencies to only require ActiveRecord [Mario Uher](https://github.com/ream88)
|
6
|
+
* Support Rails Engines [Mario Uher](https://github.com/ream88)
|
7
|
+
* Clean up more comment lines [Clemens Kofler](https://github.com/clemens)
|
8
|
+
|
9
|
+
|
10
|
+
## 0.1.0 2017-02-12
|
4
11
|
|
5
12
|
* Initial release.
|
data/Gemfile.lock
CHANGED
@@ -1,38 +1,12 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
activerecord-clean-db-structure (0.
|
5
|
-
|
4
|
+
activerecord-clean-db-structure (0.2.0)
|
5
|
+
activerecord (>= 4.2)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
actioncable (5.0.1)
|
11
|
-
actionpack (= 5.0.1)
|
12
|
-
nio4r (~> 1.2)
|
13
|
-
websocket-driver (~> 0.6.1)
|
14
|
-
actionmailer (5.0.1)
|
15
|
-
actionpack (= 5.0.1)
|
16
|
-
actionview (= 5.0.1)
|
17
|
-
activejob (= 5.0.1)
|
18
|
-
mail (~> 2.5, >= 2.5.4)
|
19
|
-
rails-dom-testing (~> 2.0)
|
20
|
-
actionpack (5.0.1)
|
21
|
-
actionview (= 5.0.1)
|
22
|
-
activesupport (= 5.0.1)
|
23
|
-
rack (~> 2.0)
|
24
|
-
rack-test (~> 0.6.3)
|
25
|
-
rails-dom-testing (~> 2.0)
|
26
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
27
|
-
actionview (5.0.1)
|
28
|
-
activesupport (= 5.0.1)
|
29
|
-
builder (~> 3.1)
|
30
|
-
erubis (~> 2.7.0)
|
31
|
-
rails-dom-testing (~> 2.0)
|
32
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
33
|
-
activejob (5.0.1)
|
34
|
-
activesupport (= 5.0.1)
|
35
|
-
globalid (>= 0.3.6)
|
36
10
|
activemodel (5.0.1)
|
37
11
|
activesupport (= 5.0.1)
|
38
12
|
activerecord (5.0.1)
|
@@ -45,66 +19,12 @@ GEM
|
|
45
19
|
minitest (~> 5.1)
|
46
20
|
tzinfo (~> 1.1)
|
47
21
|
arel (7.1.4)
|
48
|
-
builder (3.2.3)
|
49
22
|
concurrent-ruby (1.0.4)
|
50
|
-
erubis (2.7.0)
|
51
|
-
globalid (0.3.7)
|
52
|
-
activesupport (>= 4.1.0)
|
53
23
|
i18n (0.8.0)
|
54
|
-
loofah (2.0.3)
|
55
|
-
nokogiri (>= 1.5.9)
|
56
|
-
mail (2.6.4)
|
57
|
-
mime-types (>= 1.16, < 4)
|
58
|
-
method_source (0.8.2)
|
59
|
-
mime-types (3.1)
|
60
|
-
mime-types-data (~> 3.2015)
|
61
|
-
mime-types-data (3.2016.0521)
|
62
|
-
mini_portile2 (2.1.0)
|
63
24
|
minitest (5.10.1)
|
64
|
-
nio4r (1.2.1)
|
65
|
-
nokogiri (1.7.0.1)
|
66
|
-
mini_portile2 (~> 2.1.0)
|
67
|
-
rack (2.0.1)
|
68
|
-
rack-test (0.6.3)
|
69
|
-
rack (>= 1.0)
|
70
|
-
rails (5.0.1)
|
71
|
-
actioncable (= 5.0.1)
|
72
|
-
actionmailer (= 5.0.1)
|
73
|
-
actionpack (= 5.0.1)
|
74
|
-
actionview (= 5.0.1)
|
75
|
-
activejob (= 5.0.1)
|
76
|
-
activemodel (= 5.0.1)
|
77
|
-
activerecord (= 5.0.1)
|
78
|
-
activesupport (= 5.0.1)
|
79
|
-
bundler (>= 1.3.0, < 2.0)
|
80
|
-
railties (= 5.0.1)
|
81
|
-
sprockets-rails (>= 2.0.0)
|
82
|
-
rails-dom-testing (2.0.2)
|
83
|
-
activesupport (>= 4.2.0, < 6.0)
|
84
|
-
nokogiri (~> 1.6)
|
85
|
-
rails-html-sanitizer (1.0.3)
|
86
|
-
loofah (~> 2.0)
|
87
|
-
railties (5.0.1)
|
88
|
-
actionpack (= 5.0.1)
|
89
|
-
activesupport (= 5.0.1)
|
90
|
-
method_source
|
91
|
-
rake (>= 0.8.7)
|
92
|
-
thor (>= 0.18.1, < 2.0)
|
93
|
-
rake (12.0.0)
|
94
|
-
sprockets (3.7.1)
|
95
|
-
concurrent-ruby (~> 1.0)
|
96
|
-
rack (> 1, < 3)
|
97
|
-
sprockets-rails (3.2.0)
|
98
|
-
actionpack (>= 4.0)
|
99
|
-
activesupport (>= 4.0)
|
100
|
-
sprockets (>= 3.0.0)
|
101
|
-
thor (0.19.4)
|
102
25
|
thread_safe (0.3.5)
|
103
26
|
tzinfo (1.2.2)
|
104
27
|
thread_safe (~> 0.1)
|
105
|
-
websocket-driver (0.6.5)
|
106
|
-
websocket-extensions (>= 0.1.0)
|
107
|
-
websocket-extensions (0.1.2)
|
108
28
|
|
109
29
|
PLATFORMS
|
110
30
|
ruby
|
@@ -37,9 +37,9 @@ module ActiveRecordCleanDbStructure
|
|
37
37
|
dump.gsub!(/^ALTER SEQUENCE \w+_id_seq OWNED BY .*;$/, '')
|
38
38
|
dump.gsub!(/^ALTER TABLE ONLY \w+ ALTER COLUMN id SET DEFAULT nextval\('\w+_id_seq'::regclass\);$/, '')
|
39
39
|
dump.gsub!(/^ALTER TABLE ONLY \w+\s+ADD CONSTRAINT \w+_pkey PRIMARY KEY \(id\);$/, '')
|
40
|
-
dump.gsub!(/^-- Name:
|
40
|
+
dump.gsub!(/^-- Name: (\w+\s+)?id; Type: DEFAULT$/, '')
|
41
41
|
dump.gsub!(/^-- .*_id_seq; Type: SEQUENCE.*/, '')
|
42
|
-
dump.gsub!(/^-- Name:
|
42
|
+
dump.gsub!(/^-- Name: (\w+\s+)?\w+_pkey; Type: CONSTRAINT$/, '')
|
43
43
|
|
44
44
|
# Remove inherited tables
|
45
45
|
inherited_tables_regexp = /-- Name: ([\w_]+); Type: TABLE\n\n[^;]+?INHERITS \([\w_]+\);/m
|
@@ -1,13 +1,14 @@
|
|
1
1
|
require 'activerecord-clean-db-structure/clean_dump'
|
2
2
|
|
3
3
|
Rake::Task['db:structure:dump'].enhance do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
filename = ENV['DB_STRUCTURE'] || File.join(ActiveRecord::Tasks::DatabaseTasks.db_dir, 'structure.sql')
|
4
|
+
filenames = ENV['DB_STRUCTURE']
|
5
|
+
filenames ||= Rails.application.config.paths['db'].map do |path|
|
6
|
+
File.join(path, 'structure.sql')
|
7
|
+
end
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
filenames.each do |filename|
|
10
|
+
cleaner = ActiveRecordCleanDbStructure::CleanDump.new(File.read(filename))
|
11
|
+
cleaner.run
|
12
|
+
File.write(filename, cleaner.dump)
|
13
|
+
end
|
13
14
|
end
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-clean-db-structure
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
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
|
+
date: 2017-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: activerecord
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
@@ -30,6 +30,7 @@ executables: []
|
|
30
30
|
extensions: []
|
31
31
|
extra_rdoc_files: []
|
32
32
|
files:
|
33
|
+
- ".gitignore"
|
33
34
|
- CHANGELOG.md
|
34
35
|
- Gemfile
|
35
36
|
- Gemfile.lock
|