<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>db/pgsql_data/item_recipe_material.sql</filename>
    </added>
    <added>
      <filename>db/pgsql_data/item_recipe_type.sql</filename>
    </added>
    <added>
      <filename>resources/items/food/apple_pie.png</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -22,8 +22,8 @@ SELECT pg_catalog.setval('cron_tab_cron_tab_id_seq', 2, true);
 --
 
 COPY cron_tab (cron_tab_id, cron_class, cron_frequency_seconds, unixtime_next_run, enabled) FROM stdin;
-1	Job_RestockShops	3600	1208734668	Y
-2	Job_UserOnline	300	1208731717	Y
+1	Job_RestockShops	3600	1247720078	Y
+2	Job_UserOnline	300	1247719854	Y
 \.
 
 </diff>
      <filename>db/pgsql_data/cron_tab.sql</filename>
    </modified>
    <modified>
      <diff>@@ -14,17 +14,18 @@ SET search_path = public, pg_catalog;
 -- Name: item_class_item_class_id_seq; Type: SEQUENCE SET; Schema: public; Owner: kitto
 --
 
-SELECT pg_catalog.setval('item_class_item_class_id_seq', 3, true);
+SELECT pg_catalog.setval('item_class_item_class_id_seq', 4, true);
 
 
 --
 -- Data for Name: item_class; Type: TABLE DATA; Schema: public; Owner: kitto
 --
 
-COPY item_class (item_class_id, php_class, class_descr, relative_image_dir, verb, one_per_use) FROM stdin;
-1	Food_Item	Food	food	feed	N
-2	Toy_Item	Toy	toys	play with	N
-3	Paint_Item	Paint	paints	paint	Y
+COPY item_class (item_class_id, php_class, class_descr, relative_image_dir, verb, one_per_use, normal_inventory_display) FROM stdin;
+1	Food_Item	Food	food	feed	N	Y
+2	Toy_Item	Toy	toys	play with	N	Y
+3	Paint_Item	Paint	paints	paint	Y	Y
+4	Recipe_Item	Recipe	recipe	creates	N	N
 \.
 
 </diff>
      <filename>db/pgsql_data/item_class.sql</filename>
    </modified>
    <modified>
      <diff>@@ -14,19 +14,21 @@ SET search_path = public, pg_catalog;
 -- Name: item_type_item_type_id_seq; Type: SEQUENCE SET; Schema: public; Owner: kitto
 --
 
-SELECT pg_catalog.setval('item_type_item_type_id_seq', 9, true);
+SELECT pg_catalog.setval('item_type_item_type_id_seq', 11, true);
 
 
 --
 -- Data for Name: item_type; Type: TABLE DATA; Schema: public; Owner: kitto
 --
 
-COPY item_type (item_type_id, item_name, item_descr, item_class_id, happiness_bonus, hunger_bonus, pet_specie_color_id, item_image) FROM stdin;
-1	Red Apple	A delicious, healthy red apple.	1	0	3	0	apple.png
-6	Grubby Bowl	This is an old wooden bowl. Since there is nothing else, your pet will have to amuse itself with this.	2	1	0	0	bowl.png
-7	Red Paintbrush	This will turn your pet red.	3	0	0	1	red.png
-8	Blue Paintbrush	This will turn your pet blue.	3	0	0	1	blue.png
-5	Rozen Paintbrush	&lt;p&gt;The Rozen paintbrush is delicious paint. You must use it~desu!&lt;/p&gt;	3	0	0	3	rozen.png
+COPY item_type (item_type_id, item_name, item_descr, item_class_id, happiness_bonus, hunger_bonus, pet_specie_color_id, item_image, item_recipe_type_id, recipe_created_item_type_id, recipe_batch_quantity, unique_item, transferable_item) FROM stdin;
+1	Red Apple	A delicious, healthy red apple.	1	0	3	0	apple.png	0	0	0	N	Y
+6	Grubby Bowl	This is an old wooden bowl. Since there is nothing else, your pet will have to amuse itself with this.	2	1	0	0	bowl.png	0	0	0	N	Y
+7	Red Paintbrush	This will turn your pet red.	3	0	0	1	red.png	0	0	0	N	Y
+8	Blue Paintbrush	This will turn your pet blue.	3	0	0	1	blue.png	0	0	0	N	Y
+5	Rozen Paintbrush	&lt;p&gt;The Rozen paintbrush is delicious paint. You must use it~desu!&lt;/p&gt;	3	0	0	3	rozen.png	0	0	0	N	Y
+11	Apple Pie	&lt;p&gt;A warm apple pie.&lt;/p&gt;	1	0	5	0	apple_pie.png	0	0	0	N	Y
+10	Apple Pie	&lt;p&gt;A recipe for an apple pie.&lt;/p&gt;	4	0	0	0	recipe_pie.png	1	11	1	Y	N
 \.
 
 </diff>
      <filename>db/pgsql_data/item_type.sql</filename>
    </modified>
    <modified>
      <diff>@@ -14,69 +14,74 @@ SET search_path = public, pg_catalog;
 -- Name: jump_page_jump_page_id_seq; Type: SEQUENCE SET; Schema: public; Owner: kitto
 --
 
-SELECT pg_catalog.setval('jump_page_jump_page_id_seq', 71, true);
+SELECT pg_catalog.setval('jump_page_jump_page_id_seq', 76, true);
 
 
 --
 -- Data for Name: jump_page; Type: TABLE DATA; Schema: public; Owner: kitto
 --
 
-COPY jump_page (jump_page_id, page_title, page_html_title, layout_type, page_slug, access_level, restricted_permission_api_name, php_script, include_tinymce, active) FROM stdin;
-1	Home	Home	deep	home	public		meta/home.php	N	Y
-2	Register	Register	deep	register	public		user/register.php	N	Y
-3	Logoff	Logoff	deep	logoff	user		user/logout.php	N	Y
-4	Login	Login	deep	login	public		user/login.php	N	Y
-14	Profile	Profile	deep	profile	user		user/profile.php	N	Y
-22	Pets	Pets	deep	pets	user		pets/manage.php	N	Y
-23	Pets - Create	Pets - Create	deep	create-pet	user		pets/create.php	N	Y
-24	Pets - Abandon	Pets - Abandon	deep	abandon-pet	user		pets/abandon.php	N	Y
-25	Items	Items	deep	items	user		items/list.php	N	Y
-26	Item - Details	Item - Details	deep	item	user		items/detail.php	N	Y
-27	Shops	Shops	deep	shops	user		shops/list.php	N	Y
-28	Shops - View Stock	Shops - View Stock	deep	shop	user		shops/shop.php	N	Y
-29	Notices	Notices	deep	notice	user		user/notices.php	N	Y
-30	Game Corner	Game Corner	deep	games	user		games/list.php	N	Y
-31	Magic Trick	Magic Trick	deep	magic-game	user		games/magic_game.php	N	Y
-32	Boards	Boards	deep	boards	user		boards/board_list.php	N	Y
-33	Boards	Boards	deep	threads	user		boards/thread_list.php	N	Y
-34	Boards	Boards	deep	thread	user		boards/post_list.php	Y	Y
-35	Boards - Reply	Boards - Reply	deep	thread-reply	user		boards/reply.php	N	Y
-36	Create Thread	Create Thread	deep	new-thread	user		boards/create_thread.php	Y	Y
-37	Forum Moderation	Forum Moderation	deep	forum-admin	restricted	moderate	boards/moderation.php	N	Y
-38	Edit Post	Edit Post	deep	edit-post	user		boards/edit_post.php	Y	Y
-39	Edit Thread	Edit Thread	deep	edit-thread	user		boards/edit_thread.php	N	Y
-40	Preferences	Preferences	deep	preferences	user		user/preferences.php	Y	Y
-41	Pet Profile	Pet Profile	deep	pet	user		pets/profile.php	N	Y
-42	Edit Pet Profile	Edit Pet Profile	deep	edit-pet	user		pets/edit.php	Y	Y
-43	News	News	deep	news	public		news/list.php	N	Y
-44	Messages	Messages	deep	messages	user		messages/list.php	N	Y
-45	Compose Message	Compose Message	deep	write-message	user		messages/write.php	Y	Y
-46	Send Message	Send Message	deep	send-message	user		messages/send.php	N	Y
-47	Read Message	Read Message	deep	message	user		messages/view.php	N	Y
-48	Admin Overview	Admin Overview	deep	admin	restricted	admin_panel	admin/links.php	N	Y
-49	Permission Editor	Permission Editor	deep	admin-permissions	restricted	manage_permissions	admin/permissions/home.php	N	Y
-50	Edit Pet Colors	Edit Pet Colors	deep	admin-pet-colors	restricted	manage_pets	admin/pets/colors/home.php	N	Y
-51	Edit Pet Species	Edit Pet Species	deep	admin-pet-species	restricted	manage_pets	admin/pets/species/home.php	N	Y
-52	User Admin	User Admin	deep	admin-users	restricted	manage_users	admin/user/home.php	Y	Y
-53	Board Admin	Board Admin	deep	admin-boards	restricted	manage_boards	admin/boards/home.php	N	Y
-54	Shop Admin	Shop Admin	deep	admin-shops	restricted	manage_shops	admin/shops/home.php	N	Y
-55	Item Admin	Item Admin	deep	admin-items	restricted	manage_items	admin/items/home.php	N	Y
-56	Permission Editor	Permission Editor	deep	admin-permissions-edit	restricted	manage_permissions	admin/permissions/edit.php	Y	Y
-57	Board Creator	Board Creator	deep	admin-boards-create	restricted	manage_boards	admin/boards/create.php	N	N
-58	Edit Color	Edit Color	deep	admin-pet-colors-edit	restricted	manage_pets	admin/pets/colors/edit.php	N	Y
-59	Edit Specie	Edit Specie	deep	admin-pet-species-edit	restricted	manage_pets	admin/pets/species/edit.php	Y	Y
-60	Pet to Color Mapping	Pet to Color Mapping	deep	admin-pet-specie-colors	restricted	manage_pets	admin/pets/species/color_mapping.php	N	Y
-61	Board Editor	Board Editor	deep	admin-boards-edit	restricted	manage_boards	admin/boards/edit.php	Y	Y
-62	Edit Shop	Edit Shop	deep	admin-shops-edit	restricted	manage_shops	admin/shops/edit.php	Y	Y
-63	Edit Item	Edit Item	deep	admin-items-edit	restricted	manage_items	admin/items/edit.php	Y	Y
-64	New Item	New Item	deep	admin-items-add	restricted	manage_items	admin/items/new.php	N	Y
-65	Edit Restocks	Edit Restocks	deep	admin-restock	restricted	manage_items	admin/items/restock/home.php	N	Y
-66	Edit Restocks	Edit Restocks	deep	admin-restock-edit	restricted	manage_items	admin/items/restock/edit.php	N	Y
-67	Staff	Staff	deep	staff	public		meta/staff.php	N	Y
-68	Reset Password	Reset Password	deep	reset-password	public		user/forgot_password.php	N	Y
-69	Terms and Conditions	Terms and Conditions	deep	terms-and-conditions	public		meta/terms.php	N	Y
-70	Online Users	Online Users	deep	online	public		meta/online.php	N	Y
-71	Search	Search	deep	search	user		meta/search.php	N	Y
+COPY jump_page (jump_page_id, page_title, page_html_title, layout_type, show_layout, page_slug, access_level, restricted_permission_api_name, php_script, include_tinymce, active) FROM stdin;
+1	Home	Home	deep	Y	home	public		meta/home.php	N	Y
+2	Register	Register	deep	Y	register	public		user/register.php	N	Y
+3	Logoff	Logoff	deep	Y	logoff	user		user/logout.php	N	Y
+4	Login	Login	deep	Y	login	public		user/login.php	N	Y
+14	Profile	Profile	deep	Y	profile	user		user/profile.php	N	Y
+22	Pets	Pets	deep	Y	pets	user		pets/manage.php	N	Y
+23	Pets - Create	Pets - Create	deep	Y	create-pet	user		pets/create.php	N	Y
+24	Pets - Abandon	Pets - Abandon	deep	Y	abandon-pet	user		pets/abandon.php	N	Y
+25	Items	Items	deep	Y	items	user		items/list.php	N	Y
+26	Item - Details	Item - Details	deep	Y	item	user		items/detail.php	N	Y
+27	Shops	Shops	deep	Y	shops	user		shops/list.php	N	Y
+28	Shops - View Stock	Shops - View Stock	deep	Y	shop	user		shops/shop.php	N	Y
+29	Notices	Notices	deep	Y	notice	user		user/notices.php	N	Y
+30	Game Corner	Game Corner	deep	Y	games	user		games/list.php	N	Y
+31	Magic Trick	Magic Trick	deep	Y	magic-game	user		games/magic_game.php	N	Y
+32	Boards	Boards	deep	Y	boards	user		boards/board_list.php	N	Y
+33	Boards	Boards	deep	Y	threads	user		boards/thread_list.php	N	Y
+34	Boards	Boards	deep	Y	thread	user		boards/post_list.php	Y	Y
+35	Boards - Reply	Boards - Reply	deep	Y	thread-reply	user		boards/reply.php	N	Y
+36	Create Thread	Create Thread	deep	Y	new-thread	user		boards/create_thread.php	Y	Y
+37	Forum Moderation	Forum Moderation	deep	Y	forum-admin	restricted	moderate	boards/moderation.php	N	Y
+38	Edit Post	Edit Post	deep	Y	edit-post	user		boards/edit_post.php	Y	Y
+39	Edit Thread	Edit Thread	deep	Y	edit-thread	user		boards/edit_thread.php	N	Y
+40	Preferences	Preferences	deep	Y	preferences	user		user/preferences.php	Y	Y
+41	Pet Profile	Pet Profile	deep	Y	pet	user		pets/profile.php	N	Y
+42	Edit Pet Profile	Edit Pet Profile	deep	Y	edit-pet	user		pets/edit.php	Y	Y
+43	News	News	deep	Y	news	public		news/list.php	N	Y
+44	Messages	Messages	deep	Y	messages	user		messages/list.php	N	Y
+45	Compose Message	Compose Message	deep	Y	write-message	user		messages/write.php	Y	Y
+46	Send Message	Send Message	deep	Y	send-message	user		messages/send.php	N	Y
+47	Read Message	Read Message	deep	Y	message	user		messages/view.php	N	Y
+48	Admin Overview	Admin Overview	deep	Y	admin	restricted	admin_panel	admin/links.php	N	Y
+49	Permission Editor	Permission Editor	deep	Y	admin-permissions	restricted	manage_permissions	admin/permissions/home.php	N	Y
+50	Edit Pet Colors	Edit Pet Colors	deep	Y	admin-pet-colors	restricted	manage_pets	admin/pets/colors/home.php	N	Y
+51	Edit Pet Species	Edit Pet Species	deep	Y	admin-pet-species	restricted	manage_pets	admin/pets/species/home.php	N	Y
+52	User Admin	User Admin	deep	Y	admin-users	restricted	manage_users	admin/user/home.php	Y	Y
+53	Board Admin	Board Admin	deep	Y	admin-boards	restricted	manage_boards	admin/boards/home.php	N	Y
+54	Shop Admin	Shop Admin	deep	Y	admin-shops	restricted	manage_shops	admin/shops/home.php	N	Y
+55	Item Admin	Item Admin	deep	Y	admin-items	restricted	manage_items	admin/items/home.php	N	Y
+56	Permission Editor	Permission Editor	deep	Y	admin-permissions-edit	restricted	manage_permissions	admin/permissions/edit.php	Y	Y
+57	Board Creator	Board Creator	deep	Y	admin-boards-create	restricted	manage_boards	admin/boards/create.php	N	N
+58	Edit Color	Edit Color	deep	Y	admin-pet-colors-edit	restricted	manage_pets	admin/pets/colors/edit.php	N	Y
+59	Edit Specie	Edit Specie	deep	Y	admin-pet-species-edit	restricted	manage_pets	admin/pets/species/edit.php	Y	Y
+60	Pet to Color Mapping	Pet to Color Mapping	deep	Y	admin-pet-specie-colors	restricted	manage_pets	admin/pets/species/color_mapping.php	N	Y
+61	Board Editor	Board Editor	deep	Y	admin-boards-edit	restricted	manage_boards	admin/boards/edit.php	Y	Y
+62	Edit Shop	Edit Shop	deep	Y	admin-shops-edit	restricted	manage_shops	admin/shops/edit.php	Y	Y
+63	Edit Item	Edit Item	deep	Y	admin-items-edit	restricted	manage_items	admin/items/edit.php	Y	Y
+64	New Item	New Item	deep	Y	admin-items-add	restricted	manage_items	admin/items/new.php	N	Y
+65	Edit Restocks	Edit Restocks	deep	Y	admin-restock	restricted	manage_items	admin/items/restock/home.php	N	Y
+66	Edit Restocks	Edit Restocks	deep	Y	admin-restock-edit	restricted	manage_items	admin/items/restock/edit.php	N	Y
+67	Staff	Staff	deep	Y	staff	public		meta/staff.php	N	Y
+68	Reset Password	Reset Password	deep	Y	reset-password	public		user/forgot_password.php	N	Y
+69	Terms and Conditions	Terms and Conditions	deep	Y	terms-and-conditions	public		meta/terms.php	N	Y
+70	Online Users	Online Users	deep	Y	online	public		meta/online.php	N	Y
+71	Search	Search	deep	Y	search	user		meta/search.php	N	Y
+72	Manage Recipe Materials	Manage Recipe Materials	deep	Y	admin-recipe	restricted	manage_items	admin/items/recipe_materials.php	N	Y
+73	Add Recipe Materials	Add Recipe Materials	deep	Y	admin-recipe-add	restricted	manage_items	admin/items/recipe_add_material.php	N	Y
+74	Crafting	Crafting	deep	Y	crafting	user		crafting/list.php	N	Y
+75	Crafting	Crafting	deep	Y	craft	user		crafting/recipe.php	N	Y
+76	AJAX Item Search Callback		deep	N	item-search-ajax	user		items/ajax_widget_search.php	N	Y
 \.
 
 </diff>
      <filename>db/pgsql_data/jump_page.sql</filename>
    </modified>
    <modified>
      <diff>@@ -14,7 +14,7 @@ SET search_path = public, pg_catalog;
 -- Name: shop_restock_shop_restock_id_seq; Type: SEQUENCE SET; Schema: public; Owner: kitto
 --
 
-SELECT pg_catalog.setval('shop_restock_shop_restock_id_seq', 6, true);
+SELECT pg_catalog.setval('shop_restock_shop_restock_id_seq', 7, true);
 
 
 --
@@ -22,11 +22,12 @@ SELECT pg_catalog.setval('shop_restock_shop_restock_id_seq', 6, true);
 --
 
 COPY shop_restock (shop_restock_id, shop_id, item_type_id, restock_frequency_seconds, unixtime_next_restock, min_price, max_price, min_quantity, max_quantity, store_quantity_cap) FROM stdin;
-5	1	5	2800	1208733868	1000	5000	1	2	2
-3	1	8	2600	1208733668	50	100	2	5	10
-4	1	7	2600	1208733668	50	100	2	5	10
-2	1	6	1200	1208732268	5	15	5	10	15
-1	1	1	3600	1208734668	1	15	5	10	30
+1	1	1	3600	1247716733	1	15	5	10	30
+5	1	5	2800	1247719278	1000	5000	1	2	2
+3	1	8	2600	1247719078	50	100	2	5	10
+4	1	7	2600	1247719078	50	100	2	5	10
+2	1	6	1200	1247717678	5	15	5	10	15
+7	1	10	3600	1247720078	100	200	1	3	5
 \.
 
 </diff>
      <filename>db/pgsql_data/shop_restock.sql</filename>
    </modified>
    <modified>
      <diff>@@ -147,13 +147,41 @@ CREATE TABLE item_class (
     relative_image_dir character varying(50) NOT NULL,
     verb character varying(30) NOT NULL,
     one_per_use character(1) DEFAULT 'N'::bpchar NOT NULL,
-    CONSTRAINT item_class_one_per_use_check CHECK ((one_per_use = ANY (ARRAY['N'::bpchar, 'Y'::bpchar])))
+    normal_inventory_display character(1) DEFAULT 'Y'::bpchar NOT NULL,
+    CONSTRAINT item_class_one_per_use_check CHECK ((one_per_use = ANY (ARRAY['N'::bpchar, 'Y'::bpchar]))),
+    CONSTRAINT normal_inventory_display CHECK ((normal_inventory_display = ANY (ARRAY['Y'::bpchar, 'N'::bpchar])))
 );
 
 
 ALTER TABLE public.item_class OWNER TO kitto;
 
 --
+-- Name: item_recipe_material; Type: TABLE; Schema: public; Owner: kitto; Tablespace: 
+--
+
+CREATE TABLE item_recipe_material (
+    item_recipe_material_id integer NOT NULL,
+    recipe_item_type_id integer NOT NULL,
+    material_item_type_id integer NOT NULL,
+    material_quantity integer DEFAULT 1 NOT NULL
+);
+
+
+ALTER TABLE public.item_recipe_material OWNER TO kitto;
+
+--
+-- Name: item_recipe_type; Type: TABLE; Schema: public; Owner: kitto; Tablespace: 
+--
+
+CREATE TABLE item_recipe_type (
+    item_recipe_type_id integer NOT NULL,
+    recipe_type_description character varying(20) NOT NULL
+);
+
+
+ALTER TABLE public.item_recipe_type OWNER TO kitto;
+
+--
 -- Name: item_type; Type: TABLE; Schema: public; Owner: kitto; Tablespace: 
 --
 
@@ -165,7 +193,14 @@ CREATE TABLE item_type (
     happiness_bonus integer NOT NULL,
     hunger_bonus integer NOT NULL,
     pet_specie_color_id integer NOT NULL,
-    item_image character varying(200) NOT NULL
+    item_image character varying(200) NOT NULL,
+    item_recipe_type_id integer DEFAULT 0 NOT NULL,
+    recipe_created_item_type_id integer DEFAULT 0 NOT NULL,
+    recipe_batch_quantity integer DEFAULT 0 NOT NULL,
+    unique_item character(1) DEFAULT 'N'::bpchar NOT NULL,
+    transferable_item character(1) DEFAULT 'Y'::bpchar NOT NULL,
+    CONSTRAINT transferable_item CHECK ((transferable_item = ANY (ARRAY['Y'::bpchar, 'N'::bpchar]))),
+    CONSTRAINT unique_item CHECK ((unique_item = ANY (ARRAY['Y'::bpchar, 'N'::bpchar])))
 );
 
 
@@ -180,6 +215,7 @@ CREATE TABLE jump_page (
     page_title character varying(50) DEFAULT ''::character varying NOT NULL,
     page_html_title character varying(255) DEFAULT ''::character varying NOT NULL,
     layout_type character varying(5) DEFAULT 'deep'::bpchar NOT NULL,
+    show_layout character(1) DEFAULT 'Y'::bpchar NOT NULL,
     page_slug character varying(25) DEFAULT ''::character varying NOT NULL,
     access_level character varying(10) DEFAULT 'user'::bpchar NOT NULL,
     restricted_permission_api_name character varying(35) NOT NULL,
@@ -189,7 +225,8 @@ CREATE TABLE jump_page (
     CONSTRAINT jump_page_access_level_check CHECK (((access_level)::bpchar = ANY (ARRAY['restricted'::bpchar, 'user'::bpchar, 'public'::bpchar]))),
     CONSTRAINT jump_page_active_check CHECK ((active = ANY (ARRAY['Y'::bpchar, 'N'::bpchar]))),
     CONSTRAINT jump_page_include_tinymce_check CHECK ((include_tinymce = ANY (ARRAY['N'::bpchar, 'Y'::bpchar]))),
-    CONSTRAINT jump_page_layout_type_check CHECK (((layout_type)::bpchar = ANY (ARRAY['basic'::bpchar, 'deep'::bpchar])))
+    CONSTRAINT jump_page_layout_type_check CHECK (((layout_type)::bpchar = ANY (ARRAY['basic'::bpchar, 'deep'::bpchar]))),
+    CONSTRAINT show_layout CHECK ((show_layout = ANY (ARRAY['Y'::bpchar, 'N'::bpchar])))
 );
 
 
@@ -649,6 +686,46 @@ ALTER SEQUENCE item_class_item_class_id_seq OWNED BY item_class.item_class_id;
 
 
 --
+-- Name: item_recipe_material_item_recipe_material_id_seq; Type: SEQUENCE; Schema: public; Owner: kitto
+--
+
+CREATE SEQUENCE item_recipe_material_item_recipe_material_id_seq
+    INCREMENT BY 1
+    NO MAXVALUE
+    NO MINVALUE
+    CACHE 1;
+
+
+ALTER TABLE public.item_recipe_material_item_recipe_material_id_seq OWNER TO kitto;
+
+--
+-- Name: item_recipe_material_item_recipe_material_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: kitto
+--
+
+ALTER SEQUENCE item_recipe_material_item_recipe_material_id_seq OWNED BY item_recipe_material.item_recipe_material_id;
+
+
+--
+-- Name: item_recipe_type_item_recipe_type_id_seq; Type: SEQUENCE; Schema: public; Owner: kitto
+--
+
+CREATE SEQUENCE item_recipe_type_item_recipe_type_id_seq
+    INCREMENT BY 1
+    NO MAXVALUE
+    NO MINVALUE
+    CACHE 1;
+
+
+ALTER TABLE public.item_recipe_type_item_recipe_type_id_seq OWNER TO kitto;
+
+--
+-- Name: item_recipe_type_item_recipe_type_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: kitto
+--
+
+ALTER SEQUENCE item_recipe_type_item_recipe_type_id_seq OWNED BY item_recipe_type.item_recipe_type_id;
+
+
+--
 -- Name: item_type_item_type_id_seq; Type: SEQUENCE; Schema: public; Owner: kitto
 --
 
@@ -1085,6 +1162,20 @@ ALTER TABLE item_class ALTER COLUMN item_class_id SET DEFAULT nextval('item_clas
 
 
 --
+-- Name: item_recipe_material_id; Type: DEFAULT; Schema: public; Owner: kitto
+--
+
+ALTER TABLE item_recipe_material ALTER COLUMN item_recipe_material_id SET DEFAULT nextval('item_recipe_material_item_recipe_material_id_seq'::regclass);
+
+
+--
+-- Name: item_recipe_type_id; Type: DEFAULT; Schema: public; Owner: kitto
+--
+
+ALTER TABLE item_recipe_type ALTER COLUMN item_recipe_type_id SET DEFAULT nextval('item_recipe_type_item_recipe_type_id_seq'::regclass);
+
+
+--
 -- Name: item_type_id; Type: DEFAULT; Schema: public; Owner: kitto
 --
 
@@ -1290,6 +1381,30 @@ ALTER TABLE ONLY item_class
 
 
 --
+-- Name: item_recipe_material_pkey; Type: CONSTRAINT; Schema: public; Owner: kitto; Tablespace: 
+--
+
+ALTER TABLE ONLY item_recipe_material
+    ADD CONSTRAINT item_recipe_material_pkey PRIMARY KEY (item_recipe_material_id);
+
+
+--
+-- Name: item_recipe_material_unqiue; Type: CONSTRAINT; Schema: public; Owner: kitto; Tablespace: 
+--
+
+ALTER TABLE ONLY item_recipe_material
+    ADD CONSTRAINT item_recipe_material_unqiue UNIQUE (recipe_item_type_id, material_item_type_id);
+
+
+--
+-- Name: item_recipe_type_pkey; Type: CONSTRAINT; Schema: public; Owner: kitto; Tablespace: 
+--
+
+ALTER TABLE ONLY item_recipe_type
+    ADD CONSTRAINT item_recipe_type_pkey PRIMARY KEY (item_recipe_type_id);
+
+
+--
 -- Name: item_type_pkey; Type: CONSTRAINT; Schema: public; Owner: kitto; Tablespace: 
 --
 
@@ -1524,6 +1639,20 @@ CREATE INDEX item_type__item_class_id ON item_type USING btree (item_class_id);
 
 
 --
+-- Name: item_type__item_name; Type: INDEX; Schema: public; Owner: kitto; Tablespace: 
+--
+
+CREATE INDEX item_type__item_name ON item_type USING btree (item_name);
+
+
+--
+-- Name: item_type__item_recipe_type_id; Type: INDEX; Schema: public; Owner: kitto; Tablespace: 
+--
+
+CREATE INDEX item_type__item_recipe_type_id ON item_type USING btree (item_recipe_type_id);
+
+
+--
 -- Name: item_type__pet_specie_color_id; Type: INDEX; Schema: public; Owner: kitto; Tablespace: 
 --
 
@@ -1531,6 +1660,13 @@ CREATE INDEX item_type__pet_specie_color_id ON item_type USING btree (pet_specie
 
 
 --
+-- Name: item_type__recipe_created_item_type_id; Type: INDEX; Schema: public; Owner: kitto; Tablespace: 
+--
+
+CREATE INDEX item_type__recipe_created_item_type_id ON item_type USING btree (recipe_created_item_type_id);
+
+
+--
 -- Name: required_permission_id_category_index; Type: INDEX; Schema: public; Owner: kitto; Tablespace: 
 --
 </diff>
      <filename>db/postgres_ddl.sql</filename>
    </modified>
    <modified>
      <diff>@@ -79,47 +79,67 @@ class Recipe_Item extends Item
     *
     * This will return how many batches the user can produce.
     * 
+    * @rdbms-specific
     * @return integer 
     **/
     public function canCraft()
     {
-       switch($this-&gt;db-&gt;phptype)
-       {
-           case 'mysqli':
-           case 'mysql':
-           {
-               $sql = '
-                   SELECT
-                       FLOOR(IFNULL(user_item.quantity,0) / item_recipe_material.material_quantity) AS batch_size
-                   FROM item_type
-                   INNER JOIN item_recipe_material ON (item_type.item_type_id = item_recipe_material.recipe_item_type_id)
-                   LEFT JOIN user_item ON (
-                       item_recipe_material.material_item_type_id = user_item.item_type_id 
-                       AND ? = user_item.user_id
-                   )
-                   WHERE item_type.item_type_id = ? 
-                   ORDER BY batch_size
-                   LIMIT 1
-               ';
+        switch($this-&gt;db-&gt;phptype)
+        {
+            case 'mysqli':
+            case 'mysql':
+            {
+                $sql = '
+                    SELECT
+                        FLOOR(IFNULL(user_item.quantity,0) / item_recipe_material.material_quantity) AS batch_size
+                    FROM item_type
+                    INNER JOIN item_recipe_material ON (item_type.item_type_id = item_recipe_material.recipe_item_type_id)
+                    LEFT JOIN user_item ON (
+                        item_recipe_material.material_item_type_id = user_item.item_type_id 
+                        AND ? = user_item.user_id
+                    )
+                    WHERE item_type.item_type_id = ? 
+                    ORDER BY batch_size
+                    LIMIT 1
+                ';
 
                break;
-           } // end mysql
+            } // end mysql
+
+            case 'pgsql':
+            {
+                $sql = '
+                    SELECT
+                        FLOOR(COALESCE(user_item.quantity,0) / item_recipe_material.material_quantity) AS batch_size
+                    FROM item_type
+                    INNER JOIN item_recipe_material ON (item_type.item_type_id = item_recipe_material.recipe_item_type_id)
+                    LEFT JOIN user_item ON (
+                        item_recipe_material.material_item_type_id = user_item.item_type_id 
+                        AND ? = user_item.user_id
+                    )
+                    WHERE item_type.item_type_id = ? 
+                    ORDER BY batch_size
+                    LIMIT 1
+                ';
+
+                break;
+            } // end pgsql
 
-           default:
-           {
+            default:
+            {
                throw new ArgumentError('RDBMS unsupported.');
 
                break;
-           } // end default
-       } // end db engine switch
+            } // end default
+        } // end db engine switch
 
-       $batch_size = $this-&gt;db-&gt;getOne($sql,array($this-&gt;getUserId(),$this-&gt;getItemTypeId()));
-       if(PEAR::isError($batch_size))
-       {
-           throw new SQLError($batch_size-&gt;getDebugInfo(),$batch_size-&gt;userinfo,10);
-       }
+        $batch_size = $this-&gt;db-&gt;getOne($sql,array($this-&gt;getUserId(),$this-&gt;getItemTypeId()));
+        if(PEAR::isError($batch_size))
+        {
+            throw new SQLError($batch_size-&gt;getDebugInfo(),$batch_size-&gt;userinfo,10);
+        }
 
-       return $batch_size;
+        return $batch_size;
     } // end canCraft 
 
     public function grabProduct()</diff>
      <filename>includes/classes/item/recipe_item.class.php</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>809b82689f637cc93d2522b17b3591b0afad0059</id>
    </parent>
  </parents>
  <author>
    <name>Nicholas 'OwlManAtt' Evans</name>
    <email>owlmanatt@gmail.com</email>
  </author>
  <url>http://github.com/OwlManAtt/kittokittokitto/commit/2916d1d82579ee46318ad7275f68106035efe77c</url>
  <id>2916d1d82579ee46318ad7275f68106035efe77c</id>
  <committed-date>2009-07-15T21:52:35-07:00</committed-date>
  <authored-date>2009-07-15T21:52:35-07:00</authored-date>
  <message>Crafting stuff has been ported to PostgreSQL.</message>
  <tree>236403880f093b794df1736c7429d0b652680b28</tree>
  <committer>
    <name>Nicholas 'OwlManAtt' Evans</name>
    <email>owlmanatt@gmail.com</email>
  </committer>
</commit>
