Creating Table Constraints
index
schema.create( "users", function( table ) {
table.string( "first_name" );
table.string( "last_name" );
table.index( [ "first_name", "last_name" ], "idx_users_full_name" );
} );CREATE TABLE `users` (
`first_name` VARCHAR(255) NOT NULL,
`last_name` VARCHAR(255) NOT NULL,
INDEX `idx_users_full_name` (`first_name`, `last_name`)
)foreignKey
primaryKey
unique
Was this helpful?