Developer forum

Forum » Swift » Did I corrupt the database by starting without ItemTypes?

Did I corrupt the database by starting without ItemTypes?

Justin Sjouw Dynamicweb Employee
Justin Sjouw
Reply

Hi, 

I'm working on automatic deployments for my Swift environment, and at some point the IIS Website and AppPool were started when the Swift folder and specifically the ItemTypes were not correctly deployed.

Can this have "corrupted" my database, because I have now noticed on the test enviroment the ItemTYpe of the Website(area) are no longer set:

This ofcourse results in an error.

So my question is: Can this be caused by starting the application when the Sytem\Items folder is empty? i.e wil the startup process then remove items that are missing on disk? 

Or must something else have happened?

Thanks :-)

Justin


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

If an item type is missing - it can be deleted from database. If you then save an area, the item can go away.

Otherwise this should not happen.

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

If an item type is missing - it can be deleted from database. If you then save an area, the item can go away.

Otherwise this should not happen.

 
Justin Sjouw Dynamicweb Employee
Justin Sjouw
Reply

Hey Nicolai,

Ok, so then I guess this should not have happened. Because the step I have taken are:

-Stop the AppPool

-Delete All the Item Types from System\Items (Ofcourse not something you would normally do, this was due to an error in the deployment process)

-Start the AppPool

-Browse to the frontend, Shows "no layout selected" 

This implies that the Item Types were deleted without explicitly saving the Area settings, because I did not login to the backend.

Is it something that is interesting to try and reproduce, or do you consider it such an edge case that is does not make sense?

Thanks,

Justin

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

If you remove the item types, and re-start application, the item tables will be gone and pages and websites will have references to item types that no longer exists - will create a number of issues.

We have a validation of item handling coming up - and one point is wether we should change when tables and fields are deleted from database.

The reasoning is that item types can be dfined by xml or by code - and if they are there, the schema will also, if they are not, the schema will also be gone. But it causes problems when things goes wrong in i.e. deployment scenarios.

 
Justin Sjouw Dynamicweb Employee
Justin Sjouw
Reply

Right, that makes sense.I can understand this is a difficult one to handle.

The behaviour as is, is probably fine in just about any scenario.

Maybe an "easy fix" would be to check if there is any schema configuration at all in the file system/code, and if not log an exception in the process of de-serializing items. That way you would at least prevent deleting the entire schema, which is probably a scenario that you do not want very often in an existing database.

Thanks for claryfying!

Justin

 

 

You must be logged in to post in the forum