```
  CREATE TABLE IF NOT EXISTS `users` (
  `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  `first_name` varchar(50) NOT NULL,
  `last_name` varchar(50) NOT NULL,
  `email` varchar(150) NOT NULL,
  `is_email_verify` int(11) DEFAULT '0',
  `phone_no` varchar(15) NOT NULL,
  `password` varchar(255) NOT NULL,
  `status` varchar(10) NOT NULL,
  `role` varchar(50) NOT NULL DEFAULT 'employee',
  `photo` varchar(150) NOT NULL,
  `group_id` int(11) DEFAULT '0',
  `shift_id` int(11) NOT NULL DEFAULT '0',
  `shift_date` date NOT NULL,
  `created` datetime NOT NULL,
  `updated` datetime NOT NULL,
  `first_off` varchar(15) NOT NULL,
  `second_off` varchar(15) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;

```

and 

```
CREATE TABLE IF NOT EXISTS `project_maps` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `project_id` int(11) UNSIGNED NOT NULL,
  `user_id` int(11) UNSIGNED DEFAULT NULL,
  `group_id` int(11) UNSIGNED DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_project_id` (`project_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
COMMIT;

```

I am trying to map project\_map.user\_id to user table.. by using 

```
ALTER TABLE users ADD CONSTRAINT fk_project_users FOREIGN KEY (id) REFERENCES project_maps(user_id);

```

Produces an error "#1215 - Cannot add foreign key constraint" can any one explain why ?