Datenbank

Schema-Vorschau

Diese Seite zeigt, wie ein typisierter PHP schema blueprint anhand der aktiven Datenbankgrammatik in SQL umgewandelt wird. Es wird kein Befehl gegen die Datenbank ausgeführt.

Modus
alter
Tabelle
_tmp_schema_demo_article
Status
Vorschau ist bereit
Preview only. No SQL was executed.

PHP blueprint

Eingabe
schema.php
$schema->table('_tmp_schema_demo_article', static function (TableBlueprint $table): void {
    $table->string('meta_title', 255)
        ->nullable()
        ->after('title')
        ->comment('Optional SEO meta title.');

    $table->string('meta_description', 500)
        ->nullable()
        ->after('meta_title')
        ->comment('Optional SEO meta description.');

    $table->index('meta_title');
});

Generiertes SQL

Ausgabe
statement-1.sql
ALTER TABLE `_tmp_schema_demo_article` ADD `meta_title` VARCHAR(255) NULL COMMENT 'Optional SEO meta title.' AFTER `title`
statement-2.sql
ALTER TABLE `_tmp_schema_demo_article` ADD `meta_description` VARCHAR(500) NULL COMMENT 'Optional SEO meta description.' AFTER `meta_title`
statement-3.sql
ALTER TABLE `_tmp_schema_demo_article` ADD KEY `index_meta_title` (`meta_title`)