apify_scheduler 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +34 -0
- data/app/assets/javascripts/scheduler/application.js +19 -0
- data/app/assets/stylesheets/scheduler/application.css +15 -0
- data/app/controllers/apify/scheduler/application_controller.rb +6 -0
- data/app/controllers/apify/scheduler/histories_controller.rb +24 -0
- data/app/controllers/apify/scheduler/servers_controller.rb +71 -0
- data/app/controllers/apify/scheduler/units_controller.rb +77 -0
- data/app/helpers/apify/scheduler/application_helper.rb +6 -0
- data/app/helpers/apify/scheduler/histories_helper.rb +4 -0
- data/app/helpers/apify/scheduler/servers_helper.rb +4 -0
- data/app/helpers/apify/scheduler/units_helper.rb +4 -0
- data/app/jobs/unit_performer_job.rb +10 -0
- data/app/models/apify/scheduler/frequency_period.rb +5 -0
- data/app/models/apify/scheduler/history.rb +9 -0
- data/app/models/apify/scheduler/server.rb +12 -0
- data/app/models/apify/scheduler/unit.rb +45 -0
- data/app/views/apify/scheduler/histories/_history.html.erb +6 -0
- data/app/views/apify/scheduler/histories/index.html.erb +14 -0
- data/app/views/apify/scheduler/servers/_form.html.erb +48 -0
- data/app/views/apify/scheduler/servers/edit.html.erb +6 -0
- data/app/views/apify/scheduler/servers/index.html.erb +46 -0
- data/app/views/apify/scheduler/servers/new.html.erb +5 -0
- data/app/views/apify/scheduler/servers/show.html.erb +35 -0
- data/app/views/apify/scheduler/shared/_short_history.html.erb +39 -0
- data/app/views/apify/scheduler/units/_form.html.erb +99 -0
- data/app/views/apify/scheduler/units/_unit.html.erb +27 -0
- data/app/views/apify/scheduler/units/edit.html.erb +6 -0
- data/app/views/apify/scheduler/units/index.html.erb +37 -0
- data/app/views/apify/scheduler/units/new.html.erb +5 -0
- data/app/views/apify/scheduler/units/show.html.erb +36 -0
- data/app/views/layouts/apify/scheduler/_flash.html.erb +32 -0
- data/app/views/layouts/apify/scheduler/application.html.erb +37 -0
- data/config/routes.rb +15 -0
- data/db/migrate/20150104005044_create_apify_scheduler_units.rb +24 -0
- data/db/migrate/20150105225841_create_apify_servers.rb +14 -0
- data/db/migrate/20150105234957_create_apify_histories.rb +13 -0
- data/db/migrate/20150112223842_create_frequency_periods.rb +9 -0
- data/lib/apify_scheduler.rb +6 -0
- data/lib/apify_scheduler/engine.rb +16 -0
- data/lib/apify_scheduler/version.rb +5 -0
- data/lib/tasks/resque.rake +2 -0
- data/lib/tasks/scheduler_tasks.rake +4 -0
- data/test/controllers/apify/histories_controller_test.rb +51 -0
- data/test/controllers/apify/names_controller_test.rb +51 -0
- data/test/controllers/apify/servers_controller_test.rb +51 -0
- data/test/controllers/apify/units_controller_test.rb +51 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +23 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +78 -0
- data/test/dummy/config/environments/test.rb +39 -0
- data/test/dummy/config/initializers/assets.rb +8 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/fixtures/apify/histories.yml +11 -0
- data/test/fixtures/apify/servers.yml +11 -0
- data/test/fixtures/apify/units.yml +11 -0
- data/test/helpers/apify/histories_helper_test.rb +6 -0
- data/test/helpers/apify/names_helper_test.rb +6 -0
- data/test/helpers/apify/servers_helper_test.rb +6 -0
- data/test/helpers/apify/units_helper_test.rb +6 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/models/apify/history_test.rb +9 -0
- data/test/models/apify/server_test.rb +9 -0
- data/test/models/apify/unit_test.rb +9 -0
- data/test/scheduler_test.rb +7 -0
- data/test/test_helper.rb +17 -0
- metadata +231 -0
@@ -0,0 +1,46 @@
|
|
1
|
+
<div class='ui sixteen wide column'>
|
2
|
+
<% if @servers.present? %>
|
3
|
+
|
4
|
+
<h1 class='ui header'>Servers</h1>
|
5
|
+
<table class='ui celled stripped teal table'>
|
6
|
+
<thead>
|
7
|
+
<tr>
|
8
|
+
<th>Name</th>
|
9
|
+
<th>Info</th>
|
10
|
+
</tr>
|
11
|
+
</thead>
|
12
|
+
|
13
|
+
<tbody>
|
14
|
+
<% @servers.each do |server| %>
|
15
|
+
<tr>
|
16
|
+
<td>
|
17
|
+
<div class='ui column right aligned'>
|
18
|
+
<%= link_to raw('<i class="remove circle icon red"></i>'), server, method: :delete, data: { confirm: 'Are you sure?' } %>
|
19
|
+
<%= link_to raw('<i class="configure icon"></i>'), edit_server_path(server) %>
|
20
|
+
<%= link_to raw('<i class="video play icon green"></i>'), test_server_path(server), method: :post %>
|
21
|
+
</div>
|
22
|
+
<%= link_to server.name, server %>
|
23
|
+
</td>
|
24
|
+
<td>
|
25
|
+
|
26
|
+
<b><%= server.url %></b>
|
27
|
+
<br/>
|
28
|
+
<small>
|
29
|
+
<%= server.units.map.map(&:name).join("; ") %>
|
30
|
+
</small>
|
31
|
+
</td>
|
32
|
+
|
33
|
+
</tr>
|
34
|
+
<% end %>
|
35
|
+
</tbody>
|
36
|
+
</table>
|
37
|
+
<% else %>
|
38
|
+
<h1 class='ui header'>No servers present</h1>
|
39
|
+
<p>Create your first.</p>
|
40
|
+
|
41
|
+
<% end %>
|
42
|
+
|
43
|
+
<div class=' right aligned column'>
|
44
|
+
<%= link_to 'New Server', new_server_path, class: 'ui primary button ' %>
|
45
|
+
</div>
|
46
|
+
</div>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<div class='ui grid'>
|
2
|
+
<div class='ui column'>
|
3
|
+
<div class='ui segment'>
|
4
|
+
|
5
|
+
<h1 class='ui header'><%= @server.name %></h1>
|
6
|
+
|
7
|
+
<p class='ui segment stacked'>
|
8
|
+
<%= @server.description %>
|
9
|
+
</p>
|
10
|
+
|
11
|
+
<p class='ui segment'>
|
12
|
+
<%= @server.url %>
|
13
|
+
</p>
|
14
|
+
|
15
|
+
<h4>API key</h4>
|
16
|
+
<p class='ui segment'>
|
17
|
+
<%= @server.api_key %>
|
18
|
+
</p>
|
19
|
+
|
20
|
+
<h4>Units</h4>
|
21
|
+
<p class='ui segment'>
|
22
|
+
<%= @server.units.map(&:name).join(",") %>
|
23
|
+
</p>
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
<div class='ui column right aligned'>
|
28
|
+
<%= link_to 'Edit', edit_server_path(@server), class: 'ui primary button' %>
|
29
|
+
<%= link_to 'Test', test_server_path(@server), class: 'ui teal button', method: :post %>
|
30
|
+
<%= link_to 'Back', servers_path, class: 'ui warning button' %>
|
31
|
+
</div>
|
32
|
+
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
</div>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<% if history %>
|
2
|
+
|
3
|
+
<% unless history.queued? %>
|
4
|
+
Waiting to put on queue...
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<% if history.finished_at.nil? and history.queued? and !history.currently_working? %>
|
8
|
+
|
9
|
+
<div class='ui column center aligned red'>
|
10
|
+
<h2 class=''>Error</h2>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<% if history.finished_at or history.currently_working? %>
|
16
|
+
|
17
|
+
<b>Started</b>:
|
18
|
+
<%= history.created_at.strftime("%e %h, %X") %>
|
19
|
+
<% if history.finished_at %>
|
20
|
+
<br/>
|
21
|
+
<b>Finished</b>:
|
22
|
+
<%= history.finished_at.strftime("%e %h, %X") %>
|
23
|
+
<br/>
|
24
|
+
<b>Time</b>: <%= (history.finished_at - history.created_at).round %> seconds
|
25
|
+
<% end %>
|
26
|
+
<% if history.response_body.present? and json = JSON.try(:parse, history.response_body) %>
|
27
|
+
<br/>
|
28
|
+
<b>Message</b>:
|
29
|
+
<i class='ui column <%= "red" if json["success"] == 0 %>'><%= json['message'].html_safe %></i>
|
30
|
+
<% elsif history.response_body.present? %>
|
31
|
+
<br/>
|
32
|
+
<b>Message</b>:
|
33
|
+
<i><%= history.response_body %></i>
|
34
|
+
<% end %>
|
35
|
+
|
36
|
+
<% end %>
|
37
|
+
|
38
|
+
|
39
|
+
<% end %>
|
@@ -0,0 +1,99 @@
|
|
1
|
+
<div class='ui grid'>
|
2
|
+
<div class='column'>
|
3
|
+
<div class='ui segment form'>
|
4
|
+
<%= form_for(@unit) do |f| %>
|
5
|
+
<% if @unit.errors.any? %>
|
6
|
+
<div id="error_explanation">
|
7
|
+
<h2><%= pluralize(@unit.errors.count, "error") %> prohibited this unit from being saved:</h2>
|
8
|
+
|
9
|
+
<ul>
|
10
|
+
<% @unit.errors.full_messages.each do |message| %>
|
11
|
+
<li><%= message %></li>
|
12
|
+
<% end %>
|
13
|
+
</ul>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<div class='field'>
|
18
|
+
<div class="ui input">
|
19
|
+
<%= f.label :name %><br>
|
20
|
+
<%= f.text_field :name %>
|
21
|
+
</div>
|
22
|
+
</div>
|
23
|
+
<div class='field'>
|
24
|
+
<div class='ui input'>
|
25
|
+
<%= f.label :description %><br>
|
26
|
+
<%= f.text_area :description %>
|
27
|
+
</div>
|
28
|
+
</div>
|
29
|
+
<div class='field'>
|
30
|
+
<div class='ui input'>
|
31
|
+
<%= f.label :pattern %><br>
|
32
|
+
<%= f.text_area :pattern %>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
<div class='field'>
|
36
|
+
<div class='ui input'>
|
37
|
+
<%= f.label :processes %><br>
|
38
|
+
<%= f.text_field :processes %>
|
39
|
+
</div>
|
40
|
+
</div>
|
41
|
+
<div class='field'>
|
42
|
+
<div class='ui input'>
|
43
|
+
<%= f.label :delay %><br>
|
44
|
+
<%= f.text_field :delay %>
|
45
|
+
</div>
|
46
|
+
</div>
|
47
|
+
<div class='field'>
|
48
|
+
<div class='ui input'>
|
49
|
+
<%= f.label :destination %><br>
|
50
|
+
<%= f.text_field :destination %>
|
51
|
+
</div>
|
52
|
+
</div>
|
53
|
+
|
54
|
+
<div class='field'>
|
55
|
+
<div class='ui input'>
|
56
|
+
<%= f.label :server %><br>
|
57
|
+
<%= f.select :apify_scheduler_server_id, options_for_select(Apify::Scheduler::Server.all.map{ |s| [s.name, s.id]}, @unit.server.try(:id)) %>
|
58
|
+
</div>
|
59
|
+
</div>
|
60
|
+
|
61
|
+
|
62
|
+
<h2>Clockwork Settings</h2>
|
63
|
+
<div class='ui grid'>
|
64
|
+
<div class='ui column one wide'>
|
65
|
+
Every:
|
66
|
+
</div>
|
67
|
+
<div class='ui column four wide'>
|
68
|
+
<div class='field'>
|
69
|
+
<div class='ui input'>
|
70
|
+
<%= f.number_field :frequency_quantity, placeholder: :quantity, required: true %>
|
71
|
+
</div>
|
72
|
+
</div>
|
73
|
+
</div>
|
74
|
+
<div class='ui column four wide'>
|
75
|
+
<div class='field'>
|
76
|
+
<div class='ui input'>
|
77
|
+
<%= f.select :apify_scheduler_frequency_period_id, options_for_select(Apify::Scheduler::FrequencyPeriod.all.map{ |s| [s.name, s.id]}, @unit.server.try(:id)), required: true %>
|
78
|
+
</div>
|
79
|
+
</div>
|
80
|
+
</div>
|
81
|
+
<div class='ui column one wide'>at: </div>
|
82
|
+
|
83
|
+
<div class='ui column four wide'>
|
84
|
+
<div class='field'>
|
85
|
+
<div class='ui input'>
|
86
|
+
<%= f.text_field :at, placeholder: :optional %>
|
87
|
+
</div>
|
88
|
+
</div>
|
89
|
+
</div>
|
90
|
+
|
91
|
+
|
92
|
+
<div class="ui column sixteen wide right aligned">
|
93
|
+
<%= f.submit (@unit.persisted? ? 'Update Unit' : 'Create Unit'), class: 'ui blue submit button' %>
|
94
|
+
</div>
|
95
|
+
</div>
|
96
|
+
<% end %>
|
97
|
+
</div>
|
98
|
+
</div>
|
99
|
+
</div>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<tr>
|
2
|
+
<td>
|
3
|
+
<div class='ui column right aligned'>
|
4
|
+
<%= link_to raw('<i class="remove circle icon red"></i>'), unit, method: :delete, data: { confirm: 'Are you sure?' } %>
|
5
|
+
<%= link_to raw('<i class="configure icon"></i>'), edit_unit_path(unit) %>
|
6
|
+
<%= link_to raw('<i class="tasks icon"></i>'), unit_histories_path(unit) %>
|
7
|
+
<%= link_to raw('<i class="video play icon green"></i>'), perform_unit_path(unit), method: :post if Resque.workers.present? %>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<% if unit.currently_working? %>
|
11
|
+
<div class='ui inline active loader'></div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<%= link_to unit.name, unit %>
|
15
|
+
<br/>
|
16
|
+
<b><sup>(Processes: <%= unit.processes %>, Delay: <%= unit.delay %>)</sup></b>
|
17
|
+
<br/>
|
18
|
+
<small>
|
19
|
+
<i><%= unit.description %></i><br/>
|
20
|
+
<b><%= unit.server.name %></b>:
|
21
|
+
<b><%= unit.server.url %></b><br/>
|
22
|
+
</small>
|
23
|
+
</td>
|
24
|
+
<td>
|
25
|
+
<%= render 'apify/scheduler/shared/short_history', history: unit.histories.order('created_at DESC').first %>
|
26
|
+
</td>
|
27
|
+
</tr>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<div class='ui sixteen wide column'>
|
2
|
+
|
3
|
+
<% unless Resque.workers.present? %>
|
4
|
+
<div class="ui negative floating message">
|
5
|
+
<i class="close icon"></i>
|
6
|
+
<div class="header">Caution!</div>
|
7
|
+
<p>
|
8
|
+
Resque is disabled.
|
9
|
+
</p>
|
10
|
+
</div>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<% if @units.present? %>
|
14
|
+
|
15
|
+
<h1 class='ui header'>Units</h1>
|
16
|
+
<table class='ui celled stripped teal table'>
|
17
|
+
<thead>
|
18
|
+
<tr>
|
19
|
+
<th>Name</th>
|
20
|
+
<th>History</th>
|
21
|
+
</tr>
|
22
|
+
</thead>
|
23
|
+
|
24
|
+
<tbody>
|
25
|
+
<%= render @units %>
|
26
|
+
</tbody>
|
27
|
+
</table>
|
28
|
+
<% else %>
|
29
|
+
<h1 class='ui header'>No units present</h1>
|
30
|
+
<p>Create your first.</p>
|
31
|
+
|
32
|
+
<% end %>
|
33
|
+
|
34
|
+
<div class=' right aligned column'>
|
35
|
+
<%= link_to 'New Unit', new_unit_path, class: 'ui primary button ' %>
|
36
|
+
</div>
|
37
|
+
</div>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<div class='ui grid'>
|
2
|
+
<div class='ui column'>
|
3
|
+
<div class='ui segment'>
|
4
|
+
|
5
|
+
<p id="notice"><%= notice %></p>
|
6
|
+
|
7
|
+
<h1 class='ui header'>
|
8
|
+
<%= @unit.name %>
|
9
|
+
|
10
|
+
</h1>
|
11
|
+
|
12
|
+
<p class='ui segment stacked'>
|
13
|
+
<%= @unit.description %>
|
14
|
+
<br/>
|
15
|
+
<small>(
|
16
|
+
<%=
|
17
|
+
"In #{@unit.processes} processes with #{@unit.delay} milliseconds delay <i>to <b>#{@unit.destination}</b></i>".html_safe %>
|
18
|
+
)</small>
|
19
|
+
</p>
|
20
|
+
|
21
|
+
<pre class='ui segment'><%= @unit.pattern.strip %></pre>
|
22
|
+
|
23
|
+
<p class='ui segment'>
|
24
|
+
<%= @unit.server.name %>
|
25
|
+
<small><i>(<%= @unit.server.url %>)</i></small>
|
26
|
+
</p>
|
27
|
+
|
28
|
+
<div class='right aligned column'>
|
29
|
+
<%= link_to 'Edit', edit_unit_path(@unit), class: 'ui primary button' %>
|
30
|
+
<%= link_to 'Histories', unit_histories_path(@unit), class: 'ui primary button' %>
|
31
|
+
<%= link_to 'Perform', perform_unit_path(@unit), class: 'ui teal button' %>
|
32
|
+
<%= link_to 'Back', units_path, class: 'ui warning button' %>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
</div>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<div class="ui grid page">
|
2
|
+
<div class="ui column four wide"></div>
|
3
|
+
<div class="ui column six wide">
|
4
|
+
<% if flash[:error] %>
|
5
|
+
<div class="ui negative floating message">
|
6
|
+
<i class="close icon"></i>
|
7
|
+
<div class="header">Error</div>
|
8
|
+
<p>
|
9
|
+
<%= flash[:error] %>
|
10
|
+
</p>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
<% if flash[:notice] %>
|
14
|
+
<div class="ui positive floating message">
|
15
|
+
<i class="close icon"></i>
|
16
|
+
<div class="header">Note</div>
|
17
|
+
<p>
|
18
|
+
<%= flash[:notice] %>
|
19
|
+
</p>
|
20
|
+
</div>
|
21
|
+
<% end %>
|
22
|
+
<% if flash[:alert] %>
|
23
|
+
<div class="ui warning floating message">
|
24
|
+
<i class="close icon"></i>
|
25
|
+
<div class="header">Warning</div>
|
26
|
+
<p>
|
27
|
+
<%= flash[:alert] %>
|
28
|
+
</p>
|
29
|
+
</div>
|
30
|
+
<% end %>
|
31
|
+
</div>
|
32
|
+
</div>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Scheduler</title>
|
5
|
+
<%= stylesheet_link_tag "scheduler/application", media: "all" %>
|
6
|
+
<%= stylesheet_link_tag "https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/1.5.2/semantic.min.css", media: "all" %>
|
7
|
+
|
8
|
+
|
9
|
+
<%= csrf_meta_tags %>
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
<div class='ui inverted menu'>
|
13
|
+
<div class='item'><%= link_to 'Apify Scheduler', root_path %></div>
|
14
|
+
<div class='item'><%= link_to 'Units', units_path %></div>
|
15
|
+
<div class='item'><%= link_to 'Servers', servers_path %></div>
|
16
|
+
<% if defined?(current_user) and current_user.present? %>
|
17
|
+
<div class='item'><%= link_to 'Logout', main_app.destroy_user_session_path, method: :delete %></div>
|
18
|
+
<% elsif defined?(current_user) %>
|
19
|
+
<div class='item'><%= link_to 'Login', main_app.new_user_session_path, method: :post %></div>
|
20
|
+
<% end %>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<%= render 'layouts/apify/scheduler/flash' %>
|
24
|
+
|
25
|
+
<div class='ui page grid'>
|
26
|
+
<div class='main container'>
|
27
|
+
<div class='ui grid full'>
|
28
|
+
<div class='sixteen column row'>
|
29
|
+
<%= yield %>
|
30
|
+
</div>
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<%= javascript_include_tag "scheduler/application" %>
|
36
|
+
</body>
|
37
|
+
</html>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
Apify::Scheduler::Engine.routes.draw do
|
2
|
+
root 'units#index'
|
3
|
+
resources :units, :shallow => true do
|
4
|
+
resources :histories, only: [:index, :destroy]
|
5
|
+
member do
|
6
|
+
post :perform
|
7
|
+
end
|
8
|
+
end
|
9
|
+
resources :servers do
|
10
|
+
member do
|
11
|
+
post :test
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class CreateApifySchedulerUnits < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :apify_scheduler_units do |t|
|
4
|
+
t.string :name, null: false
|
5
|
+
t.text :description
|
6
|
+
t.text :pattern, null: false
|
7
|
+
t.integer :delay, default: 0, null: false
|
8
|
+
t.integer :processes, default: 2, null: false
|
9
|
+
t.string :destination, null: false
|
10
|
+
|
11
|
+
t.belongs_to :apify_scheduler_server
|
12
|
+
|
13
|
+
t.integer :frequency_quantity
|
14
|
+
t.belongs_to :apify_scheduler_frequency_period
|
15
|
+
t.string :at
|
16
|
+
|
17
|
+
t.timestamps
|
18
|
+
end
|
19
|
+
|
20
|
+
add_index :apify_scheduler_units, :name, unique: true
|
21
|
+
add_index :apify_scheduler_units, :apify_scheduler_frequency_period_id, name: :frequency_id
|
22
|
+
add_index :apify_scheduler_units, :apify_scheduler_server_id
|
23
|
+
end
|
24
|
+
end
|