fix(replication): clean drop in reverse order and purge recyclebin during fresh migrations
This commit is contained in:
parent
b4f3c0bdb9
commit
72a4278ca6
1 changed files with 14 additions and 0 deletions
|
|
@ -60,6 +60,7 @@ use Database\ArcadiaReplicate\Views\Refp\IncoSocRefIncoView;
|
|||
use Database\ArcadiaReplicate\Views\Refp\SitProdIncoView;
|
||||
use Database\ArcadiaReplicate\Views\Refp\SocDlcIncoView;
|
||||
use Database\ArcadiaReplicate\Views\Refp\VisuelExportGenfiView;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
final class Migrator
|
||||
|
|
@ -130,6 +131,10 @@ final class Migrator
|
|||
|
||||
public function up(): void
|
||||
{
|
||||
if (app()->environment('local', 'testing')) {
|
||||
$this->down();
|
||||
}
|
||||
|
||||
$schema = Schema::connection($this->connection);
|
||||
|
||||
foreach (self::DEFINITIONS as $definition) {
|
||||
|
|
@ -144,6 +149,15 @@ final class Migrator
|
|||
foreach (array_reverse(self::DEFINITIONS) as $definition) {
|
||||
$definition::down($schema);
|
||||
}
|
||||
|
||||
$conn = DB::connection($this->connection);
|
||||
if ($conn->getDriverName() === 'oracle') {
|
||||
try {
|
||||
$conn->statement('PURGE RECYCLEBIN');
|
||||
} catch (\Throwable $e) {
|
||||
unset($e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function runUp(string $connection): void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue