Home
DevCentral
Search
Configure Global Search
Log In
Transactions
D379
Change Details
Change Details
Old
New
Diff
```name=Migrate test $ php artisan migrate Migrated: 2016_05_21_224200_set_users_table_auto_increment $ php artisan tinker >>> DB::select("SHOW CREATE TABLE users"); => [ {#698 +"Table": "users" +"Create Table": """ CREATE TABLE `users` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `username` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `fullname` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `password` varchar(60) COLLATE utf8_unicode_ci NOT NULL, `remember_token` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`), UNIQUE KEY `users_email_unique` (`email`) ) ENGINE=InnoDB AUTO_INCREMENT=1000000000 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci""" } ] ``` ```name=Rollback test $ composer dump-autoload $ php artisan migrate:rollback Rolled back: 2016_05_21_224200_set_users_table_auto_increment $ php artisan tinker >>> DB::select("SHOW CREATE TABLE users"); => [ {#696 +"Table": "users" +"Create Table": """ CREATE TABLE `users` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `username` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `fullname` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `password` varchar(60) COLLATE utf8_unicode_ci NOT NULL, `remember_token` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`), UNIQUE KEY `users_email_unique` (`email`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci""" } ] ```
- `php artisan migrate` - Ensure auto increment value is now gigantic - Rollback - Ensure auto increment value is the last user id value + 1.
```name=M
- `php artisan m
igra
te test
te`
$ php artisan migrate
- Ensure auto increment value is now gigantic
Migrated: 2016_05_21_224200_set_users_table_auto_increment
- Rollback
$ php artisan tinker >>> DB::select("SHOW CREATE TABLE users"); => [ {#698 +"Table": "users" +"Create Table": """ CREATE TABLE `users` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `username` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `fullname` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `password` varchar(60) COLLATE utf8_unicode_ci NOT NULL, `remember_token` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`), UNIQUE KEY `users_email_unique` (`email`) ) ENGINE=InnoDB AUTO_INCREMENT=1000000000 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci""" } ] ``` ```name=Rollback test $ composer dump-autoload $ php artisan migrate:rollback Rolled back: 2016_05_21_224200_set_users_table_auto_increment $ php artisan tinker >>> DB::select("SHOW CREATE TABLE users"); => [ {#696 +"Table": "users" +"Create Table": """ CREATE TABLE `users` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `username` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `fullname` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `email` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `password` varchar(60) COLLATE utf8_unicode_ci NOT NULL, `remember_token` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`id`), UNIQUE KEY `users_email_unique` (`email`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci""" } ] ```
- Ensure auto increment value is the last user id value + 1.
Continue