Fix: Adding a check for hasTable
This commit is contained in:
@@ -12,11 +12,20 @@ use Lunar\Base\Migration;
|
|||||||
* package's own classes over this same table). Timestamped to run just
|
* package's own classes over this same table). Timestamped to run just
|
||||||
* before this app's own add_context_to_stripe_payment_intents migration,
|
* before this app's own add_context_to_stripe_payment_intents migration,
|
||||||
* which already alters this table.
|
* which already alters this table.
|
||||||
|
*
|
||||||
|
* Guarded with hasTable(): on any environment that already ran
|
||||||
|
* lunarphp/stripe's own copy of this migration before the package was
|
||||||
|
* removed, the table already exists — this migration is only the one that
|
||||||
|
* actually creates it on a fresh install/database from now on.
|
||||||
*/
|
*/
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
if (Schema::hasTable($this->prefix.'stripe_payment_intents')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Schema::create($this->prefix.'stripe_payment_intents', function (Blueprint $table) {
|
Schema::create($this->prefix.'stripe_payment_intents', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->foreignId('cart_id')->constrained($this->prefix.'carts');
|
$table->foreignId('cart_id')->constrained($this->prefix.'carts');
|
||||||
|
|||||||
Reference in New Issue
Block a user