Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
  #1  
Old 08-13-2011, 01:01 PM
EquinoxWorld EquinoxWorld is offline
 
Join Date: Nov 2009
Location: Naples
Posts: 354
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Need Help Packaging Mod - SQL tables install

Hello everyone, I am finally nearing the end of development of my first ever modification that I'll be releasing here at vb.org. (please be gentle when I do). In any case my concern at this stage is that I need to package the modification. Everything is pretty much packaged automatically with vb except I believe the SQL tables I created for the mod. Since this is my first mod I did not anticipate that I would have to have a record of the code used to create each table, to be honest some were created field by field as I went along. So now that I have to package this my question is would there be a "easy" way of getting the commands used to create them to insert them into my install script (I know that I can do this by going one by one and creating the code for each (not the most reliable way in my case))? I have over 10 db tables and I want to make sure that when someone installs the mod the tables are created correctly with the right index assigned and such. Would there be an automated way of doing this to ensure that the tables are created exactly the same as how I have them now? Also if possible if someone can also guide me as to how this table install codes should be placed within the install code of the product it would also be very helpful. If anyone can provide some information or guidance in this matter as to how to handle table creation with the product install code it would be very helpful.

Any info is good info.

Best Regards.
Reply With Quote
  #2  
Old 08-13-2011, 01:21 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you use phpMyAdmin you can Export the table structure to SQL format. I'm not sure if there's a way to do that using the mysql command line programs.
Reply With Quote
  #3  
Old 08-13-2011, 01:25 PM
EquinoxWorld EquinoxWorld is offline
 
Join Date: Nov 2009
Location: Naples
Posts: 354
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
If you use phpMyAdmin you can Export the table structure to SQL format. I'm not sure if there's a way to do that using the mysql command line programs.
Thanks for your reply kh99, I actually found this command that works rather well from the SQL command line:

Code:
SHOW CREATE TABLE tbl_name
I can use this to get the exact code used to create the tables. My question now is where should I place this code within the product install file? Also would there be a way of using this command to get more than one tables create codes at a time? I'm glad though that with this at least I get the exact command to get the table how it is right now. Now I just need to place it properly into the install code of the mod.
Reply With Quote
  #4  
Old 08-13-2011, 01:34 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What you really should do is have a test site in debug mode, by putting $config['Misc']['debug'] = 1; in include/config.php. Then you can go to Products & Plugins -> Manage Products in the adminCP, and "edit" the product. You'll then have text areas to put in install and uninstall code. When you've got the product the way you want it, you can export it to an xml file.

If you really want to do it by editing the product xml file, probably the best thing would be to find an existing product and see where to put xml tags for installcode and uninstallcode. It's a little complicated by the fact that you can have different sections of code for different versions, to support updating.
Reply With Quote
  #5  
Old 08-13-2011, 01:46 PM
EquinoxWorld EquinoxWorld is offline
 
Join Date: Nov 2009
Location: Naples
Posts: 354
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
What you really should do is have a test site in debug mode, by putting $config['Misc']['debug'] = 1; in include/config.php. Then you can go to Products & Plugins -> Manage Products in the adminCP, and "edit" the product. You'll then have text areas to put in install and uninstall code. When you've got the product the way you want it, you can export it to an xml file.

If you really want to do it by editing the product xml file, probably the best thing would be to find an existing product and see where to put xml tags for installcode and uninstallcode. It's a little complicated by the fact that you can have different sections of code for different versions, to support updating.
Thanks for your reply kh, I actually have my site in debug already. I exported the product and am taking a look at the install code, everything is there except the SQL install/create commands. The install file is done except without the SQL commands to create the tables, my concern was how to add these to the already existing install product file. I am taking a look at some other mods to see how they did it but the method varies. I was wondering if anyone knew what was the best way or the "right" way of doing it.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:50 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05359 seconds
  • Memory Usage 2,203KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete