Commit 5fa98e55 authored by Nicolas Widart's avatar Nicolas Widart

Adding migrations

parent 576e7aee
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateFilesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('files', function(Blueprint $table)
{
$table->increments('id');
$table->string('filename');
$table->string('path');
$table->string('extension');
$table->string('mimetype');
$table->string('width');
$table->string('height');
$table->string('filesize');
$table->string('folder_id')->unsigned();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('files');
}
}
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateFileTranslationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create(
'file_translations',
function (Blueprint $table) {
$table->increments('id');
$table->integer('file_id')->unsigned();
$table->string('locale')->index();
$table->string('description');
$table->string('alt_attribute');
$table->string('keywords');
$table->unique(['file_id', 'locale']);
$table->foreign('file_id')->references('id')->on('files')->onDelete('cascade');
}
);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('file_translations');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment