Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Damon 217 posts 288 karma points
    Jul 19, 2018 @ 14:04
    Damon
    0

    How to force forms reinstall including tables

    Hi,

    I installed Umbraco forms, then uninstalled it and remove the forms tables. There used to be Contour on there. The reason I removed the form tables it because on another installation I could only get Forms install working by deleting Coutour tables first.

    Anyway, when I just reinstalled FOrms and it did not put the tables back. How can I force the table script to run again when I reinstalled Forms?

    Thanks!

  • Alex Skrypnyk 6182 posts 24283 karma points MVP 8x admin c-trib
    Jan 10, 2019 @ 15:13
    Alex Skrypnyk
    0

    Hi Damon

    Did you find a solution?

  • Alex Skrypnyk 6182 posts 24283 karma points MVP 8x admin c-trib
    Jan 14, 2019 @ 00:25
    Alex Skrypnyk
    100

    We just removed all tables manually. It works.

  • Nick 21 posts 163 karma points notactivated
    1 week ago
    Nick
    1

    For Umbraco 13, if anyone needs to uninstall Umbraco Forms, the following achieved that for me:

    -- Delete the Umbraco key if it exists
    IF EXISTS (SELECT 1 FROM umbracoKeyValue WHERE [key] = 'Umbraco.Core.Upgrader.State+UmbracoForms')
    BEGIN
        DELETE FROM umbracoKeyValue WHERE [key] = 'Umbraco.Core.Upgrader.State+UmbracoForms';
        PRINT 'Deleted UmbracoKeyValue entry.';
    END
    ELSE
        PRINT 'UmbracoKeyValue entry not found.';
    
    -- Drop Foreign Key Constraints only if they exist
    DECLARE @constraint NVARCHAR(255);
    DECLARE @table NVARCHAR(255);
    DECLARE @sql NVARCHAR(MAX);
    
    DECLARE constraint_cursor CURSOR FOR
    SELECT fk.name, t.name 
    FROM sys.foreign_keys fk
    JOIN sys.tables t ON fk.parent_object_id = t.object_id
    WHERE fk.name IN (
        'FK_UFFolders_UFFolders_Key',
        'FK_UFFolders_UFFolders_ParentKey',
        'FK_UFForms_UFFolders_FolderKey',
        'FK_UFForms_UFFolders_Key',
        'FK_UFForms_umbracoNode_id',
        'FK_UFRecordAudit_UFRecords_Id',
        'FK_UFRecordDataBit_UFRecordFields_Key',
        'FK_UFRecordDataDateTime_UFRecordFields_Key',
        'FK_UFRecordDataInteger_UFRecordFields_Key',
        'FK_UFRecordDataLongString_UFRecordFields_Key',
        'FK_UFRecordDataString_UFRecordFields_Key',
        'FK_UFRecordFields_UFRecords_Record',
        'FK_UFRecordFields_UFRecords_Id',
        'FK_UFUserFormSecurity_UFForms_Key',
        'FK_UFUserGroupFormSecurity_UFForms_Key',
        'FK_UFUserGroupStartFolders_UFFolders_Key',
        'FK_UFUserGroupStartFolders_UFFolders_FolderKey',
        'FK_UFUserStartFolders_UFFolders_FolderKey',
        'FK_UFUserStartFolders_UFFolders_Key'
    );
    
    OPEN constraint_cursor;
    FETCH NEXT FROM constraint_cursor INTO @constraint, @table;
    
    WHILE @@FETCH_STATUS = 0
    BEGIN
        SET @sql = 'ALTER TABLE ' + QUOTENAME(@table) + ' DROP CONSTRAINT ' + QUOTENAME(@constraint);
        EXEC sp_executesql @sql;
        PRINT 'Dropped constraint: ' + @constraint + ' from table: ' + @table;
    
        FETCH NEXT FROM constraint_cursor INTO @constraint, @table;
    END
    
    CLOSE constraint_cursor;
    DEALLOCATE constraint_cursor;
    
    -- Drop Tables only if they exist
    DECLARE @tablename NVARCHAR(255);
    DECLARE table_cursor CURSOR FOR
    SELECT name FROM sys.tables
    WHERE name IN (
        'UFDataSource',
        'UFFolders',
        'UFForms',
        'UFPrevalueSource',
        'UFRecordAudit',
        'UFRecordDataBit',
        'UFRecordDataDateTime',
        'UFRecordDataInteger',
        'UFRecordDataLongString',
        'UFRecordDataString',
        'UFRecordFields',
        'UFRecords',
        'UFRecordWorkflowAudit',
        'UFUserFormSecurity',
        'UFUserGroupFormSecurity',
        'UFUserGroupSecurity',
        'UFUserGroupStartFolders',
        'UFUserSecurity',
        'UFUserStartFolders',
        'UFWorkflows'
    );
    
    OPEN table_cursor;
    FETCH NEXT FROM table_cursor INTO @tablename;
    
    WHILE @@FETCH_STATUS = 0
    BEGIN
        SET @sql = 'DROP TABLE ' + QUOTENAME(@tablename);
        EXEC sp_executesql @sql;
        PRINT 'Dropped table: ' + @tablename;
    
        FETCH NEXT FROM table_cursor INTO @tablename;
    END
    
    CLOSE table_cursor;
    DEALLOCATE table_cursor;
    
    PRINT 'Umbraco Forms key value, tables and constraints removed successfully.';
    
Please Sign in or register to post replies

Write your reply to:

Draft