Skip to content

Settings and activity

2 results found

  1. 156 votes
    Vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
    You have left! (?) (thinking…)
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
    An error occurred while saving the comment
    Tom Bruinsma commented  · 

    Currently we are using a kludge solution in order to persist the database diagrams. We created a user table in the database to persist the sysdiagram data.

    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    /****** Object: StoredProcedure [dbo].[Admin_DatabaseDiagrams_FromSYS_ToApp] Script Date: 07/08/2011 13:50:58 ******/
    CREATE TABLE [dbo].[tbl_sysdiagrams](
    [name] [sysname] NOT NULL,
    [principal_id] [int] NOT NULL,
    [diagram_id] [int] NOT NULL,
    [version] [int] NULL,
    [definition] [varbinary](max) NULL,
    CONSTRAINT [PK_tbl_sysdiagrams] PRIMARY KEY CLUSTERED
    (
    [diagram_id] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]

    GO

    /**********************************************************************************
    *Purpose:
    * Redgate Source Control will not work with system tables. This stores the diagrams in a local table and then updates the sysdiagrams
    *
    *Outputs:
    *
    *Depracated:
    *
    *
    *
    *Action Who When Change Description
    *--------------------------------------------------------------------------------------------------------------
    *Created tbruinsma 2011-06-13
    *
    *
    *
    *************************************************************************************/
    ALTER PROC [dbo].[Admin_DatabaseDiagrams_FromSYS_ToApp]
    AS

    IF OBJECT_ID('dbo.sysdiagrams', 'U') IS NOT NULL
    TRUNCATE TABLE tbl_sysdiagrams

    INSERT INTO tbl_sysdiagrams(name, principal_id, diagram_id, [version], [definition])
    SELECT
    name, principal_id, diagram_id, [version], [definition]
    FROM dbo.sysdiagrams
    GO
    /**********************************************************************************
    *Purpose:
    * Redgate Source Control will not work with system tables. This stores the diagrams in a local table and then updates the sysdiagrams
    *
    *Outputs:
    *
    *Depracated:
    *
    *
    *
    *Action Who When Change Description
    *--------------------------------------------------------------------------------------------------------------
    *Created tbruinsma 2011-06-13
    *
    *
    *
    *************************************************************************************/
    ALTER PROC [dbo].[Admin_DatabaseDiagrams_FromApp_ToSYS]
    AS

    IF OBJECT_ID('dbo.sysdiagrams', 'U') IS NOT NULL
    BEGIN
    --remove
    TRUNCATE TABLE sysdiagrams

    SET IDENTITY_INSERT sysdiagrams ON
    INSERT INTO sysdiagrams(name, principal_id, diagram_id, [version], [definition])
    SELECT
    name, principal_id, diagram_id, [version], [definition]
    FROM dbo.tbl_sysdiagrams
    SET IDENTITY_INSERT sysdiagrams ON
    END
    GO

  2. 131 votes
    Vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
    You have left! (?) (thinking…)
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
    Tom Bruinsma supported this idea  ·