See CreateTableBuilder.addForeignKeyConstraint
Unlike CreateTableBuilder.addForeignKeyConstraint this method returns
the constraint builder and doesn't take a callback as the last argument. This
is because you can only add one column per ALTER TABLE
query.
This can be used to add index to table.
db.schema.alterTable('person')
.addIndex('person_email_index')
.column('email')
.unique()
.execute()
The generated SQL (MySQL):
alter table `person` add unique index `person_email_index` (`email`)
Creates an alter table modify column
query. The modify column
statement
is only implemeted by MySQL and oracle AFAIK. On other databases you
should use the alterColumn
method.
This builder can be used to create a
alter table
query.