This commit is contained in:
2024-07-29 15:57:20 +03:00
parent 95f56a04d3
commit 200763725e
34 changed files with 936 additions and 72 deletions

View File

@ -0,0 +1,37 @@
<?php
namespace _migrations;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Capsule\Manager;
class AnswerMigration extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public static function up(): void
{
Manager::schema()->create('answer', function (Blueprint $table) {
$table->increments('id');
$table->string('answer', 255)->nullable(false);
$table->integer('user_id');
$table->integer('question_id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public static function down(): void
{
Manager::schema()->dropIfExists('user');
}
}

View File

@ -0,0 +1,36 @@
<?php
namespace _migrations;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Capsule\Manager;
class PostMigration extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public static function up(): void
{
Manager::schema()->create('post', function (Blueprint $table) {
$table->increments('id');
$table->text('content')->nullable(false);
$table->integer('user_id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public static function down(): void
{
Manager::schema()->dropIfExists('user');
}
}

View File

@ -0,0 +1,36 @@
<?php
namespace _migrations;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Capsule\Manager;
class QuestionMigration extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public static function up(): void
{
Manager::schema()->create('question', function (Blueprint $table) {
$table->increments('id');
$table->string('question', 255)->nullable(false);
$table->integer('user_id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public static function down(): void
{
Manager::schema()->dropIfExists('user');
}
}

View File

@ -0,0 +1,37 @@
<?php
namespace _migrations;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Capsule\Manager;
class UserMigration extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public static function up(): void
{
Manager::schema()->create('user', function (Blueprint $table) {
$table->increments('id');
$table->string('username', 255)->nullable(false);
$table->string('email', 255);
$table->string('password_hash', 255);
$table->integer('role')->default(1);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public static function down(): void
{
Manager::schema()->dropIfExists('user');
}
}

28
_migrations/stubs/blank.stub Executable file
View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class DummyClass extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
//
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

32
_migrations/stubs/create.stub Executable file
View File

@ -0,0 +1,32 @@
<?php
use core\App;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class DummyClass extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
App::$db->schema->create('DummyTable', function (Blueprint $table) {
$table->bigIncrements('id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
App::$db->schema->dropIfExists('DummyTable');
}
}

33
_migrations/stubs/update.stub Executable file
View File

@ -0,0 +1,33 @@
<?php
use core\App;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class DummyClass extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
App::$db->schema->table('DummyTable', function (Blueprint $table) {
//
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
App::$db->schema->table('DummyTable', function (Blueprint $table) {
//
});
}
}