Skip to content

Instantly share code, notes, and snippets.

@tangorri
Last active January 3, 2016 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tangorri/8453429 to your computer and use it in GitHub Desktop.
Save tangorri/8453429 to your computer and use it in GitHub Desktop.
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateUsersTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function(Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('surname');
$table->string('title');
$table->string('phonenumber');
$table->string('mobilephonenumber');
$table->integer('sex', 1);
$table->string('email');
$table->string('email2');
$table->string('email3');
$table->date('birthdate');
$table->string('nationaliy');
$table->integer('retreat_year', 4);
$table->boolean('speaks_french');
$table->boolean('speaks_english');
$table->boolean('speaks_spanish');
$table->boolean('speaks_italian');
$table->string('speaks_other');
$table->string('speaks_other2');
$table->string('comments');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('users');
}
}
[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1075 Incorrect table definition; there
can be only one auto column and it must be defined as a key (SQL: create table `users` (`i
d` int unsigned not null auto_increment primary key, `name` varchar(255) not null, `surnam
e` varchar(255) not null, `title` varchar(255) not null, `phonenumber` varchar(255) not nu
ll, `mobilephonenumber` varchar(255) not null, `sex` int not null auto_increment primary k
ey, `email` varchar(255) not null, `email2` varchar(255) not null, `email3` varchar(255) n
ot null, `birthdate` date not null, `nationaliy` varchar(255) not null, `retreatyear` int
not null auto_increment primary key, `speaks_french` tinyint(1) not null, `speaks_english`
tinyint(1) not null, `speaks_spanish` tinyint(1) not null, `speaks_italian` tinyint(1) no
t null, `speaks_other` varchar(255) not null, `speaks_other2` varchar(255) not null, `comm
ents` varchar(255) not null, `created_at` timestamp default 0 not null, `updated_at` times
tamp default 0 not null) default character set utf8 collate utf8_unicode_ci)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment