Sql statement for tradeskill edit?
Is there a way to do a sql command to update all jewelcrafting recipes to use another container such as a collapsible jewelers kit (item# 17187)? I have been looking at the table tradeskill_recipe_entries and it looks like all the recipes are defined only by the recipe ID and not by tradeskill. Is this a possiblility or do I need to do them one at a time?
|
This should find ALL jewelcrafting recipes:
Code:
SELECT * from tradeskill_recipe_entries JOIN tradeskill_recipe ON tradeskill_recipe_entries.recipe_id=tradeskill_recipe.id WHERE tradeskill_recipe.tradeskill=68; |
To get the list of which recipes are not using that container just add:
AND iscontainer=1 AND item_id != 17187; to the end of that query removing the previous ; (ninja edit about the semi colon) Then your update will use similar conventions. |
Ok since I know just enough about sql to get myself into trouble, would I then use:
Code:
INSERT tradeskill_recipe_entries `item_id`=17187 WHERE tradeskill_recipe.tradeskill=68 AND iscontainer=1 AND item_id != 17187; |
No, unfortunately that wouldn't work. Also, the info i listed above is incorrect. Each recipe_id has multiple occurrences in the tradeskill_recipe_entries table so isolating one item was not the right solution.
Sorry... |
There are 86 jewelry recipes not using item 17187. As long as you dont have any custom made ones this query should make the rest use that container. This goes with the proviso that you should have backups in case you need to revert an unsuccessful change.
Code:
INSERT INTO `tradeskill_recipe_entries` (`id`,`recipe_id`,`item_id`,`successcount`,`failcount`,`componentcount`,`salvagecount`,`iscontainer`) I created this list by exporting the above querries and used excel to sort because of the recipe_id issue. Perhaps there's an easier way to do this without having to resort to exporting and excel, but i cant figure it out at the moment... |
I really appreciate all the effort you put into this but unfortunately I have a ton of custom recipes that I didn't put the collapsible containers on. Jewelcrafting is just one of the tradeskills. I was hoping it would be a simple thing that I could adapt to all the different tradeskills. Thank you very much for your time.
|
This should do what you need it to do:
Code:
|
:shock: Wow! Thank you. I will try that.
|
You bet!
Though I got in a hurry to leave the office and forgot to break down what it does so you can be sure before you run it. If you read it logically right-to-left: 1. ... (SELECT recipe_id FROM tradeskill_recipe_entries e WHERE e.item_id=17187) Tells the database to make a list of all recipe_ids that work with container item # 17187, which an earlier post said was your desired container) 2. SELECT r.id, 17187, 0, 0, 0, 0, 1 FROM tradeskill_recipe r WHERE r.tradeskill=68 AND r.id NOT IN ... Tells the database to build a set of recipe_entry records containing the recipe.id, container_id, and proper counts & flags for all recipes in the tradeskill_recipe table that are Jewelcrafting recipes (an earlier post said it was type 68) but are NOT in the list of recipes from #1 above that already work with container # 17187. 3. INSERT INTO tradeskill_recipe_entries (recipe_id, item_id, successcount, failcount, componentcount, salvagecount, iscontainer) Tells the database to insert those newly built records into the tradeskill_recipe_entries table. All together, the query creates a new tradeskill_recipe_entries record with containerid 17187 for each Jewelcrafting recipe it finds that does not already have a recipe_entries record for item 17187. |
Nice! I really appreciate the break down on that. That helps me understand a little more so I can modify it to other containers for other trade skills. Thank you very much.
|
All times are GMT -4. The time now is 09:53 PM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.