Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perbaikan error migrasi tema #1015

Merged
merged 3 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions app/Enums/Tema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

/*
* File ini bagian dari:
*
* OpenDK
*
* Aplikasi dan source code ini dirilis berdasarkan lisensi GPL V3
*
* Hak Cipta 2017 - 2024 Perkumpulan Desa Digital Terbuka (https://opendesa.id)
*
* Dengan ini diberikan izin, secara gratis, kepada siapa pun yang mendapatkan salinan
* dari perangkat lunak ini dan file dokumentasi terkait ("Aplikasi Ini"), untuk diperlakukan
* tanpa batasan, termasuk hak untuk menggunakan, menyalin, mengubah dan/atau mendistribusikan,
* asal tunduk pada syarat berikut:
*
* Pemberitahuan hak cipta di atas dan pemberitahuan izin ini harus disertakan dalam
* setiap salinan atau bagian penting Aplikasi Ini. Barang siapa yang menghapus atau menghilangkan
* pemberitahuan ini melanggar ketentuan lisensi Aplikasi Ini.
*
* PERANGKAT LUNAK INI DISEDIAKAN "SEBAGAIMANA ADANYA", TANPA JAMINAN APA PUN, BAIK TERSURAT MAUPUN
* TERSIRAT. PENULIS ATAU PEMEGANG HAK CIPTA SAMA SEKALI TIDAK BERTANGGUNG JAWAB ATAS KLAIM, KERUSAKAN ATAU
* KEWAJIBAN APAPUN ATAS PENGGUNAAN ATAU LAINNYA TERKAIT APLIKASI INI.
*
* @package OpenDK
* @author Tim Pengembang OpenDesa
* @copyright Hak Cipta 2017 - 2024 Perkumpulan Desa Digital Terbuka (https://opendesa.id)
* @license http://www.gnu.org/licenses/gpl.html GPL V3
* @link https://github.com/OpenSID/opendk
*/

namespace App\Enums;

use BenSampo\Enum\Enum;

/**
* Status untuk melihat aktif dan tidak aktif
*/
final class Tema extends Enum
{
public const TemaKostum = 0;
public const TemaSistem = 1;
}
2 changes: 2 additions & 0 deletions catatan_rilis.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Terima kasih pada @uddinmtm telah ikut berkontribusi.
4. [#1008](https://github.com/OpenSID/OpenDK/issues/1008) Perbaikan error tidak bisa mengirim keluhan di sikema.
5. [#985](https://github.com/OpenSID/OpenDK/issues/985) Perbaikan navigasi default
6. [#990](https://github.com/OpenSID/OpenDK/issues/990) Perbaikan error ketika hapus slide tanpa gambar
7. [#994](https://github.com/OpenSID/OpenDK/issues/994) Perbaikan error migrasi tema.
8. [#992](https://github.com/OpenSID/OpenDK/issues/992) Perbaikan error setelah update terbaru.

#### TEKNIS

Expand Down
46 changes: 30 additions & 16 deletions database/migrations/2024_06_03_042202_create_themes.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use App\Enums\Status;
use App\Enums\Tema;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

return new class extends Migration
{
Expand All @@ -13,21 +17,31 @@
*/
public function up()
{
Schema::create('das_themes', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('vendor');
$table->string('version');
$table->string('description')->nullable();
$table->string('path');
$table->string('screenshot')->nullable();
$table->boolean('active')->default(0);
$table->boolean('system')->default(0);
$table->mediumText('options')->nullable();
$table->timestamps();
});
// cek apakah tabel das_themes ada
if (Schema::hasTable('das_themes')) {
// Kosongkan tabel
DB::table('das_themes')->truncate();
} else {
Schema::create('das_themes', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('vendor');
$table->string('version');
$table->string('description')->nullable();
$table->string('path');
$table->string('screenshot')->nullable();
$table->boolean('active')->default(Status::TidakAktif);
$table->boolean('system')->default(Tema::TemaKostum);
$table->mediumText('options')->nullable();
$table->timestamps();
});
}

scan_themes();
try {
scan_themes();
} catch (\Exception $e) {
Log::error('Error scanning themes: ' . $e->getMessage());
}
}

/**
Expand Down