osb/database/migrations/0050-create_sites.php

46 lines
954 B
PHP
Raw Permalink Normal View History

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('sites', function(Blueprint $table)
{
$table->id();
$table->integer('site_id')->unsigned();
$table->boolean('active')->default(false);
$table->integer('admin_id')->unsigned()->nullable();
$table->string('url',256)->unique();
$table->integer('country_id');
$table->integer('currency_id');
$table->foreign(['country_id','currency_id'])->references(['id','currency_id'])->on('countries');
$table->integer('language_id');
$table->foreign('language_id')->references('id')->on('languages');
$table->unique(['id','site_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('sites');
}
};