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