+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / How to configure limit of versions

How to configure limit of versions

4 posts, 0 answered
  1. Bruno Michels
    Bruno Michels avatar
    125 posts
    Registered:
    16 Apr 2010
    12 Aug 2010
    Link to this post
    I want to limit the number of versioned content by 3, how can I do that?

    Maybe I have to create a trigger, how can I do it?

    Or is there some configuration?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    12 Aug 2010
    Link to this post
    Hi Bruno Michels,

    It is not possible to limit the number of the versions. You can truncate some of the tables to reduce the database size with some  SQL scripts show in this KB - http://www.sitefinity.com/devnet/kb/sitefinity-3-x/how-to-reduce-the-project-database-size.aspx

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Bruno Michels
    Bruno Michels avatar
    125 posts
    Registered:
    16 Apr 2010
    12 Aug 2010
    Link to this post
    Well, since there isn't a configuration I just made a trigger.
    Probably everyone will need this or will disable the versioning...

    CREATE TRIGGER [dbo].[VrsTxtDataOnInsert]
       ON [dbo].[sf_VrsTxtData]
       AFTER INSERT
    AS
    BEGIN
        SET NOCOUNT ON;
     
        DELETE sf_VrsTxtData FROM sf_VrsTxtData v
        INNER JOIN INSERTED i ON v.[ItemID] = i.[ItemID]
        WHERE v.[Version] < (i.[Version] - 1)
         
        DELETE sf_VersionItem FROM sf_VersionItem v
        INNER JOIN INSERTED i ON v.[ID] = i.[ItemID]
        WHERE v.[Version] < (i.[Version] - 1)
         
    END


    This keeps the last two versions, the current and the last one. Change " - 1 " to the number of previous versions you want.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    13 Aug 2010
    Link to this post
    Hi Bruno Michels,

    Thanks for sharing the trigger with us.

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
4 posts, 0 answered