strong_schema 0.1.0
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 +7 -0
- data/CHANGELOG.md +5 -0
- data/LICENSE.txt +21 -0
- data/README.md +92 -0
- data/Rakefile +36 -0
- data/Steepfile +8 -0
- data/lib/strong_schema/ignore_checks.rb +25 -0
- data/lib/strong_schema/railtie.rb +11 -0
- data/lib/strong_schema/schema_extension.rb +22 -0
- data/lib/strong_schema/table_extension.rb +57 -0
- data/lib/strong_schema/version.rb +5 -0
- data/lib/strong_schema.rb +41 -0
- data/rbs_collection.lock.yaml +156 -0
- data/rbs_collection.yaml +12 -0
- data/sig/strong_schema.rbs +59 -0
- metadata +72 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 8f99b64786bd64749ee2d1057010e8611c69467b0d062cef5769b924810b8df2
|
|
4
|
+
data.tar.gz: f2bafd2bad2d5ee36da1db286df226475dbcb48f516ef7102202e6dabfd21322
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: f4e791a186fe1d8861350ab1074e93c1cc51f2c2b595b01bfd3457f6d964a9a9338945731ba00d7f751b81b18c208f2f2426dc8f98b0e6fe420beb6d9f5e6271
|
|
7
|
+
data.tar.gz: 972badf7551749b3bef9d3530fe933999fdefe68b159bfdae818196c67c24f11000b4966014d694d63725abaf35696994b227c850ca40b29a456036bf89c8728
|
data/CHANGELOG.md
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 shoma07
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Strong Schema
|
|
2
|
+
|
|
3
|
+
🛡️ Brings [Strong Migrations](https://github.com/ankane/strong_migrations) safety checks to schema-based database management.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Tools using `ActiveRecord::Schema` for declarative database management lack safety checks for dangerous operations. This can lead to production issues—such as removing columns without proper safeguards or adding indexes that lock tables.
|
|
8
|
+
|
|
9
|
+
Strong Schema brings the same proven safety checks from Strong Migrations to schema-based workflows, catching unsafe operations before they reach your database.
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
Add this line to your application's Gemfile:
|
|
14
|
+
|
|
15
|
+
```ruby
|
|
16
|
+
gem 'strong_schema'
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
And then execute:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
bundle install
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
### Configuration
|
|
28
|
+
|
|
29
|
+
To customize settings, create a configuration file:
|
|
30
|
+
|
|
31
|
+
```ruby
|
|
32
|
+
# config/strong_schema.rb
|
|
33
|
+
require "strong_schema"
|
|
34
|
+
|
|
35
|
+
StrongMigrations.start_after = 20260214142757
|
|
36
|
+
StrongMigrations.lock_timeout = 10.seconds
|
|
37
|
+
StrongMigrations.statement_timeout = 1.hour
|
|
38
|
+
StrongMigrations.auto_analyze = true
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Integration with Ridgepole
|
|
42
|
+
|
|
43
|
+
When using Ridgepole, load the configuration file using the `-r` option:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
$ ridgepole --apply -c config/database.yml -r ./config/strong_schema.rb
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Ignoring Specific Operations
|
|
50
|
+
|
|
51
|
+
When you need to bypass safety checks for operations you've verified as safe, use `StrongSchema.add_ignore`:
|
|
52
|
+
|
|
53
|
+
```ruby
|
|
54
|
+
# config/strong_schema.rb
|
|
55
|
+
require "strong_schema"
|
|
56
|
+
|
|
57
|
+
# Ignore a specific column removal
|
|
58
|
+
StrongSchema.add_ignore do |method, args|
|
|
59
|
+
method == :remove_column &&
|
|
60
|
+
args[0].to_s == "users" &&
|
|
61
|
+
args[1].to_s == "old_email"
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Ignore by table name (all operations on the table)
|
|
65
|
+
StrongSchema.add_ignore do |method, args|
|
|
66
|
+
args[0].to_s == "legacy_table"
|
|
67
|
+
end
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
The block receives:
|
|
71
|
+
- `method`: Operation symbol (`:add_column`, `:remove_column`, `:change_column`, etc.)
|
|
72
|
+
- `args`: Arguments array. First element is typically the table name.
|
|
73
|
+
|
|
74
|
+
**Note:** Operations inside `change_table` blocks are detected with their original method names (`:remove_column`, `:add_column`, etc.), not as `:change_table`. The same ignore rules work for both direct operations and operations within `change_table` blocks.
|
|
75
|
+
|
|
76
|
+
## Acknowledgments
|
|
77
|
+
|
|
78
|
+
This gem stands on the shoulders of giants. Special thanks to the following project:
|
|
79
|
+
|
|
80
|
+
- [Strong Migrations](https://github.com/ankane/strong_migrations) - Safety checks for migrations
|
|
81
|
+
|
|
82
|
+
## Development
|
|
83
|
+
|
|
84
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt.
|
|
85
|
+
|
|
86
|
+
## Contributing
|
|
87
|
+
|
|
88
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/shoma07/strong_schema.
|
|
89
|
+
|
|
90
|
+
## License
|
|
91
|
+
|
|
92
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "bundler/gem_tasks"
|
|
4
|
+
require "rspec/core/rake_task"
|
|
5
|
+
|
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
7
|
+
|
|
8
|
+
require "rubocop/rake_task"
|
|
9
|
+
|
|
10
|
+
RuboCop::RakeTask.new(:lint) do |t|
|
|
11
|
+
t.options = ["--parallel"]
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
require "steep/rake_task"
|
|
15
|
+
|
|
16
|
+
Steep::RakeTask.new(:typecheck) do |t|
|
|
17
|
+
t.check.severity_level = :error
|
|
18
|
+
t.watch.verbose
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
namespace :rbs do
|
|
22
|
+
desc "Generated RBS files from rbs-inline"
|
|
23
|
+
task :inline do
|
|
24
|
+
require "rbs/inline"
|
|
25
|
+
require "rbs/inline/cli"
|
|
26
|
+
io = StringIO.new
|
|
27
|
+
RBS::Inline::CLI.new(stdout: io).run(%w[lib --opt-out])
|
|
28
|
+
result = io.tap(&:rewind)
|
|
29
|
+
.each_line.grep_v(/\A[[:blank:]]*#/).join
|
|
30
|
+
.sub(/\A(?:[[:blank:]]*\n)+/, "")
|
|
31
|
+
.sub(/(?:\n[[:blank:]]*)+\z/, "\n")
|
|
32
|
+
File.write("sig/strong_schema.rbs", result)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
task default: %i[rbs:inline typecheck spec lint]
|
data/Steepfile
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module StrongSchema
|
|
4
|
+
module IgnoreChecks
|
|
5
|
+
#: () { (Symbol, Array[untyped]) -> bool } -> void
|
|
6
|
+
def add_ignore(&block)
|
|
7
|
+
ignore_checks << block
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
#: () -> Array[Proc]
|
|
11
|
+
def ignore_checks
|
|
12
|
+
@ignore_checks ||= []
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
#: () -> void
|
|
16
|
+
def reset_ignores!
|
|
17
|
+
@ignore_checks = []
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
#: (Symbol, Array[untyped]) -> bool
|
|
21
|
+
def should_ignore?(method, args)
|
|
22
|
+
ignore_checks.any? { |check| check.call(method, args) }
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module StrongSchema
|
|
4
|
+
module SchemaExtension
|
|
5
|
+
#: (Symbol, *untyped) -> untyped
|
|
6
|
+
def method_missing(method, *args)
|
|
7
|
+
return super if method == :change_table || StrongSchema.should_ignore?(method, args)
|
|
8
|
+
|
|
9
|
+
catch(:safe) do
|
|
10
|
+
StrongMigrations::Checker.new(self).tap { |c| c.direction = :up }.perform(method, *args) do
|
|
11
|
+
super
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
begin
|
|
17
|
+
ruby2_keywords(:method_missing)
|
|
18
|
+
rescue NameError
|
|
19
|
+
# ruby2_keywords is unavailable in some Ruby versions.
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module StrongSchema
|
|
4
|
+
module TableExtension
|
|
5
|
+
OPERATION_MAP = {
|
|
6
|
+
column: :add_column,
|
|
7
|
+
index: :add_index,
|
|
8
|
+
change: :change_column,
|
|
9
|
+
change_default: :change_column_default,
|
|
10
|
+
change_null: :change_column_null,
|
|
11
|
+
remove: :remove_column,
|
|
12
|
+
remove_index: :remove_index,
|
|
13
|
+
remove_timestamps: :remove_timestamps,
|
|
14
|
+
rename: :rename_column,
|
|
15
|
+
references: :add_reference,
|
|
16
|
+
belongs_to: :add_reference,
|
|
17
|
+
remove_references: :remove_reference,
|
|
18
|
+
remove_belongs_to: :remove_reference,
|
|
19
|
+
foreign_key: :add_foreign_key,
|
|
20
|
+
check_constraint: :add_check_constraint
|
|
21
|
+
}.freeze #: Hash[Symbol, Symbol]
|
|
22
|
+
public_constant :OPERATION_MAP
|
|
23
|
+
|
|
24
|
+
OPERATION_MAP.each do |table_method, migration_method|
|
|
25
|
+
define_method(table_method) do |*args, **kwargs, &block|
|
|
26
|
+
return super(*args, **kwargs, &block) if StrongSchema.should_ignore?(migration_method, [@name, *args])
|
|
27
|
+
|
|
28
|
+
catch(:safe) do
|
|
29
|
+
checker = StrongMigrations::Checker.new(MigrationProxy.instance).tap { |c| c.direction = :up }
|
|
30
|
+
checker.perform(migration_method, @name, *args, **kwargs) { super(*args, **kwargs, &block) }
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
class MigrationProxy
|
|
36
|
+
include Singleton
|
|
37
|
+
|
|
38
|
+
#: () -> false
|
|
39
|
+
def reverting?
|
|
40
|
+
false
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
#: () -> nil
|
|
44
|
+
def version; end
|
|
45
|
+
|
|
46
|
+
#: () -> ActiveRecord::ConnectionAdapters::AbstractAdapter
|
|
47
|
+
def connection
|
|
48
|
+
ActiveRecord::Base.connection
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
#: (String, ?header: String) -> void
|
|
52
|
+
def stop!(message, header: "Custom check")
|
|
53
|
+
raise StrongMigrations::UnsafeMigration, "\n=== #{header} #strong_migrations ===\n\n#{message}\n"
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "singleton"
|
|
4
|
+
require "strong_migrations"
|
|
5
|
+
|
|
6
|
+
require_relative "strong_schema/version"
|
|
7
|
+
require_relative "strong_schema/ignore_checks"
|
|
8
|
+
require_relative "strong_schema/schema_extension"
|
|
9
|
+
require_relative "strong_schema/table_extension"
|
|
10
|
+
|
|
11
|
+
module StrongSchema
|
|
12
|
+
extend IgnoreChecks
|
|
13
|
+
|
|
14
|
+
class << self
|
|
15
|
+
# @rbs!
|
|
16
|
+
# @setup_done: bool?
|
|
17
|
+
|
|
18
|
+
#: () -> void
|
|
19
|
+
def setup
|
|
20
|
+
return if @setup_done
|
|
21
|
+
|
|
22
|
+
ActiveRecord::Schema.prepend(SchemaExtension)
|
|
23
|
+
ActiveRecord::ConnectionAdapters::Table.prepend(TableExtension)
|
|
24
|
+
|
|
25
|
+
@setup_done = true
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
#: () -> void
|
|
29
|
+
def install_boot_hook
|
|
30
|
+
if defined?(Rails::Railtie)
|
|
31
|
+
require_relative "strong_schema/railtie"
|
|
32
|
+
elsif defined?(ActiveRecord::Base)
|
|
33
|
+
setup
|
|
34
|
+
elsif defined?(ActiveSupport)
|
|
35
|
+
ActiveSupport.on_load(:active_record) { StrongSchema.setup }
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
StrongSchema.install_boot_hook
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
---
|
|
2
|
+
path: ".gem_rbs_collection"
|
|
3
|
+
gems:
|
|
4
|
+
- name: activemodel
|
|
5
|
+
version: '7.1'
|
|
6
|
+
source:
|
|
7
|
+
type: git
|
|
8
|
+
name: ruby/gem_rbs_collection
|
|
9
|
+
revision: f17b218ad76ff3800d651e9bc42a15ba311095b4
|
|
10
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
11
|
+
repo_dir: gems
|
|
12
|
+
- name: activerecord
|
|
13
|
+
version: '8.0'
|
|
14
|
+
source:
|
|
15
|
+
type: git
|
|
16
|
+
name: ruby/gem_rbs_collection
|
|
17
|
+
revision: f17b218ad76ff3800d651e9bc42a15ba311095b4
|
|
18
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
19
|
+
repo_dir: gems
|
|
20
|
+
- name: activesupport
|
|
21
|
+
version: '7.0'
|
|
22
|
+
source:
|
|
23
|
+
type: git
|
|
24
|
+
name: ruby/gem_rbs_collection
|
|
25
|
+
revision: f17b218ad76ff3800d651e9bc42a15ba311095b4
|
|
26
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
27
|
+
repo_dir: gems
|
|
28
|
+
- name: base64
|
|
29
|
+
version: 0.3.0
|
|
30
|
+
source:
|
|
31
|
+
type: rubygems
|
|
32
|
+
- name: bigdecimal
|
|
33
|
+
version: '4.0'
|
|
34
|
+
source:
|
|
35
|
+
type: git
|
|
36
|
+
name: ruby/gem_rbs_collection
|
|
37
|
+
revision: f17b218ad76ff3800d651e9bc42a15ba311095b4
|
|
38
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
39
|
+
repo_dir: gems
|
|
40
|
+
- name: concurrent-ruby
|
|
41
|
+
version: '1.1'
|
|
42
|
+
source:
|
|
43
|
+
type: git
|
|
44
|
+
name: ruby/gem_rbs_collection
|
|
45
|
+
revision: f17b218ad76ff3800d651e9bc42a15ba311095b4
|
|
46
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
47
|
+
repo_dir: gems
|
|
48
|
+
- name: connection_pool
|
|
49
|
+
version: '2.4'
|
|
50
|
+
source:
|
|
51
|
+
type: git
|
|
52
|
+
name: ruby/gem_rbs_collection
|
|
53
|
+
revision: f17b218ad76ff3800d651e9bc42a15ba311095b4
|
|
54
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
55
|
+
repo_dir: gems
|
|
56
|
+
- name: date
|
|
57
|
+
version: '0'
|
|
58
|
+
source:
|
|
59
|
+
type: stdlib
|
|
60
|
+
- name: delegate
|
|
61
|
+
version: '0'
|
|
62
|
+
source:
|
|
63
|
+
type: stdlib
|
|
64
|
+
- name: digest
|
|
65
|
+
version: '0'
|
|
66
|
+
source:
|
|
67
|
+
type: stdlib
|
|
68
|
+
- name: erb
|
|
69
|
+
version: '0'
|
|
70
|
+
source:
|
|
71
|
+
type: stdlib
|
|
72
|
+
- name: i18n
|
|
73
|
+
version: '1.10'
|
|
74
|
+
source:
|
|
75
|
+
type: git
|
|
76
|
+
name: ruby/gem_rbs_collection
|
|
77
|
+
revision: f17b218ad76ff3800d651e9bc42a15ba311095b4
|
|
78
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
79
|
+
repo_dir: gems
|
|
80
|
+
- name: json
|
|
81
|
+
version: '0'
|
|
82
|
+
source:
|
|
83
|
+
type: stdlib
|
|
84
|
+
- name: logger
|
|
85
|
+
version: '0'
|
|
86
|
+
source:
|
|
87
|
+
type: stdlib
|
|
88
|
+
- name: minitest
|
|
89
|
+
version: '5.25'
|
|
90
|
+
source:
|
|
91
|
+
type: git
|
|
92
|
+
name: ruby/gem_rbs_collection
|
|
93
|
+
revision: f17b218ad76ff3800d651e9bc42a15ba311095b4
|
|
94
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
95
|
+
repo_dir: gems
|
|
96
|
+
- name: monitor
|
|
97
|
+
version: '0'
|
|
98
|
+
source:
|
|
99
|
+
type: stdlib
|
|
100
|
+
- name: openssl
|
|
101
|
+
version: '0'
|
|
102
|
+
source:
|
|
103
|
+
type: stdlib
|
|
104
|
+
- name: prism
|
|
105
|
+
version: 1.9.0
|
|
106
|
+
source:
|
|
107
|
+
type: rubygems
|
|
108
|
+
- name: railties
|
|
109
|
+
version: '6.0'
|
|
110
|
+
source:
|
|
111
|
+
type: git
|
|
112
|
+
name: ruby/gem_rbs_collection
|
|
113
|
+
revision: f17b218ad76ff3800d651e9bc42a15ba311095b4
|
|
114
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
115
|
+
repo_dir: gems
|
|
116
|
+
- name: securerandom
|
|
117
|
+
version: '0'
|
|
118
|
+
source:
|
|
119
|
+
type: stdlib
|
|
120
|
+
- name: singleton
|
|
121
|
+
version: '0'
|
|
122
|
+
source:
|
|
123
|
+
type: stdlib
|
|
124
|
+
- name: socket
|
|
125
|
+
version: '0'
|
|
126
|
+
source:
|
|
127
|
+
type: stdlib
|
|
128
|
+
- name: stringio
|
|
129
|
+
version: '0'
|
|
130
|
+
source:
|
|
131
|
+
type: stdlib
|
|
132
|
+
- name: time
|
|
133
|
+
version: '0'
|
|
134
|
+
source:
|
|
135
|
+
type: stdlib
|
|
136
|
+
- name: timeout
|
|
137
|
+
version: '0'
|
|
138
|
+
source:
|
|
139
|
+
type: stdlib
|
|
140
|
+
- name: tsort
|
|
141
|
+
version: '0'
|
|
142
|
+
source:
|
|
143
|
+
type: stdlib
|
|
144
|
+
- name: tzinfo
|
|
145
|
+
version: '2.0'
|
|
146
|
+
source:
|
|
147
|
+
type: git
|
|
148
|
+
name: ruby/gem_rbs_collection
|
|
149
|
+
revision: f17b218ad76ff3800d651e9bc42a15ba311095b4
|
|
150
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
151
|
+
repo_dir: gems
|
|
152
|
+
- name: uri
|
|
153
|
+
version: '0'
|
|
154
|
+
source:
|
|
155
|
+
type: stdlib
|
|
156
|
+
gemfile_lock_path: Gemfile.lock
|
data/rbs_collection.yaml
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
module StrongSchema
|
|
2
|
+
module IgnoreChecks
|
|
3
|
+
def add_ignore: () { (Symbol, Array[untyped]) -> bool } -> void
|
|
4
|
+
|
|
5
|
+
def ignore_checks: () -> Array[Proc]
|
|
6
|
+
|
|
7
|
+
def reset_ignores!: () -> void
|
|
8
|
+
|
|
9
|
+
def should_ignore?: (Symbol, Array[untyped]) -> bool
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
module StrongSchema
|
|
15
|
+
class Railtie < Rails::Railtie
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
module StrongSchema
|
|
21
|
+
module SchemaExtension
|
|
22
|
+
def method_missing: (Symbol, *untyped) -> untyped
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
module StrongSchema
|
|
28
|
+
module TableExtension
|
|
29
|
+
OPERATION_MAP: Hash[Symbol, Symbol]
|
|
30
|
+
|
|
31
|
+
class MigrationProxy
|
|
32
|
+
include Singleton
|
|
33
|
+
|
|
34
|
+
def reverting?: () -> false
|
|
35
|
+
|
|
36
|
+
def version: () -> nil
|
|
37
|
+
|
|
38
|
+
def connection: () -> ActiveRecord::ConnectionAdapters::AbstractAdapter
|
|
39
|
+
|
|
40
|
+
def stop!: (String, ?header: String) -> void
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
module StrongSchema
|
|
47
|
+
VERSION: String
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
module StrongSchema
|
|
52
|
+
extend IgnoreChecks
|
|
53
|
+
|
|
54
|
+
@setup_done: bool?
|
|
55
|
+
|
|
56
|
+
def self.setup: () -> void
|
|
57
|
+
|
|
58
|
+
def self.install_boot_hook: () -> void
|
|
59
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: strong_schema
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- shoma07
|
|
8
|
+
bindir: exe
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: strong_migrations
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '1.8'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '1.8'
|
|
26
|
+
description: Adds safety checks to declarative schema operations in ActiveRecord::Schema.
|
|
27
|
+
email:
|
|
28
|
+
- 23730734+shoma07@users.noreply.github.com
|
|
29
|
+
executables: []
|
|
30
|
+
extensions: []
|
|
31
|
+
extra_rdoc_files: []
|
|
32
|
+
files:
|
|
33
|
+
- CHANGELOG.md
|
|
34
|
+
- LICENSE.txt
|
|
35
|
+
- README.md
|
|
36
|
+
- Rakefile
|
|
37
|
+
- Steepfile
|
|
38
|
+
- lib/strong_schema.rb
|
|
39
|
+
- lib/strong_schema/ignore_checks.rb
|
|
40
|
+
- lib/strong_schema/railtie.rb
|
|
41
|
+
- lib/strong_schema/schema_extension.rb
|
|
42
|
+
- lib/strong_schema/table_extension.rb
|
|
43
|
+
- lib/strong_schema/version.rb
|
|
44
|
+
- rbs_collection.lock.yaml
|
|
45
|
+
- rbs_collection.yaml
|
|
46
|
+
- sig/strong_schema.rbs
|
|
47
|
+
homepage: https://github.com/shoma07/strong_schema
|
|
48
|
+
licenses:
|
|
49
|
+
- MIT
|
|
50
|
+
metadata:
|
|
51
|
+
homepage_uri: https://github.com/shoma07/strong_schema
|
|
52
|
+
source_code_uri: https://github.com/shoma07/strong_schema
|
|
53
|
+
changelog_uri: https://github.com/shoma07/strong_schema/blob/main/CHANGELOG.md
|
|
54
|
+
rubygems_mfa_required: 'true'
|
|
55
|
+
rdoc_options: []
|
|
56
|
+
require_paths:
|
|
57
|
+
- lib
|
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
59
|
+
requirements:
|
|
60
|
+
- - ">="
|
|
61
|
+
- !ruby/object:Gem::Version
|
|
62
|
+
version: '2.6'
|
|
63
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - ">="
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '0'
|
|
68
|
+
requirements: []
|
|
69
|
+
rubygems_version: 4.0.3
|
|
70
|
+
specification_version: 4
|
|
71
|
+
summary: Safety checks for declarative database schema changes
|
|
72
|
+
test_files: []
|