Conditions | 1 |
Paths | 1 |
Total Lines | 51 |
Code Lines | 38 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
19 | public function safeUp() |
||
20 | { |
||
21 | /* First remove auto increment column */ |
||
22 | $this->alterColumn($this->env->pushTableName,'id' ,$this->bigInteger()); |
||
23 | /* remove primary key index */ |
||
24 | $this->dropPrimaryKey($this->db->schema->getTableSchema($this->env->pushTableName)->primaryKey[0],$this->env->pushTableName); |
||
25 | /* add new primary */ |
||
26 | $this->alterColumn($this->env->pushTableName,'id' ,$this->bigPrimaryKey()); |
||
27 | $this->alterColumn($this->env->pushTableName,'parent_id' ,$this->bigInteger()); |
||
28 | $this->alterColumn($this->env->pushTableName,'pushed_at' ,$this->integer()->unsigned()->notNull()); |
||
29 | $this->alterColumn($this->env->pushTableName,'stopped_at' , $this->integer()->unsigned()); |
||
30 | $this->alterColumn($this->env->pushTableName,'first_exec_id' , $this->bigInteger()); |
||
31 | $this->alterColumn($this->env->pushTableName,'last_exec_id' , $this->bigInteger()); |
||
32 | |||
33 | $this->renameColumn($this->env->pushTableName,'push_ttr','ttr'); |
||
34 | $this->alterColumn($this->env->pushTableName,'ttr' , $this->integer()->unsigned()); |
||
35 | $this->renameColumn($this->env->pushTableName,'push_delay','delay'); |
||
36 | $this->alterColumn($this->env->pushTableName,'delay' , $this->integer()->unsigned()); |
||
37 | $this->renameColumn($this->env->pushTableName,'push_trace_data','trace'); |
||
38 | $this->alterColumn($this->env->pushTableName,'trace' , $this->text()); |
||
39 | $this->renameColumn($this->env->pushTableName,'push_env_data','context'); |
||
40 | $this->alterColumn($this->env->pushTableName,'context' , $this->text()); |
||
41 | |||
42 | |||
43 | $this->alterColumn($this->env->execTableName,'id' ,$this->bigInteger()); |
||
44 | $this->dropPrimaryKey($this->db->schema->getTableSchema($this->env->execTableName)->primaryKey[0],$this->env->execTableName); |
||
45 | $this->alterColumn($this->env->execTableName,'id' ,$this->bigPrimaryKey()); |
||
46 | $this->alterColumn($this->env->execTableName,'push_id' ,$this->bigInteger()->notNull()); |
||
47 | $this->alterColumn($this->env->execTableName,'worker_id' ,$this->bigInteger()); |
||
48 | $this->alterColumn($this->env->execTableName,'attempt' ,$this->integer()->unsigned()->notNull()); |
||
49 | |||
50 | $this->renameColumn($this->env->execTableName,'reserved_at' ,'started_at'); |
||
51 | $this->renameColumn($this->env->execTableName,'done_at' ,'finished_at'); |
||
52 | |||
53 | $this->alterColumn($this->env->execTableName,'started_at' ,$this->integer()->unsigned()->notNull()); |
||
54 | $this->alterColumn($this->env->execTableName,'finished_at' ,$this->integer()->unsigned()); |
||
55 | $this->alterColumn($this->env->execTableName,'memory_usage' ,$this->bigInteger()->unsigned()); |
||
56 | |||
57 | |||
58 | $this->alterColumn($this->env->workerTableName,'id' ,$this->bigInteger()); |
||
59 | $this->dropPrimaryKey($this->db->schema->getTableSchema($this->env->workerTableName)->primaryKey[0],$this->env->workerTableName); |
||
60 | $this->alterColumn($this->env->workerTableName,'id' ,$this->bigPrimaryKey()); |
||
61 | $this->addColumn($this->env->workerTableName,'host' ,$this->string(64)->after('sender_name')); |
||
62 | $this->alterColumn($this->env->workerTableName,'pid' ,$this->integer()->unsigned()); |
||
63 | $this->alterColumn($this->env->workerTableName,'started_at' ,$this->integer()->unsigned()->notNull()); |
||
64 | $this->alterColumn($this->env->workerTableName,'pinged_at' ,$this->integer()->unsigned()->notNull()); |
||
65 | $this->alterColumn($this->env->workerTableName,'stopped_at' ,$this->integer()->unsigned()); |
||
66 | $this->alterColumn($this->env->workerTableName,'finished_at' ,$this->integer()->unsigned()); |
||
67 | $this->alterColumn($this->env->workerTableName,'last_exec_id' ,$this->bigInteger()); |
||
68 | |||
69 | $this->dropIndex('pid',$this->env->workerTableName); |
||
70 | |||
125 | } |