use drbulb;

drop table items;
drop table grp;
drop table images;

create table items
(
	id	INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
 	grp_id	int,	
	name	varchar(50),
	short_descr varchar(1024),
	long_descr varchar(1024),
	edition int,
	price	float,
	foreign key(grp_id) references grp(id)
);

create table grp
(
	id	int not null auto_increment primary key,
	name	varchar(50)
);

create table images
(
	id	int not null auto_increment primary key,
	path	varchar(1024),		
	thumb	varchar(1024),		
	name	varchar(50),
	item_id		int,		
	foreign key(item_id) references items(id)
);

#insert into grp (name) values (1,"Alchemy");
insert into grp (id,name) values (2,"Lamps");
insert into grp (id,name) values (3,"Bulbs");

\. bulbs-items.sql
\. bulbs-images.sql
\. lamps-items.sql
\. lamps-images.sql

