migrate add

This commit is contained in:
Kerim 2023-04-18 09:19:31 +05:00
parent 5c9fd90aa0
commit f74fc59e70
4 changed files with 92 additions and 0 deletions

View File

@ -0,0 +1,23 @@
<?php namespace Tps\Tps\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableCreateTpsTpsTestCategories extends Migration
{
public function up()
{
Schema::create('tps_tps_test_categories', function($table)
{
$table->engine = 'InnoDB';
$table->increments('id')->unsigned();
$table->string('title');
$table->text('description');
});
}
public function down()
{
Schema::dropIfExists('tps_tps_test_categories');
}
}

View File

@ -0,0 +1,23 @@
<?php namespace Tps\Tps\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableCreateTpsTpsTestQuestions extends Migration
{
public function up()
{
Schema::create('tps_tps_test_questions', function($table)
{
$table->engine = 'InnoDB';
$table->increments('id')->unsigned();
$table->string('title');
$table->text('description')->nullable();
});
}
public function down()
{
Schema::dropIfExists('tps_tps_test_questions');
}
}

View File

@ -0,0 +1,29 @@
<?php namespace Tps\Tps\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableUpdateTpsTpsTestQuestions extends Migration
{
public function up()
{
Schema::table('tps_tps_test_questions', function($table)
{
$table->integer('test_id');
$table->string('question');
$table->text('answers');
$table->dropColumn('title');
});
}
public function down()
{
Schema::table('tps_tps_test_questions', function($table)
{
$table->dropColumn('test_id');
$table->dropColumn('question');
$table->dropColumn('answers');
$table->string('title', 191);
});
}
}

View File

@ -0,0 +1,17 @@
<?php namespace Tps\Tps\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableUpdateTpsTpsTests extends Migration
{
public function up()
{
Schema::rename('tps_tps_test_categories', 'tps_tps_tests');
}
public function down()
{
Schema::rename('tps_tps_tests', 'tps_tps_test_categories');
}
}