Skip to content

Commit

Permalink
migrate diagrams to new database
Browse files Browse the repository at this point in the history
They're not defined in the 'generate-db.sql' file.  See #15.
  • Loading branch information
wibeasley committed Jun 21, 2017
1 parent d458a3c commit be4ec5a
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions data-public/metadata/database/diagrams/migrate-diagrams.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
--Requires a "Linked server": https://docs.microsoft.com/en-us/sql/relational-databases/linked-servers/linked-servers-database-engine
--Code from https://stackoverflow.com/questions/527327/how-do-you-migrate-sql-server-database-diagrams-to-another-database

SELECT [name]
,[principal_id]
,[diagram_id]
,[version]
,[definition]
FROM [BEE\BASS].[NlsLinks].[dbo].[sysdiagrams]




USE NlsLinks

DELETE sysDiagrams
WHERE name IN (
SELECT name FROM [BEE\BASS].[NlsLinks].[dbo].[sysdiagrams]
)

SET IDENTITY_INSERT sysDiagrams ON

INSERT sysDiagrams (
name,
principal_id,
diagram_id,
version,
definition
)
SELECT
name,
principal_id,
diagram_id,
version,
definition
FROM [BEE\BASS].[NlsLinks].[dbo].[sysdiagrams]

SET IDENTITY_INSERT sysDiagrams OFF

0 comments on commit be4ec5a

Please sign in to comment.