create table snippet (
snippet_id int not null auto_increment primary key,
created_by int not null,
name text,
description text,
type int not null,
language int not null,
license text not null,
category int not null
);

create index idx_snippet_language on snippet(language);
create index idx_snippet_category on snippet(category);


create table snippet_version (
snippet_version_id int not null auto_increment primary key,
snippet_id int not null,
changes text,
version text,
submitted_by int not null,
date int not null,
code text
);

create index idx_snippet_version_snippet_id on snippet_version(snippet_id);


create table snippet_package (
snippet_package_id int not null auto_increment primary key,
created_by int not null,
name text,
description text,
category int not null,
language int not null
);

create index idx_snippet_package_language on snippet_package(language);
create index idx_snippet_package_category on snippet_package(category);


create table snippet_package_version (
snippet_package_version_id int not null auto_increment primary key,
snippet_package_id int not null,
changes text,
version text,
submitted_by int not null,
date int not null
);

create index idx_snippet_package_version_pkg_id on snippet_package_version(snippet_package_id);

create table snippet_package_item (
snippet_package_item_id int not null auto_increment primary key,
snippet_package_version_id int not null,
snippet_version_id int not null
);

create index idx_snippet_package_item_pkg_ver on snippet_package_item(snippet_package_version_id);


browse for a snippet
	-by language & type (script vs. function)

create a new snippet
	-enter snippet description
	-enter the code for the first version

add a new snippet version
	-browse for a snippet
	-submit new code / changes / version #

create a snippet set
	-enter the description
	-add snippets to it


update bug set submitted_by=858 where submitted_by=4;
update bug set assigned_to=858 where assigned_to=4;
update bug_history set mod_by=858 where mod_by=4;
update project_assigned_to set assigned_to_id=858 where assigned_to_id=4;
update project_task set created_by=858 where created_by=4;
update project_history set mod_by=858 where mod_by=4;

