Baza danych
Podgląd schematu
Ta strona pokazuje, jak typowany PHP schema blueprint jest konwertowany do SQL według aktywnej gramatyki bazy danych. Żadne polecenie nie jest wykonywane na bazie danych.
Tryb
create
Tabela
_tmp_schema_demo_article
Stan
Podgląd jest gotowyPreview only. No SQL was executed.
PHP blueprint
Wejście$schema->create('_tmp_schema_demo_article', static function (TableBlueprint $table): void {
$table->engine('InnoDB');
$table->charset('utf8mb4');
$table->collation('utf8mb4_unicode_ci');
$table->comment('Demo article table generated by Schema preview.');
$table->id('article_id')
->comment('Primary article identifier.');
$table->string('title', 255)
->comment('Public article title.');
$table->string('slug', 255)
->unique()
->comment('SEO friendly unique article URL slug.');
$table->integer('article_status')
->default(1)
->comment('Article status flag. 1 = published, 0 = hidden.');
$table->datetime('created_at')
->nullable()
->comment('Creation timestamp.');
$table->datetime('updated_at')
->nullable()
->comment('Last update timestamp.');
$table->index('article_status');
}, ifNotExists: true);
Wygenerowany SQL
WyjścieCREATE TABLE IF NOT EXISTS `_tmp_schema_demo_article` (
`article_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Primary article identifier.',
`title` VARCHAR(255) NOT NULL COMMENT 'Public article title.',
`slug` VARCHAR(255) NOT NULL COMMENT 'SEO friendly unique article URL slug.',
`article_status` INT NOT NULL DEFAULT 1 COMMENT 'Article status flag. 1 = published, 0 = hidden.',
`created_at` DATETIME NULL COMMENT 'Creation timestamp.',
`updated_at` DATETIME NULL COMMENT 'Last update timestamp.',
PRIMARY KEY (`article_id`),
UNIQUE KEY `unique_slug` (`slug`),
KEY `index_article_status` (`article_status`)
) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'Demo article table generated by Schema preview.'