Add column checks prior to drops

This commit is contained in:
David Bomba 2023-06-30 08:54:33 +10:00
parent 0b0128fb41
commit 974aabe87e
2 changed files with 9 additions and 4 deletions

View File

@ -821,13 +821,15 @@ class SubscriptionService
$invoice->is_proforma = false;
$invoice->save();
// 29-06-2023 handle webhooks for payment intent - user may not be present.
$context = [
'context' => 'change_plan',
'recurring_invoice' => $recurring_invoice->hashed_id,
'invoice' => $this->encodePrimaryKey($payment_hash->fee_invoice_id),
'client' => $recurring_invoice->client->hashed_id,
'subscription' => $this->subscription->hashed_id,
'contact' => auth()->guard('contact')->user()->hashed_id,
'contact' => auth()->guard('contact')->user()?->hashed_id ?? $recurring_invoice->client->contacts()->first()->hashed_id,
'account_key' => $recurring_invoice->client->custom_value2,
];

View File

@ -25,9 +25,12 @@ return new class extends Migration
Language::create(['id' => 38, 'name' => 'Khmer', 'locale' => 'km_KH']);
}
Schema::table('companies', function (Blueprint $table) {
$table->dropColumn('enable_e_invoice');
});
if (Schema::hasColumn('companies', 'enable_e_invoice'))
{
Schema::table('companies', function (Blueprint $table) {
$table->dropColumn('enable_e_invoice');
});
}
Company::query()->cursor()->each(function ($company){
$company->tax_data = new TaxModel();