drop database if exists `shorturl`; create database if not exists `shorturl`; use `shorturl`; SET FOREIGN_KEY_CHECKS=0; drop table if exists `last_clean`; create table `last_clean` ( `clean_date` datetime ) engine=innodb; drop table if exists `link`; create table `link` ( `id` int(11) unsigned not null auto_increment, `link` int(11) not null, primary key(`id`), unique index `idx_link`(`link`) ) engine=innodb; drop table if exists `urls`; create table `urls` ( `id` int(11) unsigned not null auto_increment, `url` text, `post_date` datetime, primary key(`id`), index `idx_url`(`url`), constraint `rel` foreign key (`id`) references `link`(`id`) on delete no action on update no action ) engine=innodb; SET FOREIGN_KEY_CHECKS=1;