From 1717035643a045749a624eea2140fdbc9331c561 Mon Sep 17 00:00:00 2001 From: nurafrinaalimi16 Date: Mon, 10 Nov 2025 19:12:26 +0800 Subject: [PATCH] database migration for kadar anggota koperasi --- ...2025_10_06_160240_create_anggota_table.php | 35 ++++++++++ ..._08_121938_add_status_to_anggota_table.php | 36 +++++++++++ ...0723_add_tag_anggota_to_customer_table.php | 32 ++++++++++ ...1_04_164447_create_mohon_anggota_table.php | 64 +++++++++++++++++++ 4 files changed, 167 insertions(+) create mode 100644 database/migrations/2025_10_06_160240_create_anggota_table.php create mode 100644 database/migrations/2025_10_08_121938_add_status_to_anggota_table.php create mode 100644 database/migrations/2025_10_13_110723_add_tag_anggota_to_customer_table.php create mode 100644 database/migrations/2025_11_04_164447_create_mohon_anggota_table.php diff --git a/database/migrations/2025_10_06_160240_create_anggota_table.php b/database/migrations/2025_10_06_160240_create_anggota_table.php new file mode 100644 index 0000000..33297f3 --- /dev/null +++ b/database/migrations/2025_10_06_160240_create_anggota_table.php @@ -0,0 +1,35 @@ +id(); + $table->string('no_anggota')->unique()->nullable(); // No keahlian + $table->string('nama'); + $table->string('noic')->unique(); // IC wajib unik + $table->string('no_tel')->nullable(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('anggota'); + } +} diff --git a/database/migrations/2025_10_08_121938_add_status_to_anggota_table.php b/database/migrations/2025_10_08_121938_add_status_to_anggota_table.php new file mode 100644 index 0000000..d9afe81 --- /dev/null +++ b/database/migrations/2025_10_08_121938_add_status_to_anggota_table.php @@ -0,0 +1,36 @@ +tinyInteger('status') + ->default(1) + ->comment('1 = aktif, 0 = tidak aktif') + ->after('no_tel'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('anggota', function (Blueprint $table) { + // + $table->dropColumn('status'); + }); + } +} diff --git a/database/migrations/2025_10_13_110723_add_tag_anggota_to_customer_table.php b/database/migrations/2025_10_13_110723_add_tag_anggota_to_customer_table.php new file mode 100644 index 0000000..d2c585b --- /dev/null +++ b/database/migrations/2025_10_13_110723_add_tag_anggota_to_customer_table.php @@ -0,0 +1,32 @@ +boolean('tag_anggota')->default(0)->after('ahli'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('customer', function (Blueprint $table) { + $table->dropColumn('tag_anggota'); + }); + } +} diff --git a/database/migrations/2025_11_04_164447_create_mohon_anggota_table.php b/database/migrations/2025_11_04_164447_create_mohon_anggota_table.php new file mode 100644 index 0000000..8f9f15c --- /dev/null +++ b/database/migrations/2025_11_04_164447_create_mohon_anggota_table.php @@ -0,0 +1,64 @@ +getPdo(); + return true; + } catch (\Exception $e) { + return false; + } + }); + + return $db_connection; + } + + /** + * Jalankan migration + */ + public function up() + { + $db_connection = $this->getActiveDB(); + + foreach ($db_connection as $dbase) { + if (!Schema::connection($dbase)->hasTable('mohon_anggota')) { + Schema::connection($dbase)->create('mohon_anggota', function (Blueprint $table) { + $table->bigIncrements('id'); + $table->date('tarikh')->nullable(); + $table->string('nokp', 20)->nullable(); + $table->string('nama', 100)->nullable(); + $table->string('status', 50)->default('MENUNGGU OPERASI'); + $table->text('komen')->nullable(); + $table->string('teller', 100)->nullable(); + $table->string('peloperasi', 100)->nullable(); + $table->dateTime('datetime_pelulus')->nullable(); + $table->timestamps(); + }); + } + } + } + + /** + * Undur migration + */ + public function down() + { + $db_connection = $this->getActiveDB(); + + foreach ($db_connection as $dbase) { + Schema::connection($dbase)->dropIfExists('mohon_anggota'); + } + } +}