mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-12-09 06:45:30 -05:00
72 lines
2.7 KiB
PHP
72 lines
2.7 KiB
PHP
<?php
|
|
|
|
use Illuminate\Support\Facades\Schema;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Database\Migrations\Migration;
|
|
|
|
class AddSlackNotifications extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
Schema::table('users', function ($table) {
|
|
$table->string('slack_webhook_url')->nullable();
|
|
$table->string('accepted_terms_version')->nullable();
|
|
$table->timestamp('accepted_terms_timestamp')->nullable();
|
|
$table->string('accepted_terms_ip')->nullable();
|
|
});
|
|
|
|
Schema::table('accounts', function ($table) {
|
|
$table->boolean('auto_archive_invoice')->default(false)->nullable();
|
|
$table->boolean('auto_archive_quote')->default(false)->nullable();
|
|
$table->boolean('auto_email_invoice')->default(true)->nullable();
|
|
});
|
|
|
|
Schema::table('expenses', function ($table) {
|
|
$table->foreign('client_id')->references('id')->on('clients')->onDelete('cascade');
|
|
});
|
|
|
|
Schema::table('activities', function ($table) {
|
|
$table->integer('task_id')->unsigned()->change();
|
|
});
|
|
|
|
DB::statement('UPDATE activities SET client_id = NULL WHERE client_id = 0');
|
|
|
|
Schema::table('activities', function ($table) {
|
|
$table->foreign('client_id')->references('id')->on('clients')->onDelete('cascade');
|
|
$table->foreign('contact_id')->references('id')->on('contacts')->onDelete('cascade');
|
|
$table->foreign('payment_id')->references('id')->on('payments')->onDelete('cascade');
|
|
$table->foreign('invoice_id')->references('id')->on('invoices')->onDelete('cascade');
|
|
$table->foreign('credit_id')->references('id')->on('credits')->onDelete('cascade');
|
|
$table->foreign('task_id')->references('id')->on('tasks')->onDelete('cascade');
|
|
$table->foreign('invitation_id')->references('id')->on('invitations')->onDelete('cascade');
|
|
$table->foreign('expense_id')->references('id')->on('expenses')->onDelete('cascade');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::table('users', function ($table) {
|
|
$table->dropColumn('slack_webhook_url');
|
|
$table->dropColumn('accepted_terms_version');
|
|
$table->dropColumn('accepted_terms_timestamp');
|
|
$table->dropColumn('accepted_terms_ip');
|
|
});
|
|
|
|
Schema::table('accounts', function ($table) {
|
|
$table->dropColumn('auto_archive_invoice');
|
|
$table->dropColumn('auto_archive_quote');
|
|
$table->dropColumn('auto_email_invoice');
|
|
});
|
|
}
|
|
}
|