drop table if exists test.foobar; create table test.foobar ( foobar_id bigint unsigned not null auto_increment, modified TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, primary key (foobar_id) ); drop table if exists test.foobar2; create table test.foobar2 ( foobar2_id bigint unsigned not null auto_increment, foobar_id bigint unsigned not null , modified TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, primary key (foobar2_id), CONSTRAINT `fk_foobar` FOREIGN KEY (`foobar_id` ) REFERENCES test.foobar (foobar_id ) ON DELETE CASCADE ON UPDATE CASCADE ); insert into test.foobar (foobar_id) VALUES (2); insert into test.foobar2 (foobar_id) VALUES ( last_insert_id()); insert into test.foobar (foobar_id) VALUES (18446744073709551610); insert into test.foobar2 (foobar_id) VALUES (last_insert_id());