drop table if exists planet;
drop table if exists system;

create table system
(
	sid int not null auto_increment,
	name varchar(20) not null,
	position varchar(10) not null,
	x int not null,
	y int not null,
	stype varchar(20) not null,
	extra varchar(40),
	primary key (sid)
) TYPE=innodb;

create table planet
(
	pid int not null auto_increment,
	sid int not null,
	pname varchar(30) not null,
	ptype varchar(30) not null,
	tectonics int not null,
	weather int not null,
	temp int not null,
	gravity int not null,
	bio int not null,
	bio_danger int not null,
	mineral int not null,
	min_common int not null,
	min_corrosive int not null,
	min_base int not null,
	min_noble int not null,
	min_rare int not null,
	min_precious int not null,
	min_radio int not null,
	min_exotic int not null,
	primary key (pid),
	index planet_sid (sid),
	foreign key fk_sid (sid) references system (sid)
) TYPE=innodb;
