This project is read-only.

Clean up the database

Jun 13, 2008 at 10:57 AM

do you perhaps have a nifty routine to check the tables and clean up all records not (anymore) in use (mainly in n2detail)?
When developing it often happens that a item gets obsolete, but it will always remain in the database.

Cleaning this would be a more decent way of deploying the database...

Jun 13, 2008 at 6:39 PM
I don't have anything of this sort. It's kinda doable but somewhat tricky.
One could iterate the editable's in an item definition (N2.Context.Definitions.GetDefinition(type).Editables) and remove stuff that is note defined.
The problem is that n2 doesn't enforce that the details used are present in a definition so we can use the content items to store all kinds of data. I know I do.
I've been playing with the idea of introducing some migration framework which could solve this kinds of problems.
Of course there could be some technical interface too akin to /edit/install/fix.aspx that could simplify this task. I'll add this idea in the list.
Jun 14, 2008 at 10:35 AM
It is most useful after the initial development is done. Then there always are records left behind.
Deploying an empty database is not really an option since the structure built in the development has to be deployed as well.

Perhaps a fix-page which lists which records in n2detail probably are not in use anymore with an option to remove them?


Jun 15, 2008 at 12:20 AM
An easier path would be having an option on the export tool to include only defined details. What do you think about that?
Jun 15, 2008 at 8:39 AM
That looks like a very good (and hopefully best) option!
Probably not to much work and in an existing option.
Nov 25, 2009 at 1:38 PM

Did this ever come to anything?


Nov 29, 2009 at 12:53 AM

Yep, when you export you can exclude computer generated data.