rails_async_migrations 1.0.1 → 1.0.2
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: 19fc441a029878e39ee6794467b9a442d0b3b2a7a6a2190612555478ee60689a
|
4
|
+
data.tar.gz: bc1947d8c051d3dbdecfda22c8efabb35cc75a2a012592b8f0a67e8f67ea64ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6300eed27ef6c4007a24757aec057f4675b2b92d3fa4606e48c9b387307065d2ae0be82c84fe404364b5a96c662542498800e75dcdfbe2f5b1ba1eb6217da563
|
7
|
+
data.tar.gz: 13f506f3dc6bd466da06861e22d5e0fe781510f53e5a4c4d0c03e251d0db2081c4751c7ee0f9fe36150873b5ee2ea2565091f1f7120077528899fa98559cf6d3
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -116,9 +116,13 @@ You can also manually launch the queue check and fire by using:
|
|
116
116
|
|
117
117
|
## Failure handling
|
118
118
|
|
119
|
-
If your migration crashes, and blocks the rest of your
|
119
|
+
If your migration crashes, and blocks the rest of your queue but you want to execute them anyway, you can use multiple strategies to do so:
|
120
120
|
|
121
|
-
|
121
|
+
- Change the code of the migration file and push it again so it passes
|
122
|
+
- Remove the matching row in the `async_schema_migrations` table
|
123
|
+
- Update the matching row with `state = done`
|
124
|
+
|
125
|
+
To find the matching migration, be aware the `version` value is always the same as the classic migrations ones, so it's pretty easy to find things around.
|
122
126
|
|
123
127
|
## Compatibility
|
124
128
|
|
@@ -1,8 +1,23 @@
|
|
1
1
|
module RailsAsyncMigrations
|
2
2
|
module Mutators
|
3
3
|
class Base
|
4
|
+
# in some context we have to guess it from the file and current connection
|
5
|
+
# for instance when we use class methods such as `turn_async`
|
4
6
|
def migration_class
|
5
|
-
instance.class
|
7
|
+
if instance.class == ActiveRecord::Migration
|
8
|
+
fetch_from_file
|
9
|
+
else
|
10
|
+
instance.class
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def fetch_from_file
|
15
|
+
require current_migration.filename
|
16
|
+
current_migration.name.constantize
|
17
|
+
end
|
18
|
+
|
19
|
+
def current_migration
|
20
|
+
@current_migration ||= Connection::ActiveRecord.new(:up).current_migration
|
6
21
|
end
|
7
22
|
end
|
8
23
|
end
|