• This workspace has been inactive for over 11 months, and is scheduled to be reclaimed. Make an edit or click here to mark it as active.
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Dokkio Sidebar (from the makers of PBworks) is a Chrome extension that eliminates the need for endless browser tabs. You can search all your online stuff without any extra effort. And Sidebar was #1 on Product Hunt! Check out what people are saying by clicking here.


Maintaining Hosting and Local Copies of Web Applications

Page history last edited by Dr. Ron Eaglin 10 years, 3 months ago

Maintaining Hosting and Local Copies of Web Applications


Here are tips and tricks to help you maintain code consistency between your application on your local machine and your host.


Updating the Application


When I update the application on my host I typically wipe out (delete) the entire directory and then re-upload the entire package from my local machine. This is best done using an FTP tool (rather than the host tools). If you are not using FileZilla for this - you should download and use


http://filezilla-project.org/ - Use the client download for FileZilla. 


Updating the Database


Keeping the database up to date is a bit trickier. One option for the database is to completely delete all database objects and then recreate them. A good script to do this is available from Stack Overflow http://stackoverflow.com/questions/536350/sql-server-2005-drop-all-the-tables-stored-procedures-triggers-constriants-a 


Simply paste this into to the query analyzer and execute - and voila - the entire database is wiped out. It is easy to script the database objects locally to re-insert. Right click on Database, Tasks, Generate Scripts ... - select script all objects and it will generate a script to create the entire database that can be executed at your remote host.


In addition to this you will also want to have a script (in this case a stored procedure) generate inserts for data that you want to transfer from your local machine to your host. I use a script avaliable here = http://www.malgreve.net/2008/11/how-to-script-data-generate-insert-t.html . This script will place the script in the master database, making it available to all databases for generating insert scripts. 


When using - remember to use the USE command prior to executing the script to specify the database that you want to script data for. Then simple execute it as

USE YourDatabase
EXEC sp_generate_inserts Your_Table_Name


As a note - be sure to right click on the Query Analyzer Screen and select Results, To Text ...


that will make the results easy to copy and paste. If you have identity fields in the database you are scripting you may have to manually change the insert script OR possibly change your IDENTITY INSERT to OFF to be able to use the insert script.


For example running this script would look like

USE MyDailyMath
EXEC sp_generate_inserts Roles




PRINT 'Inserting values into [Roles]'
INSERT INTO [Roles] ([id],[RoleNameText],[RoleDescriptionText])
VALUES(1,'Administrator','Full rights to all parts of system')
INSERT INTO [Roles] ([id],[RoleNameText],[RoleDescriptionText])
VALUES(2,'Contributor','Allow users to contribute content to the site.')
PRINT 'Done'


I normally remove the identity insert - so the Insert looks like


INSERT INTO [Roles] ([RoleNameText],[RoleDescriptionText])
VALUES('Administrator','Full rights to all parts of system')
INSERT INTO [Roles] ([RoleNameText],[RoleDescriptionText])
VALUES('Contributor','Allow users to contribute content to the site.')




Comments (0)

You don't have permission to comment on this page.