Skip to content

Commit

Permalink
Added migrations for galleries translations
Browse files Browse the repository at this point in the history
  • Loading branch information
liutauraskavaliauskas committed Mar 22, 2017
1 parent 35fbe19 commit 63bb573
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateHcGalleriesTranslationsTable extends Migration {

/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('hc_galleries_translations', function(Blueprint $table)
{
$table->integer('count', true);
$table->string('id', 36)->unique('id_UNIQUE');
$table->timestamps();
$table->softDeletes();
$table->string('record_id', 36)->index('fk_hc_galleries_translations_hc_galleries1_idx');
$table->string('language_code', 36)->index('fk_hc_galleries_translations_hc_languages1_idx');
$table->string('title');
$table->string('slug')->index('fk_hc_galleries_translations_slug');
$table->text('content', 65535)->nullable();
$table->string('location')->nullable();
});
}


/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('hc_galleries_translations');
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class AddForeignKeysToHcGalleriesTranslationsTable extends Migration {

/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('hc_galleries_translations', function(Blueprint $table)
{
$table->foreign('record_id', 'fk_hc_galleries_translations_hc_galleries1')->references('id')->on('hc_galleries')->onUpdate('NO ACTION')->onDelete('NO ACTION');
$table->foreign('language_code', 'fk_hc_galleries_translations_hc_languages1')->references('id')->on('hc_languages')->onUpdate('NO ACTION')->onDelete('NO ACTION');
});
}


/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('hc_galleries_translations', function(Blueprint $table)
{
$table->dropForeign('fk_hc_galleries_translations_hc_galleries1');
$table->dropForeign('fk_hc_galleries_translations_hc_languages1');
});
}

}

0 comments on commit 63bb573

Please sign in to comment.