Skip to content

Commit b2ac014

Browse files
author
Roshan
committed
refactor : split frequency parameters into a separate table
1 parent abd87ec commit b2ac014

File tree

10 files changed

+132
-138
lines changed

10 files changed

+132
-138
lines changed

config/totem.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
'parameters' => [
3434
[
3535
'label' => 'At',
36-
'modifier' => 'at',
36+
'name' => 'at',
3737
'type' => 'number',
3838
'min' => '0',
3939
'max' => '59',
@@ -51,7 +51,7 @@
5151
'parameters' => [
5252
[
5353
'label' => 'At',
54-
'modifier' => 'at',
54+
'name' => 'at',
5555
'type' => 'time',
5656
],
5757
],
@@ -62,12 +62,12 @@
6262
'parameters' => [
6363
[
6464
'label' => 'First',
65-
'modifier' => 'at',
65+
'name' => 'at',
6666
'type' => 'time',
6767
],
6868
[
6969
'label' => 'Second',
70-
'modifier' => 'second_at',
70+
'name' => 'second_at',
7171
'type' => 'time',
7272
],
7373
],
@@ -83,14 +83,14 @@
8383
'parameters' => [
8484
[
8585
'label' => 'On',
86-
'modifier' => 'on',
86+
'name' => 'on',
8787
'type' => 'number',
8888
'min' => '1',
8989
'max' => '31',
9090
],
9191
[
9292
'label' => 'At',
93-
'modifier' => 'at',
93+
'name' => 'at',
9494
'type' => 'time',
9595
],
9696
],
@@ -106,13 +106,13 @@
106106
'parameters' => [
107107
[
108108
'label' => 'On',
109-
'modifier' => 'on',
109+
'name' => 'on',
110110
'type' => 'number',
111111
'max' => '',
112112
],
113113
[
114114
'label' => 'At',
115-
'modifier' => 'at',
115+
'name' => 'at',
116116
'type' => 'time',
117117
],
118118
],
@@ -123,12 +123,12 @@
123123
'parameters' => [
124124
[
125125
'label' => 'First',
126-
'modifier' => 'on',
126+
'name' => 'on',
127127
'type' => 'number',
128128
],
129129
[
130130
'label' => 'Second',
131-
'modifier' => 'second_at',
131+
'name' => 'second_at',
132132
'type' => 'text',
133133
],
134134
],
@@ -189,12 +189,12 @@
189189
'parameters' => [
190190
[
191191
'label' => 'Start',
192-
'modifier' => 'start',
192+
'name' => 'start',
193193
'type' => 'time',
194194
],
195195
[
196196
'label' => 'End',
197-
'modifier' => 'end',
197+
'name' => 'end',
198198
'type' => 'time',
199199
],
200200
],
@@ -205,12 +205,12 @@
205205
'parameters' => [
206206
[
207207
'label' => 'Start',
208-
'modifier' => 'start',
208+
'name' => 'start',
209209
'type' => 'time',
210210
],
211211
[
212212
'label' => 'End',
213-
'modifier' => 'end',
213+
'name' => 'end',
214214
'type' => 'time',
215215
],
216216
],

database/migrations/2017_08_05_195539_create_task_frequencies_table.php

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -17,38 +17,7 @@ public function up()
1717
$table->increments('id');
1818
$table->unsignedInteger('task_id');
1919
$table->string('label');
20-
$table->enum('interval', [
21-
'everyMinute',
22-
'everyFiveMinutes',
23-
'everyTenMinutes',
24-
'everyThirtyMinutes',
25-
'hourly',
26-
'hourlyAt',
27-
'daily',
28-
'dailyAt',
29-
'twiceDaily',
30-
'weekly',
31-
'weeklyOn',
32-
'monthly',
33-
'twiceMonthly',
34-
'monthlyOn',
35-
'quarterly',
36-
'yearly',
37-
'weekdays',
38-
'sundays',
39-
'mondays',
40-
'tuesdays',
41-
'wednesdays',
42-
'thursdays',
43-
'fridays',
44-
'saturdays',
45-
]);
46-
$table->integer('on')->nullable();
47-
$table->integer('second_on')->nullable();
48-
$table->string('at')->nullable();
49-
$table->string('second_at')->nullable();
50-
$table->time('start')->nullable();
51-
$table->time('end')->nullable();
20+
$table->string('interval');
5221
$table->timestamps();
5322
});
5423
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
use Illuminate\Support\Facades\Schema;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Database\Migrations\Migration;
6+
7+
class CreateFrequencyParametersTable extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('frequency_parameters', function (Blueprint $table) {
17+
$table->increments('id');
18+
$table->unsignedInteger('frequency_id');
19+
$table->string('name');
20+
$table->string('value');
21+
$table->timestamps();
22+
});
23+
}
24+
25+
/**
26+
* Reverse the migrations.
27+
*
28+
* @return void
29+
*/
30+
public function down()
31+
{
32+
Schema::dropIfExists('frequency_parameters');
33+
}
34+
}

0 commit comments

Comments
 (0)