v2 first commit

This commit is contained in:
denisdulici
2019-11-16 10:21:14 +03:00
parent 5b23e9c2c4
commit 6d50fa8442
3075 changed files with 3451681 additions and 65594 deletions

View File

@ -14,7 +14,7 @@ class CreateCompaniesTable extends Migration
{
Schema::create('companies', function (Blueprint $table) {
$table->increments('id');
$table->string('domain');
$table->string('domain')->nullable();
$table->boolean('enabled')->default(1);
$table->timestamps();
$table->softDeletes();

View File

@ -1,13 +1,14 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use App\Models\Model;
use App\Models\Company\Company;
use App\Abstracts\Model;
use App\Models\Common\Company;
use App\Models\Expense\Bill;
use App\Models\Expense\BillItem;
use App\Models\Expense\BillTotal;
use App\Models\Setting\Tax;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateBillTotalsTable extends Migration
{

View File

@ -1,13 +1,13 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use App\Models\Model;
use App\Models\Company\Company;
use App\Abstracts\Model;
use App\Models\Common\Company;
use App\Models\Income\Invoice;
use App\Models\Income\InvoiceItem;
use App\Models\Income\InvoiceTotal;
use App\Models\Setting\Tax;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateInvoiceTotalsTable extends Migration
{

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
class AddFooterColumnInvoicesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('invoices', function ($table) {
$table->text('footer')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('invoices', function ($table) {
$table->dropColumn('footer');
});
}
}

View File

@ -0,0 +1,76 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateContactsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('contacts', function (Blueprint $table) {
$table->increments('id');
$table->integer('company_id');
$table->string('type');
$table->string('name');
$table->string('email')->nullable();
$table->integer('user_id')->nullable();
$table->string('tax_number')->nullable();
$table->string('phone')->nullable();
$table->text('address')->nullable();
$table->string('website')->nullable();
$table->string('currency_code', 3);
$table->boolean('enabled');
$table->string('reference')->nullable();
$table->timestamps();
$table->softDeletes();
$table->index(['company_id', 'type']);
$table->unique(['company_id', 'type', 'email', 'deleted_at']);
});
$rename_bills = [
'vendor_id' => 'contact_id',
'vendor_name' => 'contact_name',
'vendor_email' => 'contact_email',
'vendor_tax_number' => 'contact_tax_number',
'vendor_phone' => 'contact_phone',
'vendor_address' => 'contact_address',
];
foreach ($rename_bills as $from => $to) {
Schema::table('bills', function (Blueprint $table) use ($from, $to) {
$table->renameColumn($from, $to);
});
}
$rename_invoices = [
'customer_id' => 'contact_id',
'customer_name' => 'contact_name',
'customer_email' => 'contact_email',
'customer_tax_number' => 'contact_tax_number',
'customer_phone' => 'contact_phone',
'customer_address' => 'contact_address',
];
foreach ($rename_invoices as $from => $to) {
Schema::table('invoices', function (Blueprint $table) use ($from, $to) {
$table->renameColumn($from, $to);
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('contacts');
}
}

View File

@ -0,0 +1,67 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateDashboardsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('dashboards', function (Blueprint $table) {
$table->increments('id');
$table->integer('company_id');
$table->integer('user_id');
$table->string('name');
$table->boolean('enabled')->default(1);
$table->timestamps();
$table->softDeletes();
$table->index(['company_id']);
});
Schema::create('dashboard_widgets', function (Blueprint $table) {
$table->increments('id');
$table->integer('company_id');
$table->integer('user_id');
$table->integer('dashboard_id');
$table->integer('widget_id');
$table->string('name');
$table->text('settings')->nullable();
$table->integer('sort')->default(0);
$table->timestamps();
$table->softDeletes();
$table->index(['company_id']);
});
Schema::create('widgets', function (Blueprint $table) {
$table->increments('id');
$table->integer('company_id');
$table->string('name');
$table->string('alias');
$table->text('settings')->nullable();
$table->boolean('enabled')->default(1);
$table->timestamps();
$table->softDeletes();
$table->index(['company_id', 'alias']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('dashboards');
Schema::drop('dashboard_widgets');
Schema::drop('widgets');
}
}

View File

@ -0,0 +1,40 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateEmailTemplatesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('email_templates', function (Blueprint $table) {
$table->increments('id');
$table->integer('company_id');
$table->string('alias');
$table->string('subject');
$table->text('body');
$table->text('params')->nullable();
$table->timestamps();
$table->softDeletes();
$table->index('company_id');
$table->unique(['company_id', 'alias', 'deleted_at']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('email_templates');
}
}

View File

@ -0,0 +1,53 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateFirewallTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('firewall_ips', function (Blueprint $table) {
$table->increments('id');
$table->string('ip');
$table->integer('log_id')->nullable();
$table->boolean('blocked')->default(1);
$table->timestamps();
$table->softDeletes();
$table->index('ip');
$table->unique(['ip', 'deleted_at']);
});
Schema::create('firewall_logs', function (Blueprint $table) {
$table->increments('id');
$table->string('ip');
$table->string('level')->default('medium');
$table->string('middleware');
$table->integer('user_id')->nullable();
$table->string('url')->nullable();
$table->string('referrer')->nullable();
$table->text('request')->nullable();
$table->timestamps();
$table->softDeletes();
$table->index('ip');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('firewall_ips');
Schema::drop('firewall_logs');
}
}

View File

@ -0,0 +1,43 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateReportsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('reports', function (Blueprint $table) {
$table->increments('id');
$table->integer('company_id');
$table->string('name');
$table->text('description');
$table->string('class');
$table->string('group');
$table->string('period');
$table->string('basis');
$table->string('chart');
$table->boolean('enabled');
$table->timestamps();
$table->softDeletes();
$table->index('company_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('reports');
}
}

View File

@ -0,0 +1,56 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateTransactionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('transactions', function (Blueprint $table) {
$table->increments('id');
$table->integer('company_id');
$table->string('type');
$table->integer('account_id');
$table->dateTime('paid_at');
$table->double('amount', 15, 4);
$table->string('currency_code', 3);
$table->double('currency_rate', 15, 8);
$table->integer('document_id')->nullable();
$table->integer('contact_id')->nullable();
$table->text('description')->nullable();
$table->integer('category_id');
$table->string('payment_method');
$table->string('reference')->nullable();
$table->integer('parent_id')->default(0);
$table->boolean('reconciled')->default(0);
$table->timestamps();
$table->softDeletes();
$table->index(['company_id', 'type']);
});
Schema::table('transfers', function (Blueprint $table) {
$table->renameColumn('payment_id', 'expense_transaction_id');
});
Schema::table('transfers', function (Blueprint $table) {
$table->renameColumn('revenue_id', 'income_transaction_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('transactions');
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class ModifyDomainColumnCompaniesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('companies', function (Blueprint $table) {
$table->string('domain')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('companies', function (Blueprint $table) {
$table->string('domain')->change();
});
}
}

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class ModifyStatusColumnModulesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('modules', function (Blueprint $table) {
$table->renameColumn('status', 'enabled');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('modules', function (Blueprint $table) {
$table->renameColumn('enabled', 'status');
});
}
}