mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Adjust constraints in migration
This commit is contained in:
parent
0225526756
commit
0b2ded93b9
@ -623,7 +623,7 @@ class CreateUsersTable extends Migration
|
||||
$t->unsignedInteger('vendor_id')->nullable();
|
||||
|
||||
$t->unsignedInteger('status_id')->index();
|
||||
$t->text('number')->nullable();
|
||||
$t->string('number')->nullable();
|
||||
|
||||
$t->float('discount')->default(0);
|
||||
$t->boolean('is_amount_discount')->default(false);
|
||||
@ -672,6 +672,7 @@ class CreateUsersTable extends Migration
|
||||
$t->softDeletes('deleted_at', 6);
|
||||
$t->index(['company_id', 'deleted_at']);
|
||||
|
||||
$t->unique(['company_id', 'number']);
|
||||
$t->foreign('client_id')->references('id')->on('clients')->onDelete('cascade')->onUpdate('cascade');
|
||||
$t->foreign('company_id')->references('id')->on('companies')->onDelete('cascade')->onUpdate('cascade');
|
||||
$t->foreign('user_id')->references('id')->on('users')->onDelete('cascade')->onUpdate('cascade');
|
||||
@ -960,7 +961,7 @@ class CreateUsersTable extends Migration
|
||||
$t->unsignedInteger('exchange_currency_id');
|
||||
|
||||
$t->index(['company_id', 'deleted_at']);
|
||||
|
||||
$t->unique(['company_id', 'number']);
|
||||
$t->foreign('company_id')->references('id')->on('companies')->onDelete('cascade')->onUpdate('cascade');
|
||||
$t->foreign('client_id')->references('id')->on('clients')->onDelete('cascade')->onUpdate('cascade');
|
||||
$t->foreign('client_contact_id')->references('id')->on('client_contacts')->onDelete('cascade')->onUpdate('cascade');
|
||||
|
@ -25,15 +25,18 @@ class IdNumberFieldsForMissingEntities extends Migration
|
||||
{
|
||||
Schema::table('expenses', function (Blueprint $table) {
|
||||
$table->string('number')->nullable();
|
||||
$table->unique(['company_id', 'number']);
|
||||
});
|
||||
|
||||
Schema::table('tasks', function (Blueprint $table) {
|
||||
$table->string('number')->nullable();
|
||||
$table->unique(['company_id', 'number']);
|
||||
});
|
||||
|
||||
Schema::table('vendors', function (Blueprint $table) {
|
||||
$table->text('vendor_hash')->nullable();
|
||||
$table->text('public_notes')->nullable();
|
||||
$table->unique(['company_id', 'number']);
|
||||
});
|
||||
|
||||
Schema::table('vendor_contacts', function (Blueprint $table) {
|
||||
|
@ -24,6 +24,7 @@ class ProjectNumberColumn extends Migration
|
||||
{
|
||||
Schema::table('projects', function ($table) {
|
||||
$table->string('number')->nullable();
|
||||
$table->unique(['company_id', 'number']);
|
||||
});
|
||||
|
||||
Schema::table('expenses', function ($t) {
|
||||
|
@ -23,10 +23,13 @@ class AddNumberFieldToClientsAndVendors extends Migration
|
||||
|
||||
Schema::table('clients', function (Blueprint $table) {
|
||||
$table->string('id_number')->nullable();
|
||||
$table->unique(['company_id', 'number']);
|
||||
});
|
||||
|
||||
Schema::table('vendors', function (Blueprint $table) {
|
||||
$table->string('id_number')->nullable();
|
||||
$table->unique(['company_id', 'number']);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
@ -13,38 +13,7 @@ class AddUniqueConstraintsOnAllEntities extends Migration
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('expenses', function (Blueprint $table) {
|
||||
$table->unique(['company_id', 'number']);
|
||||
});
|
||||
|
||||
Schema::table('tasks', function (Blueprint $table) {
|
||||
$table->unique(['company_id', 'number']);
|
||||
});
|
||||
|
||||
Schema::table('vendors', function (Blueprint $table) {
|
||||
$table->unique(['company_id', 'number']);
|
||||
});
|
||||
|
||||
Schema::table('payments', function (Blueprint $table) {
|
||||
$table->unique(['company_id', 'number']);
|
||||
});
|
||||
|
||||
Schema::table('projects', function (Blueprint $table) {
|
||||
$table->unique(['company_id', 'number']);
|
||||
});
|
||||
|
||||
Schema::table('clients', function (Blueprint $table) {
|
||||
$table->unique(['company_id', 'number']);
|
||||
});
|
||||
|
||||
Schema::table('recurring_invoices', function (Blueprint $table) {
|
||||
$table->string('number')->change();
|
||||
$table->unique(['company_id', 'number']);
|
||||
});
|
||||
|
||||
Schema::table('recurring_invoice_invitations', function (Blueprint $table) {
|
||||
$table->unique(['client_contact_id', 'recurring_invoice_id'],'recur_invoice_client_unique');
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user