1 | <?php namespace Arcanedev\Support\Database; |
||
12 | abstract class Migration extends IlluminateMigration |
||
13 | { |
||
14 | /* ----------------------------------------------------------------- |
||
15 | | Properties |
||
16 | | ----------------------------------------------------------------- |
||
17 | */ |
||
18 | |||
19 | /** |
||
20 | * The table name. |
||
21 | * |
||
22 | * @var string|null |
||
23 | */ |
||
24 | protected $table; |
||
25 | |||
26 | /** |
||
27 | * The table prefix. |
||
28 | * |
||
29 | * @var string|null |
||
30 | */ |
||
31 | protected $prefix; |
||
32 | |||
33 | /* ----------------------------------------------------------------- |
||
34 | | Getters & Setters |
||
35 | | ----------------------------------------------------------------- |
||
36 | */ |
||
37 | |||
38 | /** |
||
39 | * Get a schema builder instance for the connection. |
||
40 | * |
||
41 | * @return \Illuminate\Database\Schema\Builder |
||
42 | */ |
||
43 | protected function getSchemaBuilder() |
||
51 | |||
52 | /** |
||
53 | * Set the migration connection name. |
||
54 | * |
||
55 | * @param string $connection |
||
56 | * |
||
57 | * @return self |
||
58 | */ |
||
59 | public function setConnection($connection) |
||
65 | |||
66 | /** |
||
67 | * Get the prefixed table name. |
||
68 | * |
||
69 | * @return string |
||
70 | */ |
||
71 | public function getTableName() |
||
75 | |||
76 | /** |
||
77 | * Set the table name. |
||
78 | * |
||
79 | * @param string $table |
||
80 | * |
||
81 | * @return self |
||
82 | */ |
||
83 | public function setTable($table) |
||
89 | |||
90 | /** |
||
91 | * Set the prefix name. |
||
92 | * |
||
93 | * @param string $prefix |
||
94 | * |
||
95 | * @return self |
||
96 | */ |
||
97 | public function setPrefix($prefix) |
||
103 | |||
104 | /* ----------------------------------------------------------------- |
||
105 | | Main Methods |
||
106 | | ----------------------------------------------------------------- |
||
107 | */ |
||
108 | |||
109 | /** |
||
110 | * Migrate to database. |
||
111 | */ |
||
112 | abstract public function up(); |
||
113 | |||
114 | /** |
||
115 | * Rollback the migration. |
||
116 | */ |
||
117 | public function down() |
||
121 | |||
122 | /** |
||
123 | * Create Table Schema. |
||
124 | * |
||
125 | * @param \Closure $blueprint |
||
126 | */ |
||
127 | protected function createSchema(Closure $blueprint) |
||
131 | |||
132 | /** |
||
133 | * Modify a table on the schema. |
||
134 | * |
||
135 | * @param \Closure $callback |
||
136 | */ |
||
137 | protected function table(Closure $callback) |
||
141 | |||
142 | /* ----------------------------------------------------------------- |
||
143 | | Check Methods |
||
144 | | ----------------------------------------------------------------- |
||
145 | */ |
||
146 | |||
147 | /** |
||
148 | * Check if connection exists. |
||
149 | * |
||
150 | * @return bool |
||
151 | */ |
||
152 | protected function hasConnection() |
||
156 | |||
157 | /** |
||
158 | * Check if table has prefix. |
||
159 | * |
||
160 | * @return bool |
||
161 | */ |
||
162 | protected function hasPrefix() |
||
166 | |||
167 | /** |
||
168 | * Check if the value is not empty. |
||
169 | * |
||
170 | * @param string $value |
||
171 | * |
||
172 | * @return bool |
||
173 | */ |
||
174 | private function isNotEmpty($value) |
||
178 | } |
||
179 |