2024-06-21 07:43:32 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
|
|
|
|
return new class extends Migration
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Run the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function up()
|
|
|
|
{
|
|
|
|
Schema::create('services', function(Blueprint $table)
|
|
|
|
{
|
|
|
|
$table->id();
|
|
|
|
$table->timestamps();
|
|
|
|
$table->integer('site_id')->unsigned();
|
|
|
|
$table->boolean('active')->default(false);
|
|
|
|
|
|
|
|
$table->boolean('suspend_billing')->default(false);
|
|
|
|
$table->boolean('external_billing')->default(false);
|
|
|
|
|
|
|
|
$table->float('price', 10, 0)->nullable();
|
|
|
|
$table->float('price_override', 10, 0)->nullable();
|
|
|
|
$table->boolean('taxable')->default(true);
|
|
|
|
|
|
|
|
$table->integer('recur_schedule')->nullable();
|
|
|
|
$table->text('prod_attr')->nullable();
|
|
|
|
|
|
|
|
$table->string('model')->nullable();
|
2024-07-07 05:02:02 +00:00
|
|
|
$table->string('order_status');
|
2024-06-21 07:43:32 +00:00
|
|
|
$table->text('order_info')->nullable();
|
|
|
|
|
|
|
|
$table->date('invoice_last_at')->nullable();
|
|
|
|
$table->date('invoice_next_at')->nullable();
|
|
|
|
$table->date('start_at')->nullable();
|
|
|
|
$table->date('stop_at')->nullable();
|
|
|
|
$table->integer('account_billing_id')->unsigned()->nullable(); // @todo To remove?
|
|
|
|
|
|
|
|
$table->integer('account_id')->unsigned();
|
|
|
|
$table->foreign(['account_id','site_id'])->references(['id','site_id'])->on('accounts');
|
|
|
|
|
|
|
|
$table->integer('ordered_by')->unsigned()->nullable();
|
|
|
|
$table->foreign(['ordered_by','site_id'])->references(['id','site_id'])->on('users');
|
|
|
|
|
|
|
|
$table->integer('product_id')->unsigned();
|
|
|
|
$table->foreign(['product_id','site_id'])->references(['id','site_id'])->on('products');
|
|
|
|
|
|
|
|
$table->unique(['id','site_id']);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reverse the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function down()
|
|
|
|
{
|
|
|
|
Schema::drop('services');
|
|
|
|
}
|
|
|
|
};
|