safer_migrations 0.1.0 → 0.1.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: 14751619b1434778cf62af64f5aa0959435662ae20b7e24d9e86262a8891577e
|
4
|
+
data.tar.gz: 50632544c70e28d5a30caf13e71f9a3ee31d4ae3a97ed68c92da62cab18fc7e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1b2bf84f85d427b85786e87d28b4d2a0cda533f541c9aaf416f54078f03c3651fd0535bd035270f023436b38decc98212474ad8de7494825594d4f27ffdbbee
|
7
|
+
data.tar.gz: e54e1374995bd0a8f0f951fe9a3d6d04d444b03c8391a3f9e4b4b9e71c4440a4440132a606a63d759f84557b7c1304974786d45ba9875cf079c09eb2fbc346a6
|
@@ -17,5 +17,13 @@ module SaferMigrations
|
|
17
17
|
def invert_safer_remove_columns(args)
|
18
18
|
invert_remove_columns(args)
|
19
19
|
end
|
20
|
+
|
21
|
+
ruby2_keywords def safer_rename_column(*args, &block)
|
22
|
+
record(:safer_rename_column, args, &block)
|
23
|
+
end
|
24
|
+
|
25
|
+
def invert_safer_rename_column(args)
|
26
|
+
invert_rename_column(args)
|
27
|
+
end
|
20
28
|
end
|
21
29
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SaferMigrations
|
4
|
+
module TableDefinition
|
5
|
+
def safer_remove(*column_names, **options)
|
6
|
+
@base.safer_remove_columns(name, *column_names, **options)
|
7
|
+
end
|
8
|
+
|
9
|
+
def safer_rename(column_name, new_column_name)
|
10
|
+
@base.safer_rename_column(name, column_name, new_column_name)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -14,6 +14,11 @@ module SaferMigrations
|
|
14
14
|
remove_columns(table_name, *column_names, type = nil, **options)
|
15
15
|
end
|
16
16
|
|
17
|
+
def safer_rename_column(table_name, column_name, new_column_name)
|
18
|
+
validate_remove_column(table_name, column_name)
|
19
|
+
rename_column(table_name, column_name, new_column_name)
|
20
|
+
end
|
21
|
+
|
17
22
|
private
|
18
23
|
|
19
24
|
def validate_remove_column(table_name, column_name)
|
data/lib/safer_migrations.rb
CHANGED
@@ -7,8 +7,10 @@ require_relative "safer_migrations/version"
|
|
7
7
|
require_relative "safer_migrations/errors"
|
8
8
|
require_relative "safer_migrations/command_recorder"
|
9
9
|
require_relative "safer_migrations/schema_statements"
|
10
|
+
require_relative "safer_migrations/schema_definitions"
|
10
11
|
|
11
12
|
ActiveSupport.on_load(:active_record) do
|
12
13
|
ActiveRecord::ConnectionAdapters::AbstractAdapter.prepend(SaferMigrations::SchemaStatements)
|
14
|
+
ActiveRecord::ConnectionAdapters::Table.prepend(SaferMigrations::TableDefinition)
|
13
15
|
ActiveRecord::Migration::CommandRecorder.prepend(SaferMigrations::CommandRecorder)
|
14
16
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: safer_migrations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuji yaginuma
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -51,6 +51,7 @@ files:
|
|
51
51
|
- lib/safer_migrations.rb
|
52
52
|
- lib/safer_migrations/command_recorder.rb
|
53
53
|
- lib/safer_migrations/errors.rb
|
54
|
+
- lib/safer_migrations/schema_definitions.rb
|
54
55
|
- lib/safer_migrations/schema_statements.rb
|
55
56
|
- lib/safer_migrations/version.rb
|
56
57
|
homepage: https://github.com/y-yagi
|