23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/hekenga/scaffold.rb', line 23
def to_s
<<-EOF.strip_heredoc
Hekenga.migration do
## Required
description #{@migration.description.inspect}
created #{@migration.timestamp.sub("T", " ").inspect}
## Optional
#batch_size 25
## Simple tasks
#task "task description" do
# up do
# end
#end
## Per document tasks
#per_document "task description" do
# ## Required
# scope MyModel.all
#
# ## Optional config
# #parallel!
# #timeless!
# #always_write!
# #skip_prepare!
# #batch_size 25
# #write_strategy :update # :delete_then_insert
# #cursor_timeout 86_400 # max allowed time for the cursor to survive, in seconds
#
# # Called once per batch, instance variables will be accessible
# # in the filter, up and after blocks
# #setup do |docs|
# #end
#
# #filter do |doc|
# #end
#
# up do |doc|
# end
#
# # Called once per batch passing successfully written records
# #after do |docs|
# #end
#end
end
EOF
end
|