mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-19 19:24:03 +00:00
Add release migration and fix some old database leftovers
This commit is contained in:
35
database/migrations/2024_02_11_075831_update_version_101.php
Normal file
35
database/migrations/2024_02_11_075831_update_version_101.php
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use InvoiceShelf\Models\Setting;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
|
||||||
|
try {
|
||||||
|
DB::update("UPDATE abilities SET entity_type = REPLACE(entity_type, 'Crater', 'InvoiceShelf')");
|
||||||
|
DB::update("UPDATE assigned_roles SET entity_type = REPLACE(entity_type, 'Crater', 'InvoiceShelf')");
|
||||||
|
} catch (\Exception $e) {}
|
||||||
|
|
||||||
|
Setting::setSetting('version', '1.1.0');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
DB::update("UPDATE abilities SET entity_type = REPLACE(entity_type, 'InvoiceShelf', 'Crater')");
|
||||||
|
DB::update("UPDATE assigned_roles SET entity_type = REPLACE(entity_type, 'InvoiceShelf', 'Crater')");
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user