osb/database/migrations/0290-create_account_provider.php

95 lines
3.0 KiB
PHP
Raw Normal View History

<?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()
{
2024-06-21 07:43:32 +00:00
Schema::create('account__provider', function (Blueprint $table)
{
$table->id();
$table->timestamps();
$table->integer('site_id')->unsigned();
$table->string('ref');
$table->integer('synctoken');
$table->integer('account_id')->unsigned();
$table->foreign(['account_id','site_id'])->references(['id','site_id'])->on('accounts');
$table->integer('provider_oauth_id')->unsigned();
$table->foreign(['provider_oauth_id','site_id'])->references(['id','site_id'])->on('provider_oauth');
});
Schema::create('invoice__provider', function (Blueprint $table)
{
$table->timestamps();
$table->integer('invoice_id')->unsigned();
$table->integer('provider_oauth_id')->unsigned();
$table->integer('site_id')->unsigned();
$table->string('ref');
$table->integer('synctoken');
$table->foreign(['invoice_id','site_id'])->references(['id','site_id'])->on('invoices');
$table->foreign(['provider_oauth_id','site_id'])->references(['id','site_id'])->on('provider_oauth');
});
2024-06-21 07:43:32 +00:00
Schema::create('product__provider', function (Blueprint $table)
{
$table->integer('product_id')->unsigned();
$table->integer('provider_oauth_id')->unsigned();
$table->integer('site_id')->unsigned();
$table->string('ref');
$table->foreign(['product_id','site_id'])->references(['id','site_id'])->on('products');
$table->foreign(['provider_oauth_id','site_id'])->references(['id','site_id'])->on('provider_oauth');
});
2024-06-21 07:43:32 +00:00
Schema::create('tax__provider', function (Blueprint $table)
{
$table->timestamps();
$table->integer('tax_id')->unsigned();
$table->integer('provider_oauth_id')->unsigned();
$table->integer('site_id')->unsigned();
$table->string('ref');
$table->integer('synctoken');
$table->foreign(['tax_id'])->references(['id'])->on('taxes');
$table->foreign(['provider_oauth_id','site_id'])->references(['id','site_id'])->on('provider_oauth');
});
2024-06-21 07:43:32 +00:00
Schema::create('payment__provider', function (Blueprint $table)
{
$table->timestamps();
$table->integer('payment_id')->unsigned();
$table->integer('provider_oauth_id')->unsigned();
$table->integer('site_id')->unsigned();
$table->string('ref');
$table->integer('synctoken');
$table->foreign(['payment_id','site_id'])->references(['id','site_id'])->on('payments');
$table->foreign(['provider_oauth_id','site_id'])->references(['id','site_id'])->on('provider_oauth');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
2024-06-21 07:43:32 +00:00
Schema::dropIfExists('payment__provider');
Schema::dropIfExists('tax__provider');
Schema::dropIfExists('product__provider');
Schema::dropIfExists('invoice__provider');
2024-06-21 07:43:32 +00:00
Schema::dropIfExists('account__provider');
}
2024-06-21 07:43:32 +00:00
};