@@ 122-136 (lines=15) @@ | ||
119 | * @param $table |
|
120 | * @param FieldType $type |
|
121 | */ |
|
122 | public function dropColumn($table, FieldType $type) |
|
123 | { |
|
124 | $schema = $type->getSchema(); |
|
125 | ||
126 | if (!$this->schema->hasTable($table)) { |
|
127 | return; |
|
128 | } |
|
129 | ||
130 | $this->schema->table( |
|
131 | $table, |
|
132 | function (Blueprint $table) use ($schema) { |
|
133 | $schema->dropColumn($table); |
|
134 | } |
|
135 | ); |
|
136 | } |
|
137 | ||
138 | /** |
|
139 | * Backup a column's data. |
|
@@ 144-158 (lines=15) @@ | ||
141 | * @param $table |
|
142 | * @param FieldType $type |
|
143 | */ |
|
144 | public function backupColumn($table, FieldType $type) |
|
145 | { |
|
146 | if (!$this->schema->hasTable($table)) { |
|
147 | return; |
|
148 | } |
|
149 | ||
150 | $schema = $type->getSchema(); |
|
151 | ||
152 | $this->schema->table( |
|
153 | $table, |
|
154 | function (Blueprint $table) use ($schema) { |
|
155 | $schema->backupColumn($table); |
|
156 | } |
|
157 | ); |
|
158 | } |
|
159 | ||
160 | /** |
|
161 | * Restore a column's data. |
|
@@ 166-180 (lines=15) @@ | ||
163 | * @param $table |
|
164 | * @param FieldType $type |
|
165 | */ |
|
166 | public function restoreColumn($table, FieldType $type) |
|
167 | { |
|
168 | if (!$this->schema->hasTable($table)) { |
|
169 | return; |
|
170 | } |
|
171 | ||
172 | $schema = $type->getSchema(); |
|
173 | ||
174 | $this->schema->table( |
|
175 | $table, |
|
176 | function (Blueprint $table) use ($schema) { |
|
177 | $schema->restoreColumn($table); |
|
178 | } |
|
179 | ); |
|
180 | } |
|
181 | } |
|
182 |