vitess-activerecord-migration 0.1.0 → 0.2.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 +4 -4
- data/README.md +20 -2
- data/lib/vitess/activerecord/migration/version.rb +1 -1
- data/lib/vitess/activerecord/migration.rb +18 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4e6886e3311d81a26675589df0420f5e4ea72ef3f5b7a4288029ef2feb4542f
|
4
|
+
data.tar.gz: 407235b276dc0f370663348491e03e2cfa6a2ae7b108c67fbd3f66967162561e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d867e55428ac7f48b5a87c34faece5d2de9deab0aa63779b759917e52becb7361cd2c13e8cafb2765008238df62c910392843aa1e2da8795a27c41f97d03820b
|
7
|
+
data.tar.gz: 115075f6113b7b0cf64d2a52b2148048271130c7ded01cdb6ef2367c25b9307b047f3c9ab5990b386f88d9829a816cd765da17d2c318ed99e3e1c97ba385b675
|
data/README.md
CHANGED
@@ -22,7 +22,7 @@ ActiveRecord::Migration.prepend(Vitess::Activerecord::Migration)
|
|
22
22
|
|
23
23
|
The default ddl strategy is `vitess` with no options.
|
24
24
|
|
25
|
-
When you want to
|
25
|
+
When you want to change the ddl strategy and its options for one shot, you can set them in the migration file.
|
26
26
|
|
27
27
|
```ruby
|
28
28
|
def default_ddl_strategy
|
@@ -35,7 +35,7 @@ def change
|
|
35
35
|
end
|
36
36
|
```
|
37
37
|
|
38
|
-
When you want to
|
38
|
+
When you want to change the default ddl strategy and its options, you can override the following methods.
|
39
39
|
|
40
40
|
```ruby
|
41
41
|
# lib/vitess/activerecord/app_migration.rb
|
@@ -57,6 +57,24 @@ ActiveRecord::Migration.prepend(Vitess::Activerecord::Migration)
|
|
57
57
|
ActiveRecord::Migration.prepend(Vitess::Activerecord::AppMigration)
|
58
58
|
```
|
59
59
|
|
60
|
+
When you want to change the log parameters during the migration, you can override the following method.
|
61
|
+
|
62
|
+
```ruby
|
63
|
+
# lib/vitess/activerecord/app_migration.rb
|
64
|
+
module Vitess
|
65
|
+
module Activerecord
|
66
|
+
module AppMigration
|
67
|
+
def migration_log_columns
|
68
|
+
%w[
|
69
|
+
migration_uuid
|
70
|
+
progress
|
71
|
+
eta_seconds
|
72
|
+
]
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
```
|
60
78
|
|
61
79
|
## Development
|
62
80
|
|
@@ -24,6 +24,23 @@ module Vitess
|
|
24
24
|
7200 # 120 minutes
|
25
25
|
end
|
26
26
|
|
27
|
+
# Returns the columns of SHOW VITESS_MIGRATIONS to log during the run.
|
28
|
+
#
|
29
|
+
# Override this method if you want to change the default columns.
|
30
|
+
def migration_log_columns
|
31
|
+
%w[
|
32
|
+
migration_uuid
|
33
|
+
migration_statement
|
34
|
+
added_timestamp
|
35
|
+
started_timestamp
|
36
|
+
last_throttled_timestamp
|
37
|
+
last_cutover_attempt_timestamp
|
38
|
+
is_immediate_operation
|
39
|
+
progress
|
40
|
+
eta_seconds
|
41
|
+
]
|
42
|
+
end
|
43
|
+
|
27
44
|
# Override exec_migration to set the default DDL strategy to vitess.
|
28
45
|
# This method is called every time a migration is executed.
|
29
46
|
# If you want to use a different DDL strategy, call with_ddl_strategy inside the change method or elsewhere.
|
@@ -103,8 +120,7 @@ module Vitess
|
|
103
120
|
id = migration["id"]
|
104
121
|
next if @stopped_uuid.include?(id)
|
105
122
|
|
106
|
-
|
107
|
-
detail_message = details.map { |column| "#{column}: #{migration[column]}" }.join(" | ")
|
123
|
+
detail_message = migration_log_columns.map { |column| "#{column}: #{migration[column]}" }.join(" | ")
|
108
124
|
Rails.logger.info("Vitess Migration #{id} checking status, #{detail_message}")
|
109
125
|
|
110
126
|
status = migration["migration_status"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vitess-activerecord-migration
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yohei Yoshimuta
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|