1 | <?php namespace Arcanedev\Support\Database; |
||
13 | abstract class Migration extends IlluminateMigration |
||
14 | { |
||
15 | /* ----------------------------------------------------------------- |
||
16 | | Properties |
||
17 | | ----------------------------------------------------------------- |
||
18 | */ |
||
19 | |||
20 | /** |
||
21 | * The table name. |
||
22 | * |
||
23 | * @var string|null |
||
24 | */ |
||
25 | protected $table; |
||
26 | |||
27 | /** |
||
28 | * The table prefix. |
||
29 | * |
||
30 | * @var string|null |
||
31 | */ |
||
32 | protected $prefix; |
||
33 | |||
34 | /* ----------------------------------------------------------------- |
||
35 | | Getters & Setters |
||
36 | | ----------------------------------------------------------------- |
||
37 | */ |
||
38 | |||
39 | /** |
||
40 | * Set the migration connection name. |
||
41 | * |
||
42 | * @param string $connection |
||
43 | * |
||
44 | * @return self |
||
45 | */ |
||
46 | public function setConnection($connection) |
||
52 | |||
53 | /** |
||
54 | * Get the table name. |
||
55 | * |
||
56 | * @return null|string |
||
57 | */ |
||
58 | public function getTable() |
||
62 | |||
63 | /** |
||
64 | * Get the prefixed table name. |
||
65 | * |
||
66 | * @return string |
||
67 | */ |
||
68 | public function getTableName() |
||
74 | |||
75 | /** |
||
76 | * Set the table name. |
||
77 | * |
||
78 | * @param string $table |
||
79 | * |
||
80 | * @return self |
||
81 | */ |
||
82 | public function setTable($table) |
||
88 | |||
89 | /** |
||
90 | * Get the prefix name. |
||
91 | * |
||
92 | * @return null|string |
||
93 | */ |
||
94 | public function getPrefix() |
||
98 | |||
99 | /** |
||
100 | * Set the prefix name. |
||
101 | * |
||
102 | * @param string $prefix |
||
103 | * |
||
104 | * @return self |
||
105 | */ |
||
106 | public function setPrefix($prefix) |
||
112 | |||
113 | /* ----------------------------------------------------------------- |
||
114 | | Main Methods |
||
115 | | ----------------------------------------------------------------- |
||
116 | */ |
||
117 | |||
118 | /** |
||
119 | * Migrate to database. |
||
120 | */ |
||
121 | abstract public function up(); |
||
122 | |||
123 | /** |
||
124 | * Rollback the migration. |
||
125 | */ |
||
126 | public function down() |
||
136 | |||
137 | /** |
||
138 | * Create Table Schema. |
||
139 | * |
||
140 | * @param \Closure $blueprint |
||
141 | */ |
||
142 | protected function createSchema(Closure $blueprint) |
||
152 | |||
153 | /* ----------------------------------------------------------------- |
||
154 | | Check Methods |
||
155 | | ----------------------------------------------------------------- |
||
156 | */ |
||
157 | |||
158 | /** |
||
159 | * Check if connection exists. |
||
160 | * |
||
161 | * @return bool |
||
162 | */ |
||
163 | protected function hasConnection() |
||
167 | |||
168 | /** |
||
169 | * Check if table has prefix. |
||
170 | * |
||
171 | * @return bool |
||
172 | */ |
||
173 | protected function hasPrefix() |
||
177 | |||
178 | /** |
||
179 | * Check if the value is not empty. |
||
180 | * |
||
181 | * @param string $value |
||
182 | * |
||
183 | * @return bool |
||
184 | */ |
||
185 | private function isNotEmpty($value) |
||
189 | } |
||
190 |