initial commit
This commit is contained in:
commit
3f64f4a49a
221 files changed
+26665
No files matched your search
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Migrations;
|
||||
|
||||
use Rsgrinko\Proton\Database\Migration;
|
||||
use Rsgrinko\Proton\Database\Schema\Blueprint;
|
||||
|
||||
/**
|
||||
* Таблица заметок — демонстрационный раздел. Удаляется вместе с app/Models/Note.php,
|
||||
* контроллерами заметок, их маршрутами и шаблонами.
|
||||
*/
|
||||
final class CreateNotes extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
$this->create('notes', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
// Владелец: по нему работает область видимости — свои заметки видно,
|
||||
// чужие для обычного пользователя не существуют
|
||||
$table->foreignId('user_id');
|
||||
$table->string('title', 191);
|
||||
$table->text('body')->nullable();
|
||||
$table->string('slug', 191)->default('');
|
||||
$table->integer('pinned')->default(0);
|
||||
$table->string('file_path', 255)->default('');
|
||||
$table->string('file_name', 191)->default('');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->index('idx_notes_title', 'title');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
$this->drop('notes');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user