diff --git a/database/migrations/2026_09_06_000001_create_giftcards_tables.php b/database/migrations/2026_09_06_000001_create_giftcards_tables.php new file mode 100644 index 0000000..9afc4ed --- /dev/null +++ b/database/migrations/2026_09_06_000001_create_giftcards_tables.php @@ -0,0 +1,53 @@ +increments('id'); + $table->integer('customer_id')->nullable(); + $table->unsignedTinyInteger('use_once')->default(0); + $table->integer('count')->nullable(); + $table->float('amount')->nullable(); + $table->bigInteger('total')->nullable(); + $table->integer('unit')->nullable(); + $table->string('unique_code')->nullable(); + $table->timestamp('created_at')->nullable(); + $table->unsignedTinyInteger('sts')->nullable(); + $table->timestamp('expiry_date')->nullable(); + $table->integer('used_count')->nullable(); + $table->timestamp('updated_at')->nullable(); + $table->text('description')->nullable(); + $table->string('name')->nullable(); + $table->string('mobile')->nullable(); + }); + } + + if (! Schema::hasTable('giftcard_codes')) { + Schema::create('giftcard_codes', function (Blueprint $table) { + $table->increments('id'); + $table->integer('giftcard_id')->nullable(); + $table->unsignedTinyInteger('use_once')->default(0); + $table->string('code')->nullable(); + $table->unsignedTinyInteger('sts')->nullable(); + $table->unsignedTinyInteger('unit')->nullable(); + $table->float('amount')->nullable(); + $table->text('assigned_to')->nullable(); + $table->timestamp('used_at')->nullable(); + $table->timestamp('expiry_date')->nullable(); + $table->timestamps(); + }); + } + } + + public function down(): void + { + // جدول ممکن است از قبل روی نصب‌های قدیمی بوده باشد؛ drop نمی‌کنیم. + } +};