schema_plus_core 3.0.0 → 3.1.0.beta.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/prs.yml +39 -0
- data/Gemfile +2 -1
- data/README.md +8 -0
- data/gemfiles/activerecord-6.1/Gemfile.base +4 -0
- data/gemfiles/activerecord-6.1/Gemfile.mysql2 +10 -0
- data/gemfiles/activerecord-6.1/Gemfile.postgresql +10 -0
- data/gemfiles/activerecord-6.1/Gemfile.sqlite3 +10 -0
- data/gemfiles/activerecord-7.0/Gemfile.base +4 -0
- data/gemfiles/activerecord-7.0/Gemfile.mysql2 +10 -0
- data/gemfiles/activerecord-7.0/Gemfile.postgresql +10 -0
- data/gemfiles/activerecord-7.0/Gemfile.sqlite3 +10 -0
- data/lib/schema_plus/core/active_record/connection_adapters/abstract_adapter.rb +51 -14
- data/lib/schema_plus/core/active_record/connection_adapters/mysql2_adapter.rb +11 -3
- data/lib/schema_plus/core/active_record/connection_adapters/postgresql/schema_dumper.rb +9 -5
- data/lib/schema_plus/core/active_record/connection_adapters/postgresql_adapter.rb +17 -9
- data/lib/schema_plus/core/active_record/connection_adapters/sqlite3_adapter.rb +11 -3
- data/lib/schema_plus/core/active_record/connection_adapters/table_definition.rb +11 -3
- data/lib/schema_plus/core/active_record/schema_dumper.rb +14 -2
- data/lib/schema_plus/core/middleware.rb +1 -1
- data/lib/schema_plus/core/schema_dump.rb +8 -2
- data/lib/schema_plus/core/version.rb +1 -1
- data/lib/schema_plus/core.rb +1 -0
- data/schema_dev.yml +3 -0
- data/schema_plus_core.gemspec +3 -3
- data/spec/dumper_spec.rb +16 -8
- data/spec/spec_helper.rb +1 -2
- metadata +19 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4586a053807f1a6935ef1198491c6ab3c9ea3a1a11869f18b042ca4b380d20b3
|
4
|
+
data.tar.gz: 89c538ce9a32abf2150e5cea263fbbfe8c526e5b225494be653e09a03bbe3525
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf582e7744f5d17225ae48033a912cc0b2f27e3c9bea09cf5fe02334dc794b821281bc5c5ae89391a6385c4aca407f1a31d0a54076396b337ac8e3e5c68fd2c2
|
7
|
+
data.tar.gz: 2d9cd2b0b7ee4f326cf98366b3f20fb1acf7fd37f40614ac6e66e9c7379493afbcf68757f511e90663b4ccb64cb0acefb6225ec61ad8408407b8c1448bb88aac
|
data/.github/workflows/prs.yml
CHANGED
@@ -22,9 +22,12 @@ jobs:
|
|
22
22
|
- '2.5'
|
23
23
|
- '2.7'
|
24
24
|
- '3.0'
|
25
|
+
- '3.1'
|
25
26
|
activerecord:
|
26
27
|
- '5.2'
|
27
28
|
- '6.0'
|
29
|
+
- '6.1'
|
30
|
+
- '7.0'
|
28
31
|
db:
|
29
32
|
- mysql2
|
30
33
|
- sqlite3
|
@@ -34,6 +37,10 @@ jobs:
|
|
34
37
|
exclude:
|
35
38
|
- ruby: '3.0'
|
36
39
|
activerecord: '5.2'
|
40
|
+
- ruby: '3.1'
|
41
|
+
activerecord: '5.2'
|
42
|
+
- ruby: '2.5'
|
43
|
+
activerecord: '7.0'
|
37
44
|
- db: skip
|
38
45
|
dbversion: skip
|
39
46
|
include:
|
@@ -45,6 +52,10 @@ jobs:
|
|
45
52
|
activerecord: '6.0'
|
46
53
|
db: postgresql
|
47
54
|
dbversion: '9.6'
|
55
|
+
- ruby: '2.5'
|
56
|
+
activerecord: '6.1'
|
57
|
+
db: postgresql
|
58
|
+
dbversion: '9.6'
|
48
59
|
- ruby: '2.7'
|
49
60
|
activerecord: '5.2'
|
50
61
|
db: postgresql
|
@@ -53,10 +64,38 @@ jobs:
|
|
53
64
|
activerecord: '6.0'
|
54
65
|
db: postgresql
|
55
66
|
dbversion: '9.6'
|
67
|
+
- ruby: '2.7'
|
68
|
+
activerecord: '6.1'
|
69
|
+
db: postgresql
|
70
|
+
dbversion: '9.6'
|
71
|
+
- ruby: '2.7'
|
72
|
+
activerecord: '7.0'
|
73
|
+
db: postgresql
|
74
|
+
dbversion: '9.6'
|
75
|
+
- ruby: '3.0'
|
76
|
+
activerecord: '6.0'
|
77
|
+
db: postgresql
|
78
|
+
dbversion: '9.6'
|
79
|
+
- ruby: '3.0'
|
80
|
+
activerecord: '6.1'
|
81
|
+
db: postgresql
|
82
|
+
dbversion: '9.6'
|
56
83
|
- ruby: '3.0'
|
84
|
+
activerecord: '7.0'
|
85
|
+
db: postgresql
|
86
|
+
dbversion: '9.6'
|
87
|
+
- ruby: '3.1'
|
57
88
|
activerecord: '6.0'
|
58
89
|
db: postgresql
|
59
90
|
dbversion: '9.6'
|
91
|
+
- ruby: '3.1'
|
92
|
+
activerecord: '6.1'
|
93
|
+
db: postgresql
|
94
|
+
dbversion: '9.6'
|
95
|
+
- ruby: '3.1'
|
96
|
+
activerecord: '7.0'
|
97
|
+
db: postgresql
|
98
|
+
dbversion: '9.6'
|
60
99
|
env:
|
61
100
|
BUNDLE_GEMFILE: "${{ github.workspace }}/gemfiles/activerecord-${{ matrix.activerecord }}/Gemfile.${{ matrix.db }}"
|
62
101
|
POSTGRESQL_DB_HOST: 127.0.0.1
|
data/Gemfile
CHANGED
@@ -4,4 +4,5 @@ source "http://rubygems.org"
|
|
4
4
|
|
5
5
|
gemspec
|
6
6
|
|
7
|
-
|
7
|
+
gemfile_local = File.expand_path '../Gemfile.local', __FILE__
|
8
|
+
eval File.read(gemfile_local), binding, gemfile_local if File.exist? gemfile_local
|
data/README.md
CHANGED
@@ -25,9 +25,17 @@ SchemaPlus::Core is tested on:
|
|
25
25
|
<!-- These lines are auto-generated by schema_dev based on schema_dev.yml -->
|
26
26
|
* ruby **2.5** with activerecord **5.2**, using **postgresql:9.6**, **mysql2** or **sqlite3**
|
27
27
|
* ruby **2.5** with activerecord **6.0**, using **postgresql:9.6**, **mysql2** or **sqlite3**
|
28
|
+
* ruby **2.5** with activerecord **6.1**, using **postgresql:9.6**, **mysql2** or **sqlite3**
|
28
29
|
* ruby **2.7** with activerecord **5.2**, using **postgresql:9.6**, **mysql2** or **sqlite3**
|
29
30
|
* ruby **2.7** with activerecord **6.0**, using **postgresql:9.6**, **mysql2** or **sqlite3**
|
31
|
+
* ruby **2.7** with activerecord **6.1**, using **postgresql:9.6**, **mysql2** or **sqlite3**
|
32
|
+
* ruby **2.7** with activerecord **7.0**, using **postgresql:9.6**, **mysql2** or **sqlite3**
|
30
33
|
* ruby **3.0** with activerecord **6.0**, using **postgresql:9.6**, **mysql2** or **sqlite3**
|
34
|
+
* ruby **3.0** with activerecord **6.1**, using **postgresql:9.6**, **mysql2** or **sqlite3**
|
35
|
+
* ruby **3.0** with activerecord **7.0**, using **postgresql:9.6**, **mysql2** or **sqlite3**
|
36
|
+
* ruby **3.1** with activerecord **6.0**, using **postgresql:9.6**, **mysql2** or **sqlite3**
|
37
|
+
* ruby **3.1** with activerecord **6.1**, using **postgresql:9.6**, **mysql2** or **sqlite3**
|
38
|
+
* ruby **3.1** with activerecord **7.0**, using **postgresql:9.6**, **mysql2** or **sqlite3**
|
31
39
|
|
32
40
|
<!-- SCHEMA_DEV: MATRIX - end -->
|
33
41
|
|
@@ -5,7 +5,6 @@ module SchemaPlus
|
|
5
5
|
module ActiveRecord
|
6
6
|
module ConnectionAdapters
|
7
7
|
module AbstractAdapter
|
8
|
-
|
9
8
|
def add_column(table_name, name, type, **options)
|
10
9
|
options = options.deep_dup
|
11
10
|
SchemaMonkey::Middleware::Migration::Column.start(caller: self, operation: :add, table_name: table_name, column_name: name, type: type, implements_reference: options.delete(:_implements_reference), options: options) do |env|
|
@@ -36,27 +35,65 @@ module SchemaPlus
|
|
36
35
|
super env.table_name, **env.options
|
37
36
|
end
|
38
37
|
end
|
38
|
+
end
|
39
|
+
end
|
39
40
|
|
40
|
-
|
41
|
-
|
42
|
-
|
41
|
+
if Gem::Version.new(::ActiveRecord::VERSION::STRING) < Gem::Version.new('6.1')
|
42
|
+
module ConnectionAdapters
|
43
|
+
module AbstractAdapter
|
44
|
+
# replaced version to handle array of columns with expressions
|
45
|
+
def quoted_columns_for_index(column_names, **options)
|
46
|
+
output_columns = []
|
43
47
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
48
|
+
column_names.each do |column|
|
49
|
+
if column.is_a?(String) && column.include?('(')
|
50
|
+
output_columns << column
|
51
|
+
else
|
52
|
+
quoted = {column.to_sym => quote_column_name(column).dup}
|
53
|
+
output_columns.concat add_options_for_index_columns(quoted, **options).values
|
54
|
+
end
|
50
55
|
end
|
56
|
+
|
57
|
+
output_columns
|
51
58
|
end
|
52
59
|
|
53
|
-
|
54
|
-
end
|
55
|
-
private :quoted_columns_for_index
|
60
|
+
private :quoted_columns_for_index
|
56
61
|
|
62
|
+
module SchemaCreation
|
57
63
|
|
58
|
-
|
64
|
+
def add_column_options!(sql, options)
|
65
|
+
sql << +" " + SchemaMonkey::Middleware::Sql::ColumnOptions.start(caller: self, connection: self.instance_variable_get('@conn'), sql: +"", column: options[:column], options: options.except(:column)) { |env|
|
66
|
+
super env.sql, env.options.merge(column: env.column)
|
67
|
+
}.sql.lstrip
|
68
|
+
end
|
59
69
|
|
70
|
+
def visit_TableDefinition(o)
|
71
|
+
SchemaMonkey::Middleware::Sql::Table.start(caller: self, connection: self.instance_variable_get('@conn'), table_definition: o, sql: SqlStruct::Table.new) { |env|
|
72
|
+
env.sql.parse! super env.table_definition
|
73
|
+
}.sql.assemble
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
else
|
79
|
+
# In AR 6.1+ quoted_columns_for_index has slightly different paramater style and a different return type
|
80
|
+
# Also SchemaCreation is no longer nested beneath AbstractAdapter
|
81
|
+
module ConnectionAdapters
|
82
|
+
module AbstractAdapter
|
83
|
+
# replaced version to handle array of columns with expressions
|
84
|
+
def quoted_columns_for_index(column_names, options)
|
85
|
+
column_names.each_with_object([]) do |column, output_columns|
|
86
|
+
if column.is_a?(String) && column.include?('(')
|
87
|
+
output_columns << column
|
88
|
+
else
|
89
|
+
quoted = {column.to_sym => quote_column_name(column).dup}
|
90
|
+
output_columns.concat add_options_for_index_columns(quoted, **options).values
|
91
|
+
end
|
92
|
+
end.join(', ')
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
module SchemaCreation
|
60
97
|
def add_column_options!(sql, options)
|
61
98
|
sql << +" " + SchemaMonkey::Middleware::Sql::ColumnOptions.start(caller: self, connection: self.instance_variable_get('@conn'), sql: +"", column: options[:column], options: options.except(:column)) { |env|
|
62
99
|
super env.sql, env.options.merge(column: env.column)
|
@@ -12,9 +12,17 @@ module SchemaPlus
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
if Gem::Version.new(::ActiveRecord::VERSION::STRING) < Gem::Version.new('6.1')
|
16
|
+
def add_index(table_name, column_names, options = {})
|
17
|
+
SchemaMonkey::Middleware::Migration::Index.start(caller: self, operation: :add, table_name: table_name, column_names: column_names, options: options.deep_dup) do |env|
|
18
|
+
super env.table_name, env.column_names, env.options
|
19
|
+
end
|
20
|
+
end
|
21
|
+
else
|
22
|
+
def add_index(table_name, column_names, **options)
|
23
|
+
SchemaMonkey::Middleware::Migration::Index.start(caller: self, operation: :add, table_name: table_name, column_names: column_names, options: options.deep_dup) do |env|
|
24
|
+
super env.table_name, env.column_names, **env.options
|
25
|
+
end
|
18
26
|
end
|
19
27
|
end
|
20
28
|
|
@@ -26,11 +26,15 @@ module SchemaPlus
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def extensions(_)
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
29
|
+
stream = StringIO.new
|
30
|
+
super stream
|
31
|
+
@dump.extensions << stream.string unless stream.string.blank?
|
32
|
+
end
|
33
|
+
|
34
|
+
def types(_)
|
35
|
+
stream = StringIO.new
|
36
|
+
super stream
|
37
|
+
@dump.types << stream.string unless stream.string.blank?
|
34
38
|
end
|
35
39
|
end
|
36
40
|
end
|
@@ -12,9 +12,17 @@ module SchemaPlus
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
if Gem::Version.new(::ActiveRecord::VERSION::STRING) < Gem::Version.new('6.1')
|
16
|
+
def add_index(table_name, column_names, options = {})
|
17
|
+
SchemaMonkey::Middleware::Migration::Index.start(caller: self, operation: :add, table_name: table_name, column_names: column_names, options: options.deep_dup) do |env|
|
18
|
+
super env.table_name, env.column_names, env.options
|
19
|
+
end
|
20
|
+
end
|
21
|
+
else
|
22
|
+
def add_index(table_name, column_names, **options)
|
23
|
+
SchemaMonkey::Middleware::Migration::Index.start(caller: self, operation: :add, table_name: table_name, column_names: column_names, options: options.deep_dup) do |env|
|
24
|
+
super env.table_name, env.column_names, **env.options
|
25
|
+
end
|
18
26
|
end
|
19
27
|
end
|
20
28
|
|
@@ -30,15 +38,15 @@ module SchemaPlus
|
|
30
38
|
end
|
31
39
|
end
|
32
40
|
|
33
|
-
def exec_cache(sql, name, binds)
|
34
|
-
SchemaMonkey::Middleware::Query::Exec.start(connection: self, sql: sql, query_name: name, binds: binds) { |env|
|
35
|
-
env.result = super env.sql, env.query_name, env.binds
|
41
|
+
def exec_cache(sql, name, binds, **options)
|
42
|
+
SchemaMonkey::Middleware::Query::Exec.start(connection: self, sql: sql, query_name: name, binds: binds, options: options) { |env|
|
43
|
+
env.result = super env.sql, env.query_name, env.binds, **env.options
|
36
44
|
}.result
|
37
45
|
end
|
38
46
|
|
39
|
-
def exec_no_cache(sql, name, binds)
|
40
|
-
SchemaMonkey::Middleware::Query::Exec.start(connection: self, sql: sql, query_name: name, binds: binds) { |env|
|
41
|
-
env.result = super env.sql, env.query_name, env.binds
|
47
|
+
def exec_no_cache(sql, name, binds, **options)
|
48
|
+
SchemaMonkey::Middleware::Query::Exec.start(connection: self, sql: sql, query_name: name, binds: binds, options: options) { |env|
|
49
|
+
env.result = super env.sql, env.query_name, env.binds, **env.options
|
42
50
|
}.result
|
43
51
|
end
|
44
52
|
|
@@ -18,9 +18,17 @@ module SchemaPlus
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
if Gem::Version.new(::ActiveRecord::VERSION::STRING) < Gem::Version.new('6.1')
|
22
|
+
def add_index(table_name, column_names, options = {})
|
23
|
+
SchemaMonkey::Middleware::Migration::Index.start(caller: self, operation: :add, table_name: table_name, column_names: column_names, options: options.deep_dup) do |env|
|
24
|
+
super env.table_name, env.column_names, env.options
|
25
|
+
end
|
26
|
+
end
|
27
|
+
else
|
28
|
+
def add_index(table_name, column_names, **options)
|
29
|
+
SchemaMonkey::Middleware::Migration::Index.start(caller: self, operation: :add, table_name: table_name, column_names: column_names, options: options.deep_dup) do |env|
|
30
|
+
super env.table_name, env.column_names, **env.options
|
31
|
+
end
|
24
32
|
end
|
25
33
|
end
|
26
34
|
|
@@ -27,9 +27,17 @@ module SchemaPlus
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
if Gem::Version.new(::ActiveRecord::VERSION::STRING) < Gem::Version.new('6.1')
|
31
|
+
def index(column_name, options = {})
|
32
|
+
SchemaMonkey::Middleware::Migration::Index.start(caller: self, operation: :define, table_name: self.name, column_names: column_name, options: options.deep_dup) do |env|
|
33
|
+
super env.column_names, env.options
|
34
|
+
end
|
35
|
+
end
|
36
|
+
else
|
37
|
+
def index(column_name, **options)
|
38
|
+
SchemaMonkey::Middleware::Migration::Index.start(caller: self, operation: :define, table_name: self.name, column_names: column_name, options: options.deep_dup) do |env|
|
39
|
+
super env.column_names, **env.options
|
40
|
+
end
|
33
41
|
end
|
34
42
|
end
|
35
43
|
end
|
@@ -32,14 +32,26 @@ module SchemaPlus
|
|
32
32
|
@dump.trailer = stream.string
|
33
33
|
end
|
34
34
|
|
35
|
-
def
|
35
|
+
def header(_)
|
36
36
|
SchemaMonkey::Middleware::Dumper::Initial.start(dumper: self, connection: @connection, dump: @dump, initial: @dump.initial) do |env|
|
37
37
|
stream = StringIO.new
|
38
38
|
super stream
|
39
|
-
env.dump.
|
39
|
+
env.dump.header = stream.string
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
+
def extensions(_)
|
44
|
+
stream = StringIO.new
|
45
|
+
super stream
|
46
|
+
@dump.extensions << stream.string unless stream.string.blank?
|
47
|
+
end
|
48
|
+
|
49
|
+
def types(_)
|
50
|
+
stream = StringIO.new
|
51
|
+
super stream
|
52
|
+
@dump.types << stream.string unless stream.string.blank?
|
53
|
+
end
|
54
|
+
|
43
55
|
def tables(_)
|
44
56
|
SchemaMonkey::Middleware::Dumper::Tables.start(dumper: self, connection: @connection, dump: @dump) do |env|
|
45
57
|
super nil
|
@@ -5,13 +5,16 @@ module SchemaPlus
|
|
5
5
|
class SchemaDump
|
6
6
|
include TSort
|
7
7
|
|
8
|
-
attr_reader :initial, :tables, :dependencies, :data
|
9
|
-
attr_accessor :final, :trailer
|
8
|
+
attr_reader :initial, :extensions, :types, :tables, :dependencies, :data
|
9
|
+
attr_accessor :header, :final, :trailer
|
10
10
|
|
11
11
|
def initialize(dumper)
|
12
12
|
@dumper = dumper
|
13
13
|
@dependencies = Hash.new { |h, k| h[k] = [] }
|
14
|
+
@header = ''
|
14
15
|
@initial = []
|
16
|
+
@extensions = []
|
17
|
+
@types = []
|
15
18
|
@tables = {}
|
16
19
|
@final = []
|
17
20
|
@data = OpenStruct.new # a place for middleware to leave data
|
@@ -23,7 +26,10 @@ module SchemaPlus
|
|
23
26
|
end
|
24
27
|
|
25
28
|
def assemble(stream)
|
29
|
+
stream.puts @header
|
26
30
|
stream.puts @initial.join("\n") if initial.any?
|
31
|
+
stream.puts @extensions.join("\n") if extensions.any?
|
32
|
+
stream.puts @types.join("\n") if types.any?
|
27
33
|
assemble_tables(stream)
|
28
34
|
final.each do |statement|
|
29
35
|
stream.puts " #{statement}"
|
data/lib/schema_plus/core.rb
CHANGED
data/schema_dev.yml
CHANGED
data/schema_plus_core.gemspec
CHANGED
@@ -21,12 +21,12 @@ Gem::Specification.new do |gem|
|
|
21
21
|
|
22
22
|
gem.required_ruby_version = ">= 2.5.0"
|
23
23
|
|
24
|
-
gem.add_dependency "activerecord", ">= 5.2", "<
|
25
|
-
gem.add_dependency "schema_monkey", "~> 3.0.1"
|
24
|
+
gem.add_dependency "activerecord", ">= 5.2", "< 7.1"
|
25
|
+
gem.add_dependency "schema_monkey", "~> 3.0.2.beta.1"
|
26
26
|
|
27
27
|
gem.add_development_dependency "bundler"
|
28
28
|
gem.add_development_dependency "rake", "~> 13.0.0"
|
29
29
|
gem.add_development_dependency "rspec", "~> 3.0"
|
30
30
|
gem.add_development_dependency "rspec-given"
|
31
|
-
gem.add_development_dependency "schema_dev", "~> 4.1"
|
31
|
+
gem.add_development_dependency "schema_dev", "~> 4.2.beta.1"
|
32
32
|
end
|
data/spec/dumper_spec.rb
CHANGED
@@ -46,16 +46,14 @@ describe SchemaMonkey::Middleware::Dumper do
|
|
46
46
|
|
47
47
|
let(:migration) { ::ActiveRecord::Migration }
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
around(:each) do |example|
|
49
|
+
around(postgresql: :only) do |example|
|
52
50
|
begin
|
53
|
-
migration.execute "CREATE TYPE custom_type AS ENUM ('a', 'b')"
|
51
|
+
migration.execute "CREATE TYPE custom_type AS ENUM ('a', 'b')"
|
54
52
|
example.run
|
55
53
|
ensure
|
56
54
|
migration.execute "DROP TYPE IF EXISTS custom_type CASCADE";
|
57
55
|
end
|
58
|
-
end
|
56
|
+
end
|
59
57
|
|
60
58
|
before(:each) do
|
61
59
|
migration.create_table "things" do |t|
|
@@ -66,7 +64,10 @@ describe SchemaMonkey::Middleware::Dumper do
|
|
66
64
|
t.references :thing
|
67
65
|
end
|
68
66
|
migration.add_foreign_key("other", "things")
|
69
|
-
|
67
|
+
end
|
68
|
+
|
69
|
+
before(postgresql: :only) do
|
70
|
+
migration.execute "CREATE TABLE custom_table ( my_column custom_type DEFAULT 'a'::custom_type NOT NULL)"
|
70
71
|
end
|
71
72
|
|
72
73
|
context "column default expressions", postgresql: :only do
|
@@ -79,7 +80,7 @@ describe SchemaMonkey::Middleware::Dumper do
|
|
79
80
|
end
|
80
81
|
|
81
82
|
context TestDumper::Middleware::Dumper::Initial do
|
82
|
-
Then { expect(dump).to match(/Schema[.]define.*do\s+#{middleware}/) }
|
83
|
+
Then { expect(dump).to match(/Schema([\[\].0-9]+)?[.]define.*do\s+#{middleware}/) }
|
83
84
|
end
|
84
85
|
|
85
86
|
context TestDumper::Middleware::Dumper::Tables do
|
@@ -112,7 +113,14 @@ describe SchemaMonkey::Middleware::Dumper do
|
|
112
113
|
context TestDumper::Middleware::Dumper::Table do
|
113
114
|
Then { expect(dump).to match(/t[.]integer.*:option=>"#{middleware}" \# comment: #{middleware}/) }
|
114
115
|
Then { expect(dump).to match(/statement: #{middleware}\s+end\s+(add_index.*)?\s+trailer: #{middleware}/) }
|
115
|
-
|
116
|
+
|
117
|
+
Then(postgresql: :only, rails: '< 7.0') {
|
118
|
+
expect(dump).to match(/could not dump table.*custom_table.*unknown type.*custom_type/mi)
|
119
|
+
}
|
120
|
+
Then(postgresql: :only, rails: '>= 7.0') {
|
121
|
+
expect(dump).to match(/create_enum.+custom_type/mi)
|
122
|
+
}
|
123
|
+
|
116
124
|
Then { expect(dump).to match(/t[.]index.*:option=>"#{middleware}"/) }
|
117
125
|
end
|
118
126
|
|
data/spec/spec_helper.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'simplecov'
|
4
|
-
SimpleCov.start
|
4
|
+
SimpleCov.start unless SimpleCov.running
|
5
5
|
|
6
6
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
7
7
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
@@ -39,4 +39,3 @@ RSpec.configure do |config|
|
|
39
39
|
end
|
40
40
|
|
41
41
|
SimpleCov.command_name "[ruby #{RUBY_VERSION} - ActiveRecord #{::ActiveRecord::VERSION::STRING} - #{ActiveRecord::Base.connection.adapter_name}]"
|
42
|
-
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: schema_plus_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.1.0.beta.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ronen barzel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '5.2'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '7.1'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,21 +29,21 @@ dependencies:
|
|
29
29
|
version: '5.2'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '7.1'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: schema_monkey
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: 3.0.1
|
39
|
+
version: 3.0.2.beta.1
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 3.0.1
|
46
|
+
version: 3.0.2.beta.1
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -106,14 +106,14 @@ dependencies:
|
|
106
106
|
requirements:
|
107
107
|
- - "~>"
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
109
|
+
version: 4.2.beta.1
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
114
|
- - "~>"
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version:
|
116
|
+
version: 4.2.beta.1
|
117
117
|
description: Provides an internal extension API to ActiveRecord, in the form of middleware-style
|
118
118
|
callback stacks
|
119
119
|
email:
|
@@ -138,6 +138,14 @@ files:
|
|
138
138
|
- gemfiles/activerecord-6.0/Gemfile.mysql2
|
139
139
|
- gemfiles/activerecord-6.0/Gemfile.postgresql
|
140
140
|
- gemfiles/activerecord-6.0/Gemfile.sqlite3
|
141
|
+
- gemfiles/activerecord-6.1/Gemfile.base
|
142
|
+
- gemfiles/activerecord-6.1/Gemfile.mysql2
|
143
|
+
- gemfiles/activerecord-6.1/Gemfile.postgresql
|
144
|
+
- gemfiles/activerecord-6.1/Gemfile.sqlite3
|
145
|
+
- gemfiles/activerecord-7.0/Gemfile.base
|
146
|
+
- gemfiles/activerecord-7.0/Gemfile.mysql2
|
147
|
+
- gemfiles/activerecord-7.0/Gemfile.postgresql
|
148
|
+
- gemfiles/activerecord-7.0/Gemfile.sqlite3
|
141
149
|
- lib/schema_plus/core.rb
|
142
150
|
- lib/schema_plus/core/active_record/base.rb
|
143
151
|
- lib/schema_plus/core/active_record/connection_adapters/abstract_adapter.rb
|
@@ -178,11 +186,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
178
186
|
version: 2.5.0
|
179
187
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
180
188
|
requirements:
|
181
|
-
- - "
|
189
|
+
- - ">"
|
182
190
|
- !ruby/object:Gem::Version
|
183
|
-
version:
|
191
|
+
version: 1.3.1
|
184
192
|
requirements: []
|
185
|
-
rubygems_version: 3.
|
193
|
+
rubygems_version: 3.1.6
|
186
194
|
signing_key:
|
187
195
|
specification_version: 4
|
188
196
|
summary: Provides an internal extension API to ActiveRecord
|