USE [master]
GO
IF  EXISTS (SELECT name FROM sys.databases WHERE name = N'FolktaleDB')
DROP DATABASE [FolktaleDB]
GO
CREATE DATABASE [FolktaleDB] ON  PRIMARY 
( NAME = N'FolktaleDB', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\FolktaleDB.mdf' , SIZE = 3072KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
 LOG ON 
( NAME = N'FolktaleDB_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\FolktaleDB_log.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
 COLLATE Latin1_General_CI_AS
GO
EXEC dbo.sp_dbcmptlevel @dbname=N'FolktaleDB', @new_cmptlevel=90
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [FolktaleDB].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [FolktaleDB] SET ANSI_NULL_DEFAULT OFF 
GO
ALTER DATABASE [FolktaleDB] SET ANSI_NULLS OFF 
GO
ALTER DATABASE [FolktaleDB] SET ANSI_PADDING OFF 
GO
ALTER DATABASE [FolktaleDB] SET ANSI_WARNINGS OFF 
GO
ALTER DATABASE [FolktaleDB] SET ARITHABORT OFF 
GO
ALTER DATABASE [FolktaleDB] SET AUTO_CLOSE ON 
GO
ALTER DATABASE [FolktaleDB] SET AUTO_CREATE_STATISTICS ON 
GO
ALTER DATABASE [FolktaleDB] SET AUTO_SHRINK OFF 
GO
ALTER DATABASE [FolktaleDB] SET AUTO_UPDATE_STATISTICS ON 
GO
ALTER DATABASE [FolktaleDB] SET CURSOR_CLOSE_ON_COMMIT OFF 
GO
ALTER DATABASE [FolktaleDB] SET CURSOR_DEFAULT  GLOBAL 
GO
ALTER DATABASE [FolktaleDB] SET CONCAT_NULL_YIELDS_NULL OFF 
GO
ALTER DATABASE [FolktaleDB] SET NUMERIC_ROUNDABORT OFF 
GO
ALTER DATABASE [FolktaleDB] SET QUOTED_IDENTIFIER OFF 
GO
ALTER DATABASE [FolktaleDB] SET RECURSIVE_TRIGGERS OFF 
GO
ALTER DATABASE [FolktaleDB] SET  DISABLE_BROKER 
GO
ALTER DATABASE [FolktaleDB] SET AUTO_UPDATE_STATISTICS_ASYNC OFF 
GO
ALTER DATABASE [FolktaleDB] SET DATE_CORRELATION_OPTIMIZATION OFF 
GO
ALTER DATABASE [FolktaleDB] SET TRUSTWORTHY OFF 
GO
ALTER DATABASE [FolktaleDB] SET ALLOW_SNAPSHOT_ISOLATION OFF 
GO
ALTER DATABASE [FolktaleDB] SET PARAMETERIZATION SIMPLE 
GO
ALTER DATABASE [FolktaleDB] SET  READ_WRITE 
GO
ALTER DATABASE [FolktaleDB] SET RECOVERY SIMPLE 
GO
ALTER DATABASE [FolktaleDB] SET  MULTI_USER 
GO
ALTER DATABASE [FolktaleDB] SET PAGE_VERIFY CHECKSUM  
GO
ALTER DATABASE [FolktaleDB] SET DB_CHAINING OFF 
GO

SET ARITHABORT ON
SET NUMERIC_ROUNDABORT OFF
SET CONCAT_NULL_YIELDS_NULL ON
SET ANSI_WARNINGS ON
SET NOCOUNT ON
SET XACT_ABORT ON
GO


USE [FolktaleDB]
GO
-- BEGINNING TRANSACTION STRUCTURE
PRINT 'Beginning transaction STRUCTURE'
BEGIN TRANSACTION _STRUCTURE_
GO

-- Create Table sysdiagrams
Print 'Create Table sysdiagrams'
GO
CREATE TABLE [dbo].[sysdiagrams] (
		[name]             [sys].[sysname] NOT NULL,
		[principal_id]     int NOT NULL,
		[diagram_id]       int NOT NULL IDENTITY(1, 1),
		[version]          int NULL,
		[definition]       varbinary(max) NULL
)
ON [PRIMARY]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Add Primary Key PK__sysdiagrams__38996AB5 to sysdiagrams
Print 'Add Primary Key PK__sysdiagrams__38996AB5 to sysdiagrams'
GO
ALTER TABLE [dbo].[sysdiagrams]
	ADD
	CONSTRAINT [PK__sysdiagrams__38996AB5]
	PRIMARY KEY
	([diagram_id])
	ON [PRIMARY]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Add Unique UK_principal_name to sysdiagrams
Print 'Add Unique UK_principal_name to sysdiagrams'
GO
ALTER TABLE [dbo].[sysdiagrams]
	ADD
	CONSTRAINT [UK_principal_name]
	UNIQUE
	([principal_id], [name])
	ON [PRIMARY]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Function fn_diagramobjects
Print 'Create Function fn_diagramobjects'
GO
	CREATE FUNCTION dbo.fn_diagramobjects() 
	RETURNS int
	WITH EXECUTE AS N'dbo'
	AS
	BEGIN
		declare @id_upgraddiagrams		int
		declare @id_sysdiagrams			int
		declare @id_helpdiagrams		int
		declare @id_helpdiagramdefinition	int
		declare @id_creatediagram	int
		declare @id_renamediagram	int
		declare @id_alterdiagram 	int 
		declare @id_dropdiagram		int
		declare @InstalledObjects	int

		select @InstalledObjects = 0

		select 	@id_upgraddiagrams = object_id(N'dbo.sp_upgraddiagrams'),
			@id_sysdiagrams = object_id(N'dbo.sysdiagrams'),
			@id_helpdiagrams = object_id(N'dbo.sp_helpdiagrams'),
			@id_helpdiagramdefinition = object_id(N'dbo.sp_helpdiagramdefinition'),
			@id_creatediagram = object_id(N'dbo.sp_creatediagram'),
			@id_renamediagram = object_id(N'dbo.sp_renamediagram'),
			@id_alterdiagram = object_id(N'dbo.sp_alterdiagram'), 
			@id_dropdiagram = object_id(N'dbo.sp_dropdiagram')

		if @id_upgraddiagrams is not null
			select @InstalledObjects = @InstalledObjects + 1
		if @id_sysdiagrams is not null
			select @InstalledObjects = @InstalledObjects + 2
		if @id_helpdiagrams is not null
			select @InstalledObjects = @InstalledObjects + 4
		if @id_helpdiagramdefinition is not null
			select @InstalledObjects = @InstalledObjects + 8
		if @id_creatediagram is not null
			select @InstalledObjects = @InstalledObjects + 16
		if @id_renamediagram is not null
			select @InstalledObjects = @InstalledObjects + 32
		if @id_alterdiagram  is not null
			select @InstalledObjects = @InstalledObjects + 64
		if @id_dropdiagram is not null
			select @InstalledObjects = @InstalledObjects + 128
		
		return @InstalledObjects 
	END
	
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Extended Property microsoft_database_tools_support on fn_diagramobjects
Print 'Create Extended Property microsoft_database_tools_support on fn_diagramobjects'
GO
EXEC sp_addextendedproperty 'microsoft_database_tools_support', 1, 'SCHEMA', 'dbo', 'FUNCTION', 'fn_diagramobjects', NULL, NULL
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Procedure sp_alterdiagram
Print 'Create Procedure sp_alterdiagram'
GO
	CREATE PROCEDURE [dbo].sp_alterdiagram
	(
		@diagramname 	sysname,
		@owner_id	int	= null,
		@version 	int,
		@definition 	varbinary(max)
	)
	WITH EXECUTE AS 'dbo'
	AS
	BEGIN
		set nocount on
	
		declare @theId 			int
		declare @retval 		int
		declare @IsDbo 			int
		
		declare @UIDFound 		int
		declare @DiagId			int
		declare @ShouldChangeUID	int
	
		if(@diagramname is null)
		begin
			RAISERROR ('Invalid ARG', 16, 1)
			return -1
		end
	
		execute as caller;
		select @theId = DATABASE_PRINCIPAL_ID();	 
		select @IsDbo = IS_MEMBER(N'db_owner'); 
		if(@owner_id is null)
			select @owner_id = @theId;
		revert;
	
		select @ShouldChangeUID = 0
		select @DiagId = diagram_id, @UIDFound = principal_id from dbo.sysdiagrams where principal_id = @owner_id and name = @diagramname 
		
		if(@DiagId IS NULL or (@IsDbo = 0 and @theId <> @UIDFound))
		begin
			RAISERROR ('Diagram does not exist or you do not have permission.', 16, 1);
			return -3
		end
	
		if(@IsDbo <> 0)
		begin
			if(@UIDFound is null or USER_NAME(@UIDFound) is null) -- invalid principal_id
			begin
				select @ShouldChangeUID = 1 ;
			end
		end

		-- update dds data			
		update dbo.sysdiagrams set definition = @definition where diagram_id = @DiagId ;

		-- change owner
		if(@ShouldChangeUID = 1)
			update dbo.sysdiagrams set principal_id = @theId where diagram_id = @DiagId ;

		-- update dds version
		if(@version is not null)
			update dbo.sysdiagrams set version = @version where diagram_id = @DiagId ;

		return 0
	END
	
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Extended Property microsoft_database_tools_support on sp_alterdiagram
Print 'Create Extended Property microsoft_database_tools_support on sp_alterdiagram'
GO
EXEC sp_addextendedproperty 'microsoft_database_tools_support', 1, 'SCHEMA', 'dbo', 'PROCEDURE', 'sp_alterdiagram', NULL, NULL
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Procedure sp_creatediagram
Print 'Create Procedure sp_creatediagram'
GO
	CREATE PROCEDURE [dbo].sp_creatediagram
	(
		@diagramname 	sysname,
		@owner_id		int	= null, 	
		@version 		int,
		@definition 	varbinary(max)
	)
	WITH EXECUTE AS 'dbo'
	AS
	BEGIN
		set nocount on
	
		declare @theId int
		declare @retval int
		declare @IsDbo	int
		declare @userName sysname
		if(@version is null or @diagramname is null)
		begin
			RAISERROR (N'E_INVALIDARG', 16, 1);
			return -1
		end
	
		execute as caller;
		select @theId = DATABASE_PRINCIPAL_ID(); 
		select @IsDbo = IS_MEMBER(N'db_owner');
		revert; 
		
		if @owner_id is null
		begin
			select @owner_id = @theId;
		end
		else
		begin
			if @theId <> @owner_id
			begin
				if @IsDbo = 0
				begin
					RAISERROR (N'E_INVALIDARG', 16, 1);
					return -1
				end
				select @theId = @owner_id
			end
		end
		-- next 2 line only for test, will be removed after define name unique
		if EXISTS(select diagram_id from dbo.sysdiagrams where principal_id = @theId and name = @diagramname)
		begin
			RAISERROR ('The name is already used.', 16, 1);
			return -2
		end
	
		insert into dbo.sysdiagrams(name, principal_id , version, definition)
				VALUES(@diagramname, @theId, @version, @definition) ;
		
		select @retval = @@IDENTITY 
		return @retval
	END
	
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Extended Property microsoft_database_tools_support on sp_creatediagram
Print 'Create Extended Property microsoft_database_tools_support on sp_creatediagram'
GO
EXEC sp_addextendedproperty 'microsoft_database_tools_support', 1, 'SCHEMA', 'dbo', 'PROCEDURE', 'sp_creatediagram', NULL, NULL
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Procedure sp_dropdiagram
Print 'Create Procedure sp_dropdiagram'
GO
	CREATE PROCEDURE [dbo].sp_dropdiagram
	(
		@diagramname 	sysname,
		@owner_id	int	= null
	)
	WITH EXECUTE AS 'dbo'
	AS
	BEGIN
		set nocount on
		declare @theId 			int
		declare @IsDbo 			int
		
		declare @UIDFound 		int
		declare @DiagId			int
	
		if(@diagramname is null)
		begin
			RAISERROR ('Invalid value', 16, 1);
			return -1
		end
	
		EXECUTE AS CALLER;
		select @theId = DATABASE_PRINCIPAL_ID();
		select @IsDbo = IS_MEMBER(N'db_owner'); 
		if(@owner_id is null)
			select @owner_id = @theId;
		REVERT; 
		
		select @DiagId = diagram_id, @UIDFound = principal_id from dbo.sysdiagrams where principal_id = @owner_id and name = @diagramname 
		if(@DiagId IS NULL or (@IsDbo = 0 and @UIDFound <> @theId))
		begin
			RAISERROR ('Diagram does not exist or you do not have permission.', 16, 1)
			return -3
		end
	
		delete from dbo.sysdiagrams where diagram_id = @DiagId;
	
		return 0;
	END
	
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Extended Property microsoft_database_tools_support on sp_dropdiagram
Print 'Create Extended Property microsoft_database_tools_support on sp_dropdiagram'
GO
EXEC sp_addextendedproperty 'microsoft_database_tools_support', 1, 'SCHEMA', 'dbo', 'PROCEDURE', 'sp_dropdiagram', NULL, NULL
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Procedure sp_helpdiagramdefinition
Print 'Create Procedure sp_helpdiagramdefinition'
GO
	CREATE PROCEDURE [dbo].sp_helpdiagramdefinition
	(
		@diagramname 	sysname,
		@owner_id	int	= null 		
	)
	WITH EXECUTE AS N'dbo'
	AS
	BEGIN
		set nocount on

		declare @theId 		int
		declare @IsDbo 		int
		declare @DiagId		int
		declare @UIDFound	int
	
		if(@diagramname is null)
		begin
			RAISERROR (N'E_INVALIDARG', 16, 1);
			return -1
		end
	
		execute as caller;
		select @theId = DATABASE_PRINCIPAL_ID();
		select @IsDbo = IS_MEMBER(N'db_owner');
		if(@owner_id is null)
			select @owner_id = @theId;
		revert; 
	
		select @DiagId = diagram_id, @UIDFound = principal_id from dbo.sysdiagrams where principal_id = @owner_id and name = @diagramname;
		if(@DiagId IS NULL or (@IsDbo = 0 and @UIDFound <> @theId ))
		begin
			RAISERROR ('Diagram does not exist or you do not have permission.', 16, 1);
			return -3
		end

		select version, definition FROM dbo.sysdiagrams where diagram_id = @DiagId ; 
		return 0
	END
	
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Extended Property microsoft_database_tools_support on sp_helpdiagramdefinition
Print 'Create Extended Property microsoft_database_tools_support on sp_helpdiagramdefinition'
GO
EXEC sp_addextendedproperty 'microsoft_database_tools_support', 1, 'SCHEMA', 'dbo', 'PROCEDURE', 'sp_helpdiagramdefinition', NULL, NULL
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Procedure sp_helpdiagrams
Print 'Create Procedure sp_helpdiagrams'
GO
	CREATE PROCEDURE [dbo].sp_helpdiagrams
	(
		@diagramname sysname = NULL,
		@owner_id int = NULL
	)
	WITH EXECUTE AS N'dbo'
	AS
	BEGIN
		DECLARE @user sysname
		DECLARE @dboLogin bit
		EXECUTE AS CALLER;
			SET @user = USER_NAME();
			SET @dboLogin = CONVERT(bit,IS_MEMBER('db_owner'));
		REVERT;
		SELECT
			[Database] = DB_NAME(),
			[Name] = name,
			[ID] = diagram_id,
			[Owner] = USER_NAME(principal_id),
			[OwnerID] = principal_id
		FROM
			sysdiagrams
		WHERE
			(@dboLogin = 1 OR USER_NAME(principal_id) = @user) AND
			(@diagramname IS NULL OR name = @diagramname) AND
			(@owner_id IS NULL OR principal_id = @owner_id)
		ORDER BY
			4, 5, 1
	END
	
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Extended Property microsoft_database_tools_support on sp_helpdiagrams
Print 'Create Extended Property microsoft_database_tools_support on sp_helpdiagrams'
GO
EXEC sp_addextendedproperty 'microsoft_database_tools_support', 1, 'SCHEMA', 'dbo', 'PROCEDURE', 'sp_helpdiagrams', NULL, NULL
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Procedure sp_renamediagram
Print 'Create Procedure sp_renamediagram'
GO
	CREATE PROCEDURE [dbo].sp_renamediagram
	(
		@diagramname 		sysname,
		@owner_id		int	= null,
		@new_diagramname	sysname
	
	)
	WITH EXECUTE AS 'dbo'
	AS
	BEGIN
		set nocount on
		declare @theId 			int
		declare @IsDbo 			int
		
		declare @UIDFound 		int
		declare @DiagId			int
		declare @DiagIdTarg		int
		declare @u_name			sysname
		if((@diagramname is null) or (@new_diagramname is null))
		begin
			RAISERROR ('Invalid value', 16, 1);
			return -1
		end
	
		EXECUTE AS CALLER;
		select @theId = DATABASE_PRINCIPAL_ID();
		select @IsDbo = IS_MEMBER(N'db_owner'); 
		if(@owner_id is null)
			select @owner_id = @theId;
		REVERT;
	
		select @u_name = USER_NAME(@owner_id)
	
		select @DiagId = diagram_id, @UIDFound = principal_id from dbo.sysdiagrams where principal_id = @owner_id and name = @diagramname 
		if(@DiagId IS NULL or (@IsDbo = 0 and @UIDFound <> @theId))
		begin
			RAISERROR ('Diagram does not exist or you do not have permission.', 16, 1)
			return -3
		end
	
		-- if((@u_name is not null) and (@new_diagramname = @diagramname))	-- nothing will change
		--	return 0;
	
		if(@u_name is null)
			select @DiagIdTarg = diagram_id from dbo.sysdiagrams where principal_id = @theId and name = @new_diagramname
		else
			select @DiagIdTarg = diagram_id from dbo.sysdiagrams where principal_id = @owner_id and name = @new_diagramname
	
		if((@DiagIdTarg is not null) and  @DiagId <> @DiagIdTarg)
		begin
			RAISERROR ('The name is already used.', 16, 1);
			return -2
		end		
	
		if(@u_name is null)
			update dbo.sysdiagrams set [name] = @new_diagramname, principal_id = @theId where diagram_id = @DiagId
		else
			update dbo.sysdiagrams set [name] = @new_diagramname where diagram_id = @DiagId
		return 0
	END
	
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Extended Property microsoft_database_tools_support on sp_renamediagram
Print 'Create Extended Property microsoft_database_tools_support on sp_renamediagram'
GO
EXEC sp_addextendedproperty 'microsoft_database_tools_support', 1, 'SCHEMA', 'dbo', 'PROCEDURE', 'sp_renamediagram', NULL, NULL
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Procedure sp_upgraddiagrams
Print 'Create Procedure sp_upgraddiagrams'
GO
	CREATE PROCEDURE [dbo].sp_upgraddiagrams
	AS
	BEGIN
		IF OBJECT_ID(N'dbo.sysdiagrams') IS NOT NULL
			return 0;
	
		CREATE TABLE dbo.sysdiagrams
		(
			name sysname NOT NULL,
			principal_id int NOT NULL,	-- we may change it to varbinary(85)
			diagram_id int PRIMARY KEY IDENTITY,
			version int,
	
			definition varbinary(max)
			CONSTRAINT UK_principal_name UNIQUE
			(
				principal_id,
				name
			)
		);


		/* Add this if we need to have some form of extended properties for diagrams */
		/*
		IF OBJECT_ID(N'dbo.sysdiagram_properties') IS NULL
		BEGIN
			CREATE TABLE dbo.sysdiagram_properties
			(
				diagram_id int,
				name sysname,
				value varbinary(max) NOT NULL
			)
		END
		*/

		IF OBJECT_ID(N'dbo.dtproperties') IS NOT NULL
		begin
			insert into dbo.sysdiagrams
			(
				[name],
				[principal_id],
				[version],
				[definition]
			)
			select	 
				convert(sysname, dgnm.[uvalue]),
				DATABASE_PRINCIPAL_ID(N'dbo'),			-- will change to the sid of sa
				0,							-- zero for old format, dgdef.[version],
				dgdef.[lvalue]
			from dbo.[dtproperties] dgnm
				inner join dbo.[dtproperties] dggd on dggd.[property] = 'DtgSchemaGUID' and dggd.[objectid] = dgnm.[objectid]	
				inner join dbo.[dtproperties] dgdef on dgdef.[property] = 'DtgSchemaDATA' and dgdef.[objectid] = dgnm.[objectid]
				
			where dgnm.[property] = 'DtgSchemaNAME' and dggd.[uvalue] like N'_EA3E6268-D998-11CE-9454-00AA00A3F36E_' 
			return 2;
		end
		return 1;
	END
	
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Extended Property microsoft_database_tools_support on sp_upgraddiagrams
Print 'Create Extended Property microsoft_database_tools_support on sp_upgraddiagrams'
GO
EXEC sp_addextendedproperty 'microsoft_database_tools_support', 1, 'SCHEMA', 'dbo', 'PROCEDURE', 'sp_upgraddiagrams', NULL, NULL
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Table Address
Print 'Create Table Address'
GO
CREATE TABLE [dbo].[Address] (
		[AddressId]     uniqueidentifier NOT NULL,
		[Address1]      varchar(100) NOT NULL,
		[Address2]      varchar(100) NULL,
		[City]          varchar(100) NOT NULL,
		[State]         varchar(100) NOT NULL,
		[ZipCode]       varchar(50) NOT NULL,
		[Country]       varchar(50) NOT NULL
)
ON [PRIMARY]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Add Primary Key PK_Address to Address
Print 'Add Primary Key PK_Address to Address'
GO
ALTER TABLE [dbo].[Address]
	ADD
	CONSTRAINT [PK_Address]
	PRIMARY KEY
	([AddressId])
	ON [PRIMARY]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Add Default Constraint DF_Address_AddressId to Address
Print 'Add Default Constraint DF_Address_AddressId to Address'
GO
ALTER TABLE [dbo].[Address]
	ADD
	CONSTRAINT [DF_Address_AddressId]
	DEFAULT (newid()) FOR [AddressId]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Table Character
Print 'Create Table Character'
GO
CREATE TABLE [dbo].[Character] (
		[CharacterId]     uniqueidentifier NOT NULL,
		[SpeciesId]       uniqueidentifier NOT NULL,
		[MotherId]        uniqueidentifier NULL,
		[FatherId]        uniqueidentifier NULL,
		[Name]            varchar(100) NOT NULL,
		[Gender]          varchar(50) NOT NULL,
		[Notes]           text NULL,
		[Email]           varchar(50) NULL,
		[Occupation]      varchar(50) NULL,
		[Age]             int NULL
)
ON [PRIMARY]
TEXTIMAGE_ON [PRIMARY]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Add Primary Key PK_Table1 to Character
Print 'Add Primary Key PK_Table1 to Character'
GO
ALTER TABLE [dbo].[Character]
	ADD
	CONSTRAINT [PK_Table1]
	PRIMARY KEY
	([CharacterId])
	ON [PRIMARY]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Add Default Constraint DF_Character_CharacterId to Character
Print 'Add Default Constraint DF_Character_CharacterId to Character'
GO
ALTER TABLE [dbo].[Character]
	ADD
	CONSTRAINT [DF_Character_CharacterId]
	DEFAULT (newid()) FOR [CharacterId]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING OFF
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Table CharacterAddress
Print 'Create Table CharacterAddress'
GO
CREATE TABLE [dbo].[CharacterAddress] (
		[CharacterAddressId]     uniqueidentifier NOT NULL,
		[CharacterId]            uniqueidentifier NOT NULL,
		[AddressId]              uniqueidentifier NOT NULL,
		[IsPrimary]              bit NOT NULL
)
ON [PRIMARY]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Add Primary Key PK_CharacterAddress to CharacterAddress
Print 'Add Primary Key PK_CharacterAddress to CharacterAddress'
GO
ALTER TABLE [dbo].[CharacterAddress]
	ADD
	CONSTRAINT [PK_CharacterAddress]
	PRIMARY KEY
	([CharacterAddressId])
	ON [PRIMARY]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Add Default Constraint DF_CharacterAddress_CharacterAddress to CharacterAddress
Print 'Add Default Constraint DF_CharacterAddress_CharacterAddress to CharacterAddress'
GO
ALTER TABLE [dbo].[CharacterAddress]
	ADD
	CONSTRAINT [DF_CharacterAddress_CharacterAddress]
	DEFAULT (newid()) FOR [CharacterAddressId]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING OFF
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Table CharacterEnchantment
Print 'Create Table CharacterEnchantment'
GO
CREATE TABLE [dbo].[CharacterEnchantment] (
		[CharacterEnchantmentId]     uniqueidentifier NOT NULL,
		[CasterId]                   uniqueidentifier NULL,
		[SubjectId]                  uniqueidentifier NOT NULL,
		[EnchantmentId]              uniqueidentifier NOT NULL,
		[DurationInYears]            decimal(18, 0) NULL,
		[Cure]                       text NULL
)
ON [PRIMARY]
TEXTIMAGE_ON [PRIMARY]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Add Primary Key PK_CharacterEnchantment to CharacterEnchantment
Print 'Add Primary Key PK_CharacterEnchantment to CharacterEnchantment'
GO
ALTER TABLE [dbo].[CharacterEnchantment]
	ADD
	CONSTRAINT [PK_CharacterEnchantment]
	PRIMARY KEY
	([CharacterEnchantmentId])
	ON [PRIMARY]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Add Default Constraint DF_CharacterEnchantment_CharacterEnchantmentId to CharacterEnchantment
Print 'Add Default Constraint DF_CharacterEnchantment_CharacterEnchantmentId to CharacterEnchantment'
GO
ALTER TABLE [dbo].[CharacterEnchantment]
	ADD
	CONSTRAINT [DF_CharacterEnchantment_CharacterEnchantmentId]
	DEFAULT (newid()) FOR [CharacterEnchantmentId]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING OFF
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Table CharacterStory
Print 'Create Table CharacterStory'
GO
CREATE TABLE [dbo].[CharacterStory] (
		[CharacterStoryId]     uniqueidentifier NOT NULL,
		[CharacterId]          uniqueidentifier NOT NULL,
		[StoryId]              uniqueidentifier NOT NULL,
		[IsMajorCharacter]     bit NOT NULL
)
ON [PRIMARY]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Add Primary Key PK_CharacterStory to CharacterStory
Print 'Add Primary Key PK_CharacterStory to CharacterStory'
GO
ALTER TABLE [dbo].[CharacterStory]
	ADD
	CONSTRAINT [PK_CharacterStory]
	PRIMARY KEY
	([CharacterStoryId])
	ON [PRIMARY]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Add Default Constraint DF_CharacterStory_CharacterStoryId to CharacterStory
Print 'Add Default Constraint DF_CharacterStory_CharacterStoryId to CharacterStory'
GO
ALTER TABLE [dbo].[CharacterStory]
	ADD
	CONSTRAINT [DF_CharacterStory_CharacterStoryId]
	DEFAULT (newid()) FOR [CharacterStoryId]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING OFF
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Table CharacterWish
Print 'Create Table CharacterWish'
GO
CREATE TABLE [dbo].[CharacterWish] (
		[CharacterWishId]     uniqueidentifier NOT NULL,
		[CharacterId]         uniqueidentifier NOT NULL,
		[WishId]              uniqueidentifier NOT NULL,
		[Description]         text NULL,
		[EndedHappily]        bit NOT NULL
)
ON [PRIMARY]
TEXTIMAGE_ON [PRIMARY]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Add Primary Key PK_CharacterWish to CharacterWish
Print 'Add Primary Key PK_CharacterWish to CharacterWish'
GO
ALTER TABLE [dbo].[CharacterWish]
	ADD
	CONSTRAINT [PK_CharacterWish]
	PRIMARY KEY
	([CharacterWishId])
	ON [PRIMARY]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Add Default Constraint DF_CharacterWish_CharacterWishId to CharacterWish
Print 'Add Default Constraint DF_CharacterWish_CharacterWishId to CharacterWish'
GO
ALTER TABLE [dbo].[CharacterWish]
	ADD
	CONSTRAINT [DF_CharacterWish_CharacterWishId]
	DEFAULT (newid()) FOR [CharacterWishId]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Table Classification
Print 'Create Table Classification'
GO
CREATE TABLE [dbo].[Classification] (
		[ClassificationId]     uniqueidentifier NOT NULL,
		[Classification]       varchar(100) NOT NULL
)
ON [PRIMARY]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Add Primary Key PK_Classification to Classification
Print 'Add Primary Key PK_Classification to Classification'
GO
ALTER TABLE [dbo].[Classification]
	ADD
	CONSTRAINT [PK_Classification]
	PRIMARY KEY
	([ClassificationId])
	ON [PRIMARY]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Add Default Constraint DF_Table_1_Classification to Classification
Print 'Add Default Constraint DF_Table_1_Classification to Classification'
GO
ALTER TABLE [dbo].[Classification]
	ADD
	CONSTRAINT [DF_Table_1_Classification]
	DEFAULT (newid()) FOR [ClassificationId]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Table Enchantment
Print 'Create Table Enchantment'
GO
CREATE TABLE [dbo].[Enchantment] (
		[EnchantmentId]     uniqueidentifier NOT NULL,
		[Name]              varchar(300) NOT NULL,
		[LastModified]      timestamp NOT NULL
)
ON [PRIMARY]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Add Primary Key PK_Enchantment to Enchantment
Print 'Add Primary Key PK_Enchantment to Enchantment'
GO
ALTER TABLE [dbo].[Enchantment]
	ADD
	CONSTRAINT [PK_Enchantment]
	PRIMARY KEY
	([EnchantmentId])
	ON [PRIMARY]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Add Default Constraint DF_Enchantment_EnchantmentId to Enchantment
Print 'Add Default Constraint DF_Enchantment_EnchantmentId to Enchantment'
GO
ALTER TABLE [dbo].[Enchantment]
	ADD
	CONSTRAINT [DF_Enchantment_EnchantmentId]
	DEFAULT (newid()) FOR [EnchantmentId]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Table Ending
Print 'Create Table Ending'
GO
CREATE TABLE [dbo].[Ending] (
		[EndingId]       uniqueidentifier NOT NULL,
		[EndingType]     varchar(100) NOT NULL
)
ON [PRIMARY]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Add Primary Key PK_Ending to Ending
Print 'Add Primary Key PK_Ending to Ending'
GO
ALTER TABLE [dbo].[Ending]
	ADD
	CONSTRAINT [PK_Ending]
	PRIMARY KEY
	([EndingId])
	ON [PRIMARY]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Add Default Constraint DF_Ending_EndingId to Ending
Print 'Add Default Constraint DF_Ending_EndingId to Ending'
GO
ALTER TABLE [dbo].[Ending]
	ADD
	CONSTRAINT [DF_Ending_EndingId]
	DEFAULT (newid()) FOR [EndingId]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Table Location
Print 'Create Table Location'
GO
CREATE TABLE [dbo].[Location] (
		[LocationId]     uniqueidentifier NOT NULL,
		[Location]       varchar(100) NOT NULL
)
ON [PRIMARY]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Add Primary Key PK_Location to Location
Print 'Add Primary Key PK_Location to Location'
GO
ALTER TABLE [dbo].[Location]
	ADD
	CONSTRAINT [PK_Location]
	PRIMARY KEY
	([LocationId])
	ON [PRIMARY]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Add Default Constraint DF_Location_LocationId to Location
Print 'Add Default Constraint DF_Location_LocationId to Location'
GO
ALTER TABLE [dbo].[Location]
	ADD
	CONSTRAINT [DF_Location_LocationId]
	DEFAULT (newid()) FOR [LocationId]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Table Source
Print 'Create Table Source'
GO
CREATE TABLE [dbo].[Source] (
		[SourceId]            uniqueidentifier NOT NULL,
		[Author]              varchar(100) NOT NULL,
		[CountryOfOrigin]     varchar(100) NOT NULL
)
ON [PRIMARY]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Add Primary Key PK_Source to Source
Print 'Add Primary Key PK_Source to Source'
GO
ALTER TABLE [dbo].[Source]
	ADD
	CONSTRAINT [PK_Source]
	PRIMARY KEY
	([SourceId])
	ON [PRIMARY]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Add Default Constraint DF_Table_1_AuthorId to Source
Print 'Add Default Constraint DF_Table_1_AuthorId to Source'
GO
ALTER TABLE [dbo].[Source]
	ADD
	CONSTRAINT [DF_Table_1_AuthorId]
	DEFAULT (newid()) FOR [SourceId]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Table Species
Print 'Create Table Species'
GO
CREATE TABLE [dbo].[Species] (
		[SpeciesId]       uniqueidentifier NOT NULL,
		[Species]         varchar(100) NOT NULL,
		[Description]     text NULL,
		[Immortal]        bit NOT NULL
)
ON [PRIMARY]
TEXTIMAGE_ON [PRIMARY]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Add Primary Key PK_Species to Species
Print 'Add Primary Key PK_Species to Species'
GO
ALTER TABLE [dbo].[Species]
	ADD
	CONSTRAINT [PK_Species]
	PRIMARY KEY
	([SpeciesId])
	ON [PRIMARY]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Add Default Constraint DF_Species_SpeciesId to Species
Print 'Add Default Constraint DF_Species_SpeciesId to Species'
GO
ALTER TABLE [dbo].[Species]
	ADD
	CONSTRAINT [DF_Species_SpeciesId]
	DEFAULT (newid()) FOR [SpeciesId]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Table Story
Print 'Create Table Story'
GO
CREATE TABLE [dbo].[Story] (
		[StoryId]              uniqueidentifier NOT NULL,
		[EndingId]             uniqueidentifier NOT NULL,
		[ClassificationId]     uniqueidentifier NOT NULL,
		[SourceId]             uniqueidentifier NOT NULL,
		[Name]                 varchar(100) NOT NULL,
		[Summary]              text NOT NULL
)
ON [PRIMARY]
TEXTIMAGE_ON [PRIMARY]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Add Primary Key PK_Story to Story
Print 'Add Primary Key PK_Story to Story'
GO
ALTER TABLE [dbo].[Story]
	ADD
	CONSTRAINT [PK_Story]
	PRIMARY KEY
	([StoryId])
	ON [PRIMARY]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Add Default Constraint DF_Story_StoryId to Story
Print 'Add Default Constraint DF_Story_StoryId to Story'
GO
ALTER TABLE [dbo].[Story]
	ADD
	CONSTRAINT [DF_Story_StoryId]
	DEFAULT (newid()) FOR [StoryId]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING OFF
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Table StoryLocation
Print 'Create Table StoryLocation'
GO
CREATE TABLE [dbo].[StoryLocation] (
		[StoryLocationId]     uniqueidentifier NOT NULL,
		[LocationId]          uniqueidentifier NOT NULL,
		[StoryId]             uniqueidentifier NOT NULL
)
ON [PRIMARY]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Add Primary Key PK_StoryLocation to StoryLocation
Print 'Add Primary Key PK_StoryLocation to StoryLocation'
GO
ALTER TABLE [dbo].[StoryLocation]
	ADD
	CONSTRAINT [PK_StoryLocation]
	PRIMARY KEY
	([StoryLocationId])
	ON [PRIMARY]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Add Default Constraint DF_StoryLocation_StoryLocationId to StoryLocation
Print 'Add Default Constraint DF_StoryLocation_StoryLocationId to StoryLocation'
GO
ALTER TABLE [dbo].[StoryLocation]
	ADD
	CONSTRAINT [DF_StoryLocation_StoryLocationId]
	DEFAULT (newid()) FOR [StoryLocationId]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
SET ANSI_PADDING ON
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Table Wish
Print 'Create Table Wish'
GO
CREATE TABLE [dbo].[Wish] (
		[WishId]     uniqueidentifier NOT NULL,
		[Name]       varchar(100) NOT NULL
)
ON [PRIMARY]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Add Primary Key PK_Wish to Wish
Print 'Add Primary Key PK_Wish to Wish'
GO
ALTER TABLE [dbo].[Wish]
	ADD
	CONSTRAINT [PK_Wish]
	PRIMARY KEY
	([WishId])
	ON [PRIMARY]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Add Default Constraint DF_Wish_Wish to Wish
Print 'Add Default Constraint DF_Wish_Wish to Wish'
GO
ALTER TABLE [dbo].[Wish]
	ADD
	CONSTRAINT [DF_Wish_Wish]
	DEFAULT (newid()) FOR [WishId]
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO

-- Create Extended Property microsoft_database_tools_support on sysdiagrams
Print 'Create Extended Property microsoft_database_tools_support on sysdiagrams'
GO
EXEC sp_addextendedproperty 'microsoft_database_tools_support', 1, 'SCHEMA', 'dbo', 'TABLE', 'sysdiagrams', NULL, NULL
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO

-- Create Foreign Key FK_Character_Character_Father on Character
Print 'Create Foreign Key FK_Character_Character_Father on Character'
GO
IF OBJECT_ID(N'[dbo].[Character]') IS NOT NULL
	AND OBJECT_ID(N'[dbo].[Character]') IS NOT NULL
	AND OBJECT_ID(N'[FK_Character_Character_Father]') IS NULL
BEGIN
		ALTER TABLE [dbo].[Character]
			WITH NOCHECK
			ADD CONSTRAINT [FK_Character_Character_Father]
			FOREIGN KEY ([FatherId]) REFERENCES [dbo].[Character] ([CharacterId])
END
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Foreign Key FK_Character_Character_Mother on Character
Print 'Create Foreign Key FK_Character_Character_Mother on Character'
GO
IF OBJECT_ID(N'[dbo].[Character]') IS NOT NULL
	AND OBJECT_ID(N'[dbo].[Character]') IS NOT NULL
	AND OBJECT_ID(N'[FK_Character_Character_Mother]') IS NULL
BEGIN
		ALTER TABLE [dbo].[Character]
			WITH NOCHECK
			ADD CONSTRAINT [FK_Character_Character_Mother]
			FOREIGN KEY ([MotherId]) REFERENCES [dbo].[Character] ([CharacterId])
END
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Foreign Key FK_Character_Species on Character
Print 'Create Foreign Key FK_Character_Species on Character'
GO
IF OBJECT_ID(N'[dbo].[Character]') IS NOT NULL
	AND OBJECT_ID(N'[dbo].[Species]') IS NOT NULL
	AND OBJECT_ID(N'[FK_Character_Species]') IS NULL
BEGIN
		ALTER TABLE [dbo].[Character]
			WITH NOCHECK
			ADD CONSTRAINT [FK_Character_Species]
			FOREIGN KEY ([SpeciesId]) REFERENCES [dbo].[Species] ([SpeciesId])
END
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO

-- Create Foreign Key FK_CharacterAddress_Address on CharacterAddress
Print 'Create Foreign Key FK_CharacterAddress_Address on CharacterAddress'
GO
IF OBJECT_ID(N'[dbo].[CharacterAddress]') IS NOT NULL
	AND OBJECT_ID(N'[dbo].[Address]') IS NOT NULL
	AND OBJECT_ID(N'[FK_CharacterAddress_Address]') IS NULL
BEGIN
		ALTER TABLE [dbo].[CharacterAddress]
			WITH NOCHECK
			ADD CONSTRAINT [FK_CharacterAddress_Address]
			FOREIGN KEY ([AddressId]) REFERENCES [dbo].[Address] ([AddressId])
END
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Foreign Key FK_CharacterAddress_Character on CharacterAddress
Print 'Create Foreign Key FK_CharacterAddress_Character on CharacterAddress'
GO
IF OBJECT_ID(N'[dbo].[CharacterAddress]') IS NOT NULL
	AND OBJECT_ID(N'[dbo].[Character]') IS NOT NULL
	AND OBJECT_ID(N'[FK_CharacterAddress_Character]') IS NULL
BEGIN
		ALTER TABLE [dbo].[CharacterAddress]
			WITH NOCHECK
			ADD CONSTRAINT [FK_CharacterAddress_Character]
			FOREIGN KEY ([CharacterId]) REFERENCES [dbo].[Character] ([CharacterId])
END
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO

-- Create Foreign Key FK_CharacterEnchantment_Character_Caster on CharacterEnchantment
Print 'Create Foreign Key FK_CharacterEnchantment_Character_Caster on CharacterEnchantment'
GO
IF OBJECT_ID(N'[dbo].[CharacterEnchantment]') IS NOT NULL
	AND OBJECT_ID(N'[dbo].[Character]') IS NOT NULL
	AND OBJECT_ID(N'[FK_CharacterEnchantment_Character_Caster]') IS NULL
BEGIN
		ALTER TABLE [dbo].[CharacterEnchantment]
			WITH NOCHECK
			ADD CONSTRAINT [FK_CharacterEnchantment_Character_Caster]
			FOREIGN KEY ([CasterId]) REFERENCES [dbo].[Character] ([CharacterId])
END
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Foreign Key FK_CharacterEnchantment_Character_Subject on CharacterEnchantment
Print 'Create Foreign Key FK_CharacterEnchantment_Character_Subject on CharacterEnchantment'
GO
IF OBJECT_ID(N'[dbo].[CharacterEnchantment]') IS NOT NULL
	AND OBJECT_ID(N'[dbo].[Character]') IS NOT NULL
	AND OBJECT_ID(N'[FK_CharacterEnchantment_Character_Subject]') IS NULL
BEGIN
		ALTER TABLE [dbo].[CharacterEnchantment]
			WITH NOCHECK
			ADD CONSTRAINT [FK_CharacterEnchantment_Character_Subject]
			FOREIGN KEY ([SubjectId]) REFERENCES [dbo].[Character] ([CharacterId])
END
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Foreign Key FK_CharacterEnchantment_Enchantment on CharacterEnchantment
Print 'Create Foreign Key FK_CharacterEnchantment_Enchantment on CharacterEnchantment'
GO
IF OBJECT_ID(N'[dbo].[CharacterEnchantment]') IS NOT NULL
	AND OBJECT_ID(N'[dbo].[Enchantment]') IS NOT NULL
	AND OBJECT_ID(N'[FK_CharacterEnchantment_Enchantment]') IS NULL
BEGIN
		ALTER TABLE [dbo].[CharacterEnchantment]
			WITH NOCHECK
			ADD CONSTRAINT [FK_CharacterEnchantment_Enchantment]
			FOREIGN KEY ([EnchantmentId]) REFERENCES [dbo].[Enchantment] ([EnchantmentId])
END
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO

-- Create Foreign Key FK_CharacterStory_Character on CharacterStory
Print 'Create Foreign Key FK_CharacterStory_Character on CharacterStory'
GO
IF OBJECT_ID(N'[dbo].[CharacterStory]') IS NOT NULL
	AND OBJECT_ID(N'[dbo].[Character]') IS NOT NULL
	AND OBJECT_ID(N'[FK_CharacterStory_Character]') IS NULL
BEGIN
		ALTER TABLE [dbo].[CharacterStory]
			WITH NOCHECK
			ADD CONSTRAINT [FK_CharacterStory_Character]
			FOREIGN KEY ([CharacterId]) REFERENCES [dbo].[Character] ([CharacterId])
END
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Foreign Key FK_CharacterStory_Story on CharacterStory
Print 'Create Foreign Key FK_CharacterStory_Story on CharacterStory'
GO
IF OBJECT_ID(N'[dbo].[CharacterStory]') IS NOT NULL
	AND OBJECT_ID(N'[dbo].[Story]') IS NOT NULL
	AND OBJECT_ID(N'[FK_CharacterStory_Story]') IS NULL
BEGIN
		ALTER TABLE [dbo].[CharacterStory]
			WITH NOCHECK
			ADD CONSTRAINT [FK_CharacterStory_Story]
			FOREIGN KEY ([StoryId]) REFERENCES [dbo].[Story] ([StoryId])
END
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO

-- Create Foreign Key FK_CharacterWish_Character on CharacterWish
Print 'Create Foreign Key FK_CharacterWish_Character on CharacterWish'
GO
IF OBJECT_ID(N'[dbo].[CharacterWish]') IS NOT NULL
	AND OBJECT_ID(N'[dbo].[Character]') IS NOT NULL
	AND OBJECT_ID(N'[FK_CharacterWish_Character]') IS NULL
BEGIN
		ALTER TABLE [dbo].[CharacterWish]
			WITH NOCHECK
			ADD CONSTRAINT [FK_CharacterWish_Character]
			FOREIGN KEY ([CharacterId]) REFERENCES [dbo].[Character] ([CharacterId])
END
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Foreign Key FK_CharacterWish_Wish on CharacterWish
Print 'Create Foreign Key FK_CharacterWish_Wish on CharacterWish'
GO
IF OBJECT_ID(N'[dbo].[CharacterWish]') IS NOT NULL
	AND OBJECT_ID(N'[dbo].[Wish]') IS NOT NULL
	AND OBJECT_ID(N'[FK_CharacterWish_Wish]') IS NULL
BEGIN
		ALTER TABLE [dbo].[CharacterWish]
			WITH NOCHECK
			ADD CONSTRAINT [FK_CharacterWish_Wish]
			FOREIGN KEY ([WishId]) REFERENCES [dbo].[Wish] ([WishId])
END
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO

-- Create Foreign Key FK_Story_Classification on Story
Print 'Create Foreign Key FK_Story_Classification on Story'
GO
IF OBJECT_ID(N'[dbo].[Story]') IS NOT NULL
	AND OBJECT_ID(N'[dbo].[Classification]') IS NOT NULL
	AND OBJECT_ID(N'[FK_Story_Classification]') IS NULL
BEGIN
		ALTER TABLE [dbo].[Story]
			WITH NOCHECK
			ADD CONSTRAINT [FK_Story_Classification]
			FOREIGN KEY ([ClassificationId]) REFERENCES [dbo].[Classification] ([ClassificationId])
END
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Foreign Key FK_Story_Ending on Story
Print 'Create Foreign Key FK_Story_Ending on Story'
GO
IF OBJECT_ID(N'[dbo].[Story]') IS NOT NULL
	AND OBJECT_ID(N'[dbo].[Ending]') IS NOT NULL
	AND OBJECT_ID(N'[FK_Story_Ending]') IS NULL
BEGIN
		ALTER TABLE [dbo].[Story]
			WITH NOCHECK
			ADD CONSTRAINT [FK_Story_Ending]
			FOREIGN KEY ([EndingId]) REFERENCES [dbo].[Ending] ([EndingId])
END
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Foreign Key FK_Story_Source on Story
Print 'Create Foreign Key FK_Story_Source on Story'
GO
IF OBJECT_ID(N'[dbo].[Story]') IS NOT NULL
	AND OBJECT_ID(N'[dbo].[Source]') IS NOT NULL
	AND OBJECT_ID(N'[FK_Story_Source]') IS NULL
BEGIN
		ALTER TABLE [dbo].[Story]
			WITH NOCHECK
			ADD CONSTRAINT [FK_Story_Source]
			FOREIGN KEY ([SourceId]) REFERENCES [dbo].[Source] ([SourceId])
END
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO

-- Create Foreign Key FK_StoryLocation_Location on StoryLocation
Print 'Create Foreign Key FK_StoryLocation_Location on StoryLocation'
GO
IF OBJECT_ID(N'[dbo].[StoryLocation]') IS NOT NULL
	AND OBJECT_ID(N'[dbo].[Location]') IS NOT NULL
	AND OBJECT_ID(N'[FK_StoryLocation_Location]') IS NULL
BEGIN
		ALTER TABLE [dbo].[StoryLocation]
			WITH NOCHECK
			ADD CONSTRAINT [FK_StoryLocation_Location]
			FOREIGN KEY ([LocationId]) REFERENCES [dbo].[Location] ([LocationId])
END
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO
-- Create Foreign Key FK_StoryLocation_Story on StoryLocation
Print 'Create Foreign Key FK_StoryLocation_Story on StoryLocation'
GO
IF OBJECT_ID(N'[dbo].[StoryLocation]') IS NOT NULL
	AND OBJECT_ID(N'[dbo].[Story]') IS NOT NULL
	AND OBJECT_ID(N'[FK_StoryLocation_Story]') IS NULL
BEGIN
		ALTER TABLE [dbo].[StoryLocation]
			WITH NOCHECK
			ADD CONSTRAINT [FK_StoryLocation_Story]
			FOREIGN KEY ([StoryId]) REFERENCES [dbo].[Story] ([StoryId])
END
GO
IF @@ERROR<>0 OR @@TRANCOUNT=0 BEGIN
	IF @@TRANCOUNT>0
		ROLLBACK
	
	SET NOEXEC ON
END
GO

-- COMMITTING TRANSACTION STRUCTURE
PRINT 'Committing transaction STRUCTURE'
IF @@TRANCOUNT>0
	COMMIT TRANSACTION _STRUCTURE_
GO

SET NOEXEC OFF
-- BEGINNING TRANSACTION DATA
PRINT 'Beginning transaction DATA'
BEGIN TRANSACTION _DATA_
GO


SET NOCOUNT ON
GO

-- Disabling all Constraints
Print 'Disabling all Constraints'
exec sp_MSforeachtable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL'

-- Disabling all Triggers
Print 'Disabling all Triggers'
exec sp_MSforeachtable 'ALTER TABLE ? DISABLE TRIGGER ALL'


-- Deleting from table: sysdiagrams
PRINT 'Deleting from table: sysdiagrams'
DELETE FROM [dbo].[sysdiagrams]
-- Deleting from table: Address
PRINT 'Deleting from table: Address'
DELETE FROM [dbo].[Address]
-- Deleting from table: Character
PRINT 'Deleting from table: Character'
DELETE FROM [dbo].[Character]
-- Deleting from table: CharacterAddress
PRINT 'Deleting from table: CharacterAddress'
DELETE FROM [dbo].[CharacterAddress]
-- Deleting from table: CharacterEnchantment
PRINT 'Deleting from table: CharacterEnchantment'
DELETE FROM [dbo].[CharacterEnchantment]
-- Deleting from table: CharacterStory
PRINT 'Deleting from table: CharacterStory'
DELETE FROM [dbo].[CharacterStory]
-- Deleting from table: CharacterWish
PRINT 'Deleting from table: CharacterWish'
DELETE FROM [dbo].[CharacterWish]
-- Deleting from table: Classification
PRINT 'Deleting from table: Classification'
DELETE FROM [dbo].[Classification]
-- Deleting from table: Enchantment
PRINT 'Deleting from table: Enchantment'
DELETE FROM [dbo].[Enchantment]
-- Deleting from table: Ending
PRINT 'Deleting from table: Ending'
DELETE FROM [dbo].[Ending]
-- Deleting from table: Location
PRINT 'Deleting from table: Location'
DELETE FROM [dbo].[Location]
-- Deleting from table: Source
PRINT 'Deleting from table: Source'
DELETE FROM [dbo].[Source]
-- Deleting from table: Species
PRINT 'Deleting from table: Species'
DELETE FROM [dbo].[Species]
-- Deleting from table: Story
PRINT 'Deleting from table: Story'
DELETE FROM [dbo].[Story]
-- Deleting from table: StoryLocation
PRINT 'Deleting from table: StoryLocation'
DELETE FROM [dbo].[StoryLocation]
-- Deleting from table: Wish
PRINT 'Deleting from table: Wish'
DELETE FROM [dbo].[Wish]

-- Insert scripts for table: sysdiagrams
PRINT 'Inserting rows into table: sysdiagrams'
SET IDENTITY_INSERT [dbo].[sysdiagrams] ON

INSERT INTO [dbo].[sysdiagrams] ([version], [principal_id], [definition], [name], [diagram_id]) VALUES (1, 1,  , N'FolktaleDB', 5)

SET IDENTITY_INSERT [dbo].[sysdiagrams] OFF


-- Insert scripts for table: Address
PRINT 'Inserting rows into table: Address'
INSERT INTO [dbo].[Address] ([Address1], [Address2], [ZipCode], [State], [AddressId], [City], [Country]) VALUES ('24', 'Midwife Lane', '911911', 'Longwalk', 'a044b8b1-474e-4b8c-a4d5-015fed8c5b4d', 'Dead End', 'Mictlan')
INSERT INTO [dbo].[Address] ([Address1], [Address2], [ZipCode], [State], [AddressId], [City], [Country]) VALUES ('Woodcutter''s Cottage', 'Forest Edge', '637412', 'Ginger Bread', '3132f46d-3b96-41d6-ad61-103b8b0c5b30', 'Pebble Town', 'Lithuania')
INSERT INTO [dbo].[Address] ([Address1], [Address2], [ZipCode], [State], [AddressId], [City], [Country]) VALUES ('Tintagil Castle', NULL, '1350', 'Cornwall', 'a64e0d8f-6b82-4c2e-9b6f-14b1d3da841c', 'Tintagil', 'Britain')
INSERT INTO [dbo].[Address] ([Address1], [Address2], [ZipCode], [State], [AddressId], [City], [Country]) VALUES ('Lower Slopes', 'Mount Olympus', '12346', 'Pieria', 'deaf6d85-6cf0-488f-ad1e-2616fd03b156', 'Litochoro', 'Greece')
INSERT INTO [dbo].[Address] ([Address1], [Address2], [ZipCode], [State], [AddressId], [City], [Country]) VALUES ('The Underworld', 'Mount Olympos', '12346', 'Pieria', 'acea322c-d220-42ad-bdfa-2f17f8e17f46', 'Litochoro', 'Greece')
INSERT INTO [dbo].[Address] ([Address1], [Address2], [ZipCode], [State], [AddressId], [City], [Country]) VALUES ('Herbthief''s House', 'Edge Of Garden', '1417', 'Bremen', 'ffa48905-3053-47ab-9eb0-35fd89e7b4a5', 'Herbstown', 'Germany')
INSERT INTO [dbo].[Address] ([Address1], [Address2], [ZipCode], [State], [AddressId], [City], [Country]) VALUES ('Bread Cottage', 'Sugarwindow', '637485', 'Ginger Bread', '9996bf4b-b025-4a0a-8e28-4a7a8d434d88', 'Breadcrumb Town', 'Lithuania')
INSERT INTO [dbo].[Address] ([Address1], [Address2], [ZipCode], [State], [AddressId], [City], [Country]) VALUES ('Tall  Tower', 'Secluded Forest', '14175', 'Bremen', 'aec4efd9-bb15-465b-acb3-4e17f4ef73bf', 'Herbstown', 'Germany')
INSERT INTO [dbo].[Address] ([Address1], [Address2], [ZipCode], [State], [AddressId], [City], [Country]) VALUES ('The Feathery Lair', 'Serpent''s Slither', 'SSS HSS', 'Snakeshire', 'c0bf0c86-0d89-41d1-ba1e-55d65993087c', 'Hissville', 'Skyland')
INSERT INTO [dbo].[Address] ([Address1], [Address2], [ZipCode], [State], [AddressId], [City], [Country]) VALUES ('The Cottage', 'Forest Clearing', '98765', 'The Borough', '9a7d6c12-bb3f-47ad-82ae-7d08321a0020', 'Woodsland', 'Germany')
INSERT INTO [dbo].[Address] ([Address1], [Address2], [ZipCode], [State], [AddressId], [City], [Country]) VALUES ('1 Mitikas', 'Mount Olympus', '12346', 'Pieria', 'dbcf630b-8806-4806-a8db-7d19b08ce34b', 'Litochoro', 'Greece')
INSERT INTO [dbo].[Address] ([Address1], [Address2], [ZipCode], [State], [AddressId], [City], [Country]) VALUES ('17b The Scullery', 'High Street', '171819', 'Pumpkinshire', 'bdeb56b7-6ca8-4c6c-974a-9171d8bcdf8a', 'Storyville', 'France')
INSERT INTO [dbo].[Address] ([Address1], [Address2], [ZipCode], [State], [AddressId], [City], [Country]) VALUES ('Royal Chambers', 'The Keep', '1485', 'Somerset', '574651df-a903-415e-8b61-a87e6dd66539', 'Camelot', 'Britain')
INSERT INTO [dbo].[Address] ([Address1], [Address2], [ZipCode], [State], [AddressId], [City], [Country]) VALUES ('Giant''s Lair', 'The Cedar Forest', '3000', 'Sumer', '95f61971-ae68-4980-a988-aed89f6b9225', 'Uruk', 'Mesopotamia')
INSERT INTO [dbo].[Address] ([Address1], [Address2], [ZipCode], [State], [AddressId], [City], [Country]) VALUES ('The Ziggurat', 'Mud Brick Lane', '3001', 'Sumer', 'c66cfabf-98e7-4ccb-b910-af7129fc6267', 'Uruk', 'Mesopotamia')
INSERT INTO [dbo].[Address] ([Address1], [Address2], [ZipCode], [State], [AddressId], [City], [Country]) VALUES ('Sacred Fireplace', 'Mount Olympus', '12346', 'Pieria', '9c4e35f6-493c-486b-b110-ca21aa0c35da', 'Litochoro', 'Greece')
INSERT INTO [dbo].[Address] ([Address1], [Address2], [ZipCode], [State], [AddressId], [City], [Country]) VALUES ('Terrabil Castle', NULL, '1357', 'Cornwall', 'a24357b8-8c98-46d8-a416-d6966b10fbea', 'Tintagil', 'Britain')
INSERT INTO [dbo].[Address] ([Address1], [Address2], [ZipCode], [State], [AddressId], [City], [Country]) VALUES ('The Unkempt Shack', 'Desert Wilderness', '1618', 'Sandyview', 'fade8a0f-65ab-4671-a2c5-f2e8139bdaf2', 'Aridland', 'Prussia')
INSERT INTO [dbo].[Address] ([Address1], [Address2], [ZipCode], [State], [AddressId], [City], [Country]) VALUES ('Magic Mirror Castle', 'Royal Enclave', '1768', 'Seven Mountains', 'a9222487-88ca-447d-95c8-f7b0c114d441', 'Fairview', 'Germany')
INSERT INTO [dbo].[Address] ([Address1], [Address2], [ZipCode], [State], [AddressId], [City], [Country]) VALUES ('1630 Revello Drive', NULL, '90000', 'California', 'aacd129e-3db2-46d0-938d-fc4a9188e566', 'Sunnydale', 'USA')

-- Insert scripts for table: Character
PRINT 'Inserting rows into table: Character'
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Former supreme god', 'cronus@titan.org', 'Dethroned', NULL, '82b270f3-7fef-48db-a293-4683dfe8ef3e', 'c95e2f0b-0742-4103-a112-00aa96d1a9d2', 'Cronus', 2600, 'fe5fcfbc-ecf8-41fe-9bf2-1fbbcbaccb78', 'Male')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Goddess of the harvest', 'demeter@olympus.com', '', 'c95e2f0b-0742-4103-a112-00aa96d1a9d2', '82b270f3-7fef-48db-a293-4683dfe8ef3e', '5a5be6ef-798c-41e0-a0f0-0c45c62aef7e', 'Demeter', NULL, '86d8535f-7e73-42da-841c-28319ff9637e', 'Female')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Wife of Arthur, King of Britain', 'Guenevere@camelot.co.uk', 'It''s a shame she didn''t meet Lancelot first.', NULL, '8c55f0c8-6588-4fec-9c55-f7ee8ae40d22', 'b32b4258-9e90-45c7-9a2b-104157bf86b6', 'Guenevere', NULL, NULL, 'Female')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Titaness', 'metis@firstwives.org', 'First wife of Zeus', NULL, '82b270f3-7fef-48db-a293-4683dfe8ef3e', 'e416f088-4184-435f-a55f-155298fefe8d', 'Metis', NULL, NULL, 'Female')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Goddess of wisdom', 'athena@olympus.com', 'Goddess of practical crafts and warfare; also patron goddess of Athens', '0518164a-7b64-480c-ac99-cdf8a4fe4e88', '82b270f3-7fef-48db-a293-4683dfe8ef3e', '9f240ee8-4435-495c-9592-17efa1a8161b', 'Athena', NULL, NULL, 'Female')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Goddess of love', 'aphrodite@olympus.com', 'Also goddess of beauty and protecter of sailors', '0518164a-7b64-480c-ac99-cdf8a4fe4e88', '82b270f3-7fef-48db-a293-4683dfe8ef3e', '86f20c1b-7458-4dd5-8dce-181c47b79657', 'Aphrodite', NULL, '207e9842-6aed-48a6-81e7-ed0869f52e48', 'Female')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('College student and witch', NULL, 'Buffy''s best friend', NULL, 'ee3a08b4-e93e-452a-8f74-1e5fdff3db50', '7e4d655d-185d-4196-b8e2-1afd195396bf', 'Willow', NULL, NULL, 'Female')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('God of fire', 'hephaestus@olympus.com', 'Also god of metalworking.  Created Pandora, the first woman.', '0518164a-7b64-480c-ac99-cdf8a4fe4e88', '82b270f3-7fef-48db-a293-4683dfe8ef3e', '6520481c-38ef-47a1-961d-1b0950ee3d9d', 'Hephaestus', NULL, '7a75e647-e2c4-4cdf-86e4-a7530ae9a99b', 'Male')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Mother earth', NULL, NULL, NULL, '82b270f3-7fef-48db-a293-4683dfe8ef3e', 'fe5fcfbc-ecf8-41fe-9bf2-1fbbcbaccb78', 'Gaea', NULL, NULL, 'Female')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES (NULL, NULL, NULL, NULL, '82b270f3-7fef-48db-a293-4683dfe8ef3e', '86d8535f-7e73-42da-841c-28319ff9637e', 'Rhea', 2598, 'fe5fcfbc-ecf8-41fe-9bf2-1fbbcbaccb78', 'Female')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Household drudge', 'cinderella@scullery.com', 'Despised stepdaughter', NULL, '8c55f0c8-6588-4fec-9c55-f7ee8ae40d22', 'bc68ceff-0bc8-44ad-ac2d-2e1a52efe41d', 'Cinderella', 18, NULL, 'Female')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Rescuing hapless women', NULL, 'Usually thwarts evil stepmothers', NULL, '8c55f0c8-6588-4fec-9c55-f7ee8ae40d22', '22547990-f666-4963-aa72-3094c4608e58', 'Handsome Prince', NULL, NULL, 'Male')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('personification of nature', '', NULL, NULL, '4bd30b54-14c3-4309-b9aa-a8affab95828', 'c13425ec-0750-43c7-b566-3cf6556bb272', 'Maia', NULL, NULL, 'Female')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Virtuous wife', 'griselda@unfortunatespouse.com', NULL, NULL, '8c55f0c8-6588-4fec-9c55-f7ee8ae40d22', '08b86864-1f01-4c0a-b482-3eb2a5e72383', 'Griselda', NULL, NULL, 'Female')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Duke of Tintagil', NULL, 'Life expectancy sadly short after Uther Pendragon saw the Duchess', NULL, '8c55f0c8-6588-4fec-9c55-f7ee8ae40d22', '4b541188-dbff-4034-8aaa-514f8b6a698b', 'Sir Jordanus', NULL, NULL, 'Male')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Arthur''s half-sister', NULL, 'Successfully plot''s Arthur''s downfall', NULL, '8c55f0c8-6588-4fec-9c55-f7ee8ae40d22', 'b2629d13-5457-4186-9a63-567730fa6ce5', 'Margawse', NULL, NULL, 'Female')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('King of Britain', NULL, NULL, NULL, '8c55f0c8-6588-4fec-9c55-f7ee8ae40d22', 'e0b752f5-5f70-47be-929a-56e81788385f', 'Uther Pendragon', NULL, NULL, 'Male')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Protector of Cedar Forest', NULL, 'Had a monstrous faces; protected by seven layers of terrifying radiance.', NULL, 'b73ff788-21c7-49a0-8e23-81f89c4e693c', 'defb20b8-83ce-4352-a86c-5e8fa3bbde7c', 'Huwawa', NULL, NULL, 'Male')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('God of wine', 'dionysus@olympus.com', 'Also god of drama', '0518164a-7b64-480c-ac99-cdf8a4fe4e88', '82b270f3-7fef-48db-a293-4683dfe8ef3e', '8a46a005-bb78-491c-b727-5ed42a3e9933', 'Dionysus', NULL, 'a6deb0f8-e65c-47e2-bcda-949cccf65fe6', 'Male')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('God of war', 'ares@olympus.com', 'Handsome but cruel', '0518164a-7b64-480c-ac99-cdf8a4fe4e88', '82b270f3-7fef-48db-a293-4683dfe8ef3e', 'fdd08c64-64d2-4cf7-9abf-5ed9c1af104a', 'Ares', NULL, '7a75e647-e2c4-4cdf-86e4-a7530ae9a99b', 'Male')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Intended to be Gilgamesh''s nemesis', 'enkidu@uruk.com', 'Becomes Gilgamesh''s closest friend. Created by Anu so Anu is sort of his father.', '0b91b0e1-6855-41f9-92b9-aa24bb8aea33', '8c55f0c8-6588-4fec-9c55-f7ee8ae40d22', '000d3d58-69a9-47af-bd17-5efa003fe90c', 'Enkidu', NULL, NULL, 'Male')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('God of the sea', 'poseidon@underwater.com', 'Also god of earthquakes and horses. Spends most of his time in the sea.', 'c95e2f0b-0742-4103-a112-00aa96d1a9d2', '82b270f3-7fef-48db-a293-4683dfe8ef3e', '96ac274f-36d5-4bf1-9de0-61d558483d21', 'Poseidon', NULL, '86d8535f-7e73-42da-841c-28319ff9637e', 'Male')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Enchantress and life coach', 'fg@happyeverafter.co.uk', NULL, NULL, '61f40c7f-6191-4407-a9d8-4cb97f5495de', '00423445-8761-44f8-a24e-65335a00a728', 'Fairy godmother', NULL, NULL, 'Female')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('God of prophecy', 'apollo@olympus.com', 'Also god of music', '0518164a-7b64-480c-ac99-cdf8a4fe4e88', '82b270f3-7fef-48db-a293-4683dfe8ef3e', 'b665e501-2ca7-4033-85c4-69e484d19260', 'Apollo', NULL, 'fad2b51e-b6ec-4586-966e-fe8d5b0badc5', 'Male')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Feathered serpent and sky god', NULL, 'Created universe; later became morning star', NULL, '82b270f3-7fef-48db-a293-4683dfe8ef3e', 'e2300593-76a7-4030-975a-6ee51e8089dd', 'Quetzalcoatl', NULL, '553df60a-2f58-44d0-bfa2-c1562d5d8673', 'Male')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Intended to destroy Gilgamesh', NULL, 'Created by Anu for his daughter Inana', NULL, '13926f90-f2de-4995-b91d-82bd5620bfc7', 'f163b084-ebc4-4760-a2a1-6f77087477a6', 'Bull of Heaven', NULL, NULL, 'Male')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Goddess of the underworld', 'persephone@reluctantlyunderworld.com', NULL, '0518164a-7b64-480c-ac99-cdf8a4fe4e88', '82b270f3-7fef-48db-a293-4683dfe8ef3e', '39e50617-c50a-4cd8-a5b2-7529e7b8ea40', 'Persephone', NULL, '5a5be6ef-798c-41e0-a0f0-0c45c62aef7e', 'Female')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Sky god', NULL, 'First ruler of the gods before Cronus', NULL, '82b270f3-7fef-48db-a293-4683dfe8ef3e', 'a34d805e-fe60-4b98-bad9-77f2b95143af', 'Uranus', NULL, 'fe5fcfbc-ecf8-41fe-9bf2-1fbbcbaccb78', 'Male')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Cruelty to husband''s children', 'evilstepmother@plotdevice.com', 'Rarely survives intact to the end of a story.', NULL, '8c55f0c8-6588-4fec-9c55-f7ee8ae40d22', '9340ee4a-0afc-4313-b7a7-84d1d74749fa', 'Evil Stepmother', NULL, NULL, 'Female')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Princess and housekeeper', 'snowwhite@evilstepmother.com', NULL, NULL, '8c55f0c8-6588-4fec-9c55-f7ee8ae40d22', 'ce086468-f0da-4d74-abb6-8520505e77f7', 'Snow White', 17, NULL, 'Female')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Magician and meddler in British monarchy', NULL, 'Used "sword in stone" trick to pick his own king', NULL, '5593a0da-a259-4df7-beea-7ae8c18727a6', '26d44d5a-e188-4784-87e4-86d432ca47e6', 'Merlin', NULL, NULL, 'Male')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Small abandoned child', 'hansel@lostinthewoods.com', 'Hobbies include arson and jewellery theft', NULL, '8c55f0c8-6588-4fec-9c55-f7ee8ae40d22', '46c2bb06-8344-462a-a2e5-8e4b00bea032', 'Hansel', 11, NULL, 'Male')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Goddess of the hunt', 'artemis@olympus.com', 'Goddess of the moon', '0518164a-7b64-480c-ac99-cdf8a4fe4e88', '82b270f3-7fef-48db-a293-4683dfe8ef3e', 'bc9b329a-1369-493c-8de0-92d5e9a71f4c', 'Artemis', NULL, 'fad2b51e-b6ec-4586-966e-fe8d5b0badc5', 'Female')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Hapless mortal', 'semele@fieryend.net', NULL, NULL, '8c55f0c8-6588-4fec-9c55-f7ee8ae40d22', 'a6deb0f8-e65c-47e2-bcda-949cccf65fe6', 'Semele', NULL, NULL, 'Female')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Deified former King of Uruk', NULL, 'Apparently was a shepherd who ruled Uruk for 1200 years', NULL, '82b270f3-7fef-48db-a293-4683dfe8ef3e', '044e8f2d-120f-46cf-9db0-99155f49135a', 'Lugalbanda', NULL, NULL, 'Male')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Sacred fire attendant', NULL, 'Unusually placid for an Olympian', NULL, '82b270f3-7fef-48db-a293-4683dfe8ef3e', '69e8dca9-5ac5-46cd-82d6-9ecd4c8a62f6', 'Hestia', NULL, NULL, 'Female')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Wanted to be King of England but failed to usurp.', NULL, 'Not close to his father.', 'ca6667c5-d0b1-4960-a93c-cfdb56a0ce9c', '8c55f0c8-6588-4fec-9c55-f7ee8ae40d22', '703b0d2f-1992-4fc7-9b46-9fe40749c005', 'Mordred', NULL, 'b2629d13-5457-4186-9a63-567730fa6ce5', 'Male')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Wife of Sir Jordanus, Duke of Tintagil', NULL, 'Unpleasantly deceived by Uther Pendragon', NULL, '8c55f0c8-6588-4fec-9c55-f7ee8ae40d22', '762b6f84-1b8a-4eaf-92dd-a3ff70f5a044', 'Igraine', NULL, NULL, 'Female')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Goddess of marriage', 'hera@olympus.com', 'Wife of Zeus and Queen of the Olympians', 'c95e2f0b-0742-4103-a112-00aa96d1a9d2', '82b270f3-7fef-48db-a293-4683dfe8ef3e', '7a75e647-e2c4-4cdf-86e4-a7530ae9a99b', 'Hera', NULL, '86d8535f-7e73-42da-841c-28319ff9637e', 'Female')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Sky god;  leader of the gods', NULL, 'Anu took over heaven when it was separated from earth.', NULL, '82b270f3-7fef-48db-a293-4683dfe8ef3e', '0b91b0e1-6855-41f9-92b9-aa24bb8aea33', 'Anu', NULL, NULL, 'Male')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Possibly goddess of wild cattle.', NULL, 'Wife of Lugalbanda. Name means "lady wild cow"', NULL, '82b270f3-7fef-48db-a293-4683dfe8ef3e', 'a730d561-f5ea-4808-aa6f-abd940fa5525', 'Ninsun', NULL, NULL, 'Female')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Goddess of life and death', NULL, 'Wears live snakeskin clothing', NULL, '82b270f3-7fef-48db-a293-4683dfe8ef3e', '553df60a-2f58-44d0-bfa2-c1562d5d8673', 'Coatlicue', NULL, NULL, 'Female')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('God', 'zeus@olympus.com', 'Supreme god of the ancient Greek pantheon', 'c95e2f0b-0742-4103-a112-00aa96d1a9d2', '82b270f3-7fef-48db-a293-4683dfe8ef3e', '0518164a-7b64-480c-ac99-cdf8a4fe4e88', 'Zeus', 2357, '86d8535f-7e73-42da-841c-28319ff9637e', 'Male')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Mayhem, mischief, spite, cannibalism', NULL, 'Often come to unpleasant ends', NULL, 'ee3a08b4-e93e-452a-8f74-1e5fdff3db50', '147f40aa-c0ee-4148-8489-cf975c5ecb1a', 'Wicked Witch', NULL, NULL, 'Female')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('King of Britain', NULL, 'Took an unlikely route to kingship. Unobservant.', 'e0b752f5-5f70-47be-929a-56e81788385f', '8c55f0c8-6588-4fec-9c55-f7ee8ae40d22', 'ca6667c5-d0b1-4960-a93c-cfdb56a0ce9c', 'Arthur', NULL, '762b6f84-1b8a-4eaf-92dd-a3ff70f5a044', 'Male')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Small abandoned child', 'Gretel@lostinthewoods.com', NULL, NULL, '8c55f0c8-6588-4fec-9c55-f7ee8ae40d22', 'b5f629c8-1660-4ad4-ad09-d1c9be5d59ce', 'Gretel', 10, NULL, 'Female')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Hunter, possibly prince.', NULL, 'Sadly eaten by own dogs.', NULL, '8c55f0c8-6588-4fec-9c55-f7ee8ae40d22', '1cc03ed6-d8a4-4334-b516-d9aa5a6663a5', 'Actaeon', NULL, NULL, 'Male')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Messenger of the gods', 'hermes@olympus.com', 'Guides souls to the underworld', '0518164a-7b64-480c-ac99-cdf8a4fe4e88', '82b270f3-7fef-48db-a293-4683dfe8ef3e', '39956d66-0254-4a0c-bb01-d9d0a3b9a945', 'Hermes', NULL, 'c13425ec-0750-43c7-b566-3cf6556bb272', 'Male')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Damsel in distress', 'rapunzel@enclosedtower.co.uk', 'Due to an (unnaturally) sheltered childhood, spends a lot of time dreaming about hair care products', NULL, '8c55f0c8-6588-4fec-9c55-f7ee8ae40d22', '3ff4f437-585a-46cc-9253-da6f56441bc5', 'Rapunzel', 24, NULL, 'Female')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Ruler of the underworld', 'hades@underworld.net', 'Not popular with other gods and goddesses', 'c95e2f0b-0742-4103-a112-00aa96d1a9d2', '82b270f3-7fef-48db-a293-4683dfe8ef3e', '788a4c49-9db3-4cb4-888d-e46131bb1f17', 'Hades', NULL, '86d8535f-7e73-42da-841c-28319ff9637e', 'Male')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Vampire slayer', 'buffy@slayer.com', 'Californian superhero', NULL, '8c55f0c8-6588-4fec-9c55-f7ee8ae40d22', 'bb1885ae-331a-44e1-b2c0-ebb5a212aee9', 'Buffy', 21, NULL, 'Female')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Possibly king of Uruk; later a god', 'gilgamesh@uruk.com', 'Was allegedly an oppressive king', '044e8f2d-120f-46cf-9db0-99155f49135a', '80802ec4-8cc6-4588-af3a-900b270bf623', '0fe6aac7-67a3-4885-819b-ecd9bd622ed0', 'Gilgamesh', NULL, 'a730d561-f5ea-4808-aa6f-abd940fa5525', 'Male')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Uncertain - may have been a Titaness', NULL, 'Became one of Saturn''s moons in 1684', NULL, '82b270f3-7fef-48db-a293-4683dfe8ef3e', '207e9842-6aed-48a6-81e7-ed0869f52e48', 'Dione', NULL, NULL, 'Female')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Goddess of midwives', NULL, 'Also helped to create human race', NULL, '82b270f3-7fef-48db-a293-4683dfe8ef3e', 'c20ac754-26f6-42b7-bd78-ef1dde2ce084', 'Cihuacoatl', NULL, NULL, 'Female')
INSERT INTO [dbo].[Character] ([Occupation], [Email], [Notes], [FatherId], [SpeciesId], [CharacterId], [Name], [Age], [MotherId], [Gender]) VALUES ('Principle goddess of Lycia', NULL, NULL, NULL, '82b270f3-7fef-48db-a293-4683dfe8ef3e', 'fad2b51e-b6ec-4586-966e-fe8d5b0badc5', 'Leto', NULL, NULL, 'Female')

-- Insert scripts for table: CharacterAddress
PRINT 'Inserting rows into table: CharacterAddress'
INSERT INTO [dbo].[CharacterAddress] ([CharacterId], [AddressId], [CharacterAddressId], [IsPrimary]) VALUES ('bc68ceff-0bc8-44ad-ac2d-2e1a52efe41d', 'bdeb56b7-6ca8-4c6c-974a-9171d8bcdf8a', '37631920-5a7f-4d4d-8fb9-080bfed8107e', 1)
INSERT INTO [dbo].[CharacterAddress] ([CharacterId], [AddressId], [CharacterAddressId], [IsPrimary]) VALUES ('39e50617-c50a-4cd8-a5b2-7529e7b8ea40', 'acea322c-d220-42ad-bdfa-2f17f8e17f46', 'bb9ec32f-21c0-4e41-9e3f-0a0780014d4e', 0)
INSERT INTO [dbo].[CharacterAddress] ([CharacterId], [AddressId], [CharacterAddressId], [IsPrimary]) VALUES ('3ff4f437-585a-46cc-9253-da6f56441bc5', 'ffa48905-3053-47ab-9eb0-35fd89e7b4a5', 'e323b702-7ed0-4e18-a0fb-0c3c20047a1f', 0)
INSERT INTO [dbo].[CharacterAddress] ([CharacterId], [AddressId], [CharacterAddressId], [IsPrimary]) VALUES ('69e8dca9-5ac5-46cd-82d6-9ecd4c8a62f6', '9c4e35f6-493c-486b-b110-ca21aa0c35da', '59205702-995c-45fd-a0f5-281b4cc668c5', 1)
INSERT INTO [dbo].[CharacterAddress] ([CharacterId], [AddressId], [CharacterAddressId], [IsPrimary]) VALUES ('3ff4f437-585a-46cc-9253-da6f56441bc5', 'aec4efd9-bb15-465b-acb3-4e17f4ef73bf', '3a3289c0-f333-4a59-9efc-2d955d5ec637', 1)
INSERT INTO [dbo].[CharacterAddress] ([CharacterId], [AddressId], [CharacterAddressId], [IsPrimary]) VALUES ('46c2bb06-8344-462a-a2e5-8e4b00bea032', '9996bf4b-b025-4a0a-8e28-4a7a8d434d88', 'd6ffdc64-d3ca-41e8-92e3-3cbb7fc62cf3', 0)
INSERT INTO [dbo].[CharacterAddress] ([CharacterId], [AddressId], [CharacterAddressId], [IsPrimary]) VALUES ('39e50617-c50a-4cd8-a5b2-7529e7b8ea40', 'deaf6d85-6cf0-488f-ad1e-2616fd03b156', '502019d0-08b5-41d0-8fbe-3e739bd8d43e', 0)
INSERT INTO [dbo].[CharacterAddress] ([CharacterId], [AddressId], [CharacterAddressId], [IsPrimary]) VALUES ('ce086468-f0da-4d74-abb6-8520505e77f7', '9a7d6c12-bb3f-47ad-82ae-7d08321a0020', 'cdc28076-547a-4a58-83f7-3ef51cf383a1', 0)
INSERT INTO [dbo].[CharacterAddress] ([CharacterId], [AddressId], [CharacterAddressId], [IsPrimary]) VALUES ('e2300593-76a7-4030-975a-6ee51e8089dd', 'c0bf0c86-0d89-41d1-ba1e-55d65993087c', 'd9ee4102-95ae-4c4b-b022-436f184148c3', 1)
INSERT INTO [dbo].[CharacterAddress] ([CharacterId], [AddressId], [CharacterAddressId], [IsPrimary]) VALUES ('bb1885ae-331a-44e1-b2c0-ebb5a212aee9', 'aacd129e-3db2-46d0-938d-fc4a9188e566', '986aa5f0-b8bb-4580-bbb7-49929468941e', 1)
INSERT INTO [dbo].[CharacterAddress] ([CharacterId], [AddressId], [CharacterAddressId], [IsPrimary]) VALUES ('4b541188-dbff-4034-8aaa-514f8b6a698b', 'a24357b8-8c98-46d8-a416-d6966b10fbea', '24a30979-7e71-4073-b31d-51b59e361e6b', 0)
INSERT INTO [dbo].[CharacterAddress] ([CharacterId], [AddressId], [CharacterAddressId], [IsPrimary]) VALUES ('b5f629c8-1660-4ad4-ad09-d1c9be5d59ce', '3132f46d-3b96-41d6-ad61-103b8b0c5b30', 'f0d7d51f-640b-46cc-a8ce-5d3dc84a692b', 1)
INSERT INTO [dbo].[CharacterAddress] ([CharacterId], [AddressId], [CharacterAddressId], [IsPrimary]) VALUES ('0518164a-7b64-480c-ac99-cdf8a4fe4e88', 'dbcf630b-8806-4806-a8db-7d19b08ce34b', 'cc9710ad-b308-4730-b680-60272f522eae', 1)
INSERT INTO [dbo].[CharacterAddress] ([CharacterId], [AddressId], [CharacterAddressId], [IsPrimary]) VALUES ('3ff4f437-585a-46cc-9253-da6f56441bc5', 'fade8a0f-65ab-4671-a2c5-f2e8139bdaf2', 'f3ec1d35-96d0-444c-9d16-69468b002c37', 0)
INSERT INTO [dbo].[CharacterAddress] ([CharacterId], [AddressId], [CharacterAddressId], [IsPrimary]) VALUES ('defb20b8-83ce-4352-a86c-5e8fa3bbde7c', '95f61971-ae68-4980-a988-aed89f6b9225', 'c5cf5e32-494c-482d-9e36-721376439bfb', 1)
INSERT INTO [dbo].[CharacterAddress] ([CharacterId], [AddressId], [CharacterAddressId], [IsPrimary]) VALUES ('ca6667c5-d0b1-4960-a93c-cfdb56a0ce9c', '574651df-a903-415e-8b61-a87e6dd66539', 'a85268b8-ff5b-42b1-8482-7a5dd2ffd75b', 1)
INSERT INTO [dbo].[CharacterAddress] ([CharacterId], [AddressId], [CharacterAddressId], [IsPrimary]) VALUES ('b32b4258-9e90-45c7-9a2b-104157bf86b6', '574651df-a903-415e-8b61-a87e6dd66539', '9257e4cf-61a7-46bd-bd18-8c243f1c2dd9', 1)
INSERT INTO [dbo].[CharacterAddress] ([CharacterId], [AddressId], [CharacterAddressId], [IsPrimary]) VALUES ('ce086468-f0da-4d74-abb6-8520505e77f7', 'a9222487-88ca-447d-95c8-f7b0c114d441', '4f51ed7f-0999-48be-b479-93f4b2e458a0', 1)
INSERT INTO [dbo].[CharacterAddress] ([CharacterId], [AddressId], [CharacterAddressId], [IsPrimary]) VALUES ('c20ac754-26f6-42b7-bd78-ef1dde2ce084', 'a044b8b1-474e-4b8c-a4d5-015fed8c5b4d', '08a27bd7-1259-4459-95bf-985007a67991', 1)
INSERT INTO [dbo].[CharacterAddress] ([CharacterId], [AddressId], [CharacterAddressId], [IsPrimary]) VALUES ('0fe6aac7-67a3-4885-819b-ecd9bd622ed0', 'c66cfabf-98e7-4ccb-b910-af7129fc6267', '9051e908-1154-4f31-98d0-a19492e28c65', 1)
INSERT INTO [dbo].[CharacterAddress] ([CharacterId], [AddressId], [CharacterAddressId], [IsPrimary]) VALUES ('147f40aa-c0ee-4148-8489-cf975c5ecb1a', '9996bf4b-b025-4a0a-8e28-4a7a8d434d88', '6ec39799-c7f1-458b-9ede-b05bee2b87b4', 1)
INSERT INTO [dbo].[CharacterAddress] ([CharacterId], [AddressId], [CharacterAddressId], [IsPrimary]) VALUES ('788a4c49-9db3-4cb4-888d-e46131bb1f17', 'acea322c-d220-42ad-bdfa-2f17f8e17f46', 'ec544180-3de4-4df7-89ce-b827921ef67e', 1)
INSERT INTO [dbo].[CharacterAddress] ([CharacterId], [AddressId], [CharacterAddressId], [IsPrimary]) VALUES ('46c2bb06-8344-462a-a2e5-8e4b00bea032', '3132f46d-3b96-41d6-ad61-103b8b0c5b30', '479e7ceb-e2b7-428d-b3be-d271a6e888c4', 1)
INSERT INTO [dbo].[CharacterAddress] ([CharacterId], [AddressId], [CharacterAddressId], [IsPrimary]) VALUES ('762b6f84-1b8a-4eaf-92dd-a3ff70f5a044', 'a64e0d8f-6b82-4c2e-9b6f-14b1d3da841c', '8c3ae3e7-062b-4415-b79a-ec14d0301625', 1)
INSERT INTO [dbo].[CharacterAddress] ([CharacterId], [AddressId], [CharacterAddressId], [IsPrimary]) VALUES ('b5f629c8-1660-4ad4-ad09-d1c9be5d59ce', '9996bf4b-b025-4a0a-8e28-4a7a8d434d88', '442312dd-c852-45ef-9208-fbae3efa3cb5', 0)

-- Insert scripts for table: CharacterEnchantment
PRINT 'Inserting rows into table: CharacterEnchantment'
INSERT INTO [dbo].[CharacterEnchantment] ([Cure], [CasterId], [CharacterEnchantmentId], [SubjectId], [DurationInYears], [EnchantmentId]) VALUES ('Effect is temporary', '26d44d5a-e188-4784-87e4-86d432ca47e6', '5ca74562-e3e6-4a6d-ac82-00fa1784bca1', 'e0b752f5-5f70-47be-929a-56e81788385f', 0.0, '0bfc5d8c-ed8c-4c69-a60d-4eb310781bc0')
INSERT INTO [dbo].[CharacterEnchantment] ([Cure], [CasterId], [CharacterEnchantmentId], [SubjectId], [DurationInYears], [EnchantmentId]) VALUES ('Ended with Rapunzel''s conception', '147f40aa-c0ee-4148-8489-cf975c5ecb1a', '6d7a2315-f5c8-4fe9-81a3-32e95ec8ebd3', '3ff4f437-585a-46cc-9253-da6f56441bc5', 0.0, 'fdc061b0-ad1f-420a-8509-d174e5984918')
INSERT INTO [dbo].[CharacterEnchantment] ([Cure], [CasterId], [CharacterEnchantmentId], [SubjectId], [DurationInYears], [EnchantmentId]) VALUES ('This lasts as long as Rapunzel does, as it''s how she came to be born.', '147f40aa-c0ee-4148-8489-cf975c5ecb1a', '650a93fc-b458-4f53-9a94-3b9aa7864243', '3ff4f437-585a-46cc-9253-da6f56441bc5', 0.0, '38f49b5b-ee47-4687-90e2-bf29c283b4aa')
INSERT INTO [dbo].[CharacterEnchantment] ([Cure], [CasterId], [CharacterEnchantmentId], [SubjectId], [DurationInYears], [EnchantmentId]) VALUES ('Removing uneaten apple', '9340ee4a-0afc-4313-b7a7-84d1d74749fa', 'df35a48f-297d-4fde-aa7a-4dbb15177b5f', 'ce086468-f0da-4d74-abb6-8520505e77f7', 100.0, '28c242d8-b16e-4ea6-9b37-9df9451fff37')
INSERT INTO [dbo].[CharacterEnchantment] ([Cure], [CasterId], [CharacterEnchantmentId], [SubjectId], [DurationInYears], [EnchantmentId]) VALUES ('Find a loophole in the terms of the curse', '7a75e647-e2c4-4cdf-86e4-a7530ae9a99b', 'a45f6656-a315-4d9f-8685-566d7cf470e4', 'fad2b51e-b6ec-4586-966e-fe8d5b0badc5', 1.0, 'f2365380-7fa8-4c05-a1df-230643a9524a')
INSERT INTO [dbo].[CharacterEnchantment] ([Cure], [CasterId], [CharacterEnchantmentId], [SubjectId], [DurationInYears], [EnchantmentId]) VALUES ('It''s not intended to wear off as Buffy wants to go on holiday.', '7e4d655d-185d-4196-b8e2-1afd195396bf', '4bef6e5b-7b1a-4146-860e-85a2a5459683', 'bb1885ae-331a-44e1-b2c0-ebb5a212aee9', 0.0, '1a1411f1-d0af-4af4-aa14-32254de77625')
INSERT INTO [dbo].[CharacterEnchantment] ([Cure], [CasterId], [CharacterEnchantmentId], [SubjectId], [DurationInYears], [EnchantmentId]) VALUES ('Intended to be permanent', 'bc9b329a-1369-493c-8de0-92d5e9a71f4c', '105a17fe-f6cb-4754-89f7-c3807b3a7dba', '1cc03ed6-d8a4-4334-b516-d9aa5a6663a5', 60.0, 'cf855d1f-b402-4b56-a2c4-a5aa484ea080')
INSERT INTO [dbo].[CharacterEnchantment] ([Cure], [CasterId], [CharacterEnchantmentId], [SubjectId], [DurationInYears], [EnchantmentId]) VALUES ('Wears off at midnight', '00423445-8761-44f8-a24e-65335a00a728', '4165726a-a170-4932-89db-cf69676eff16', 'bc68ceff-0bc8-44ad-ac2d-2e1a52efe41d', 0.0, 'c9af2748-daac-4ef9-b0b1-320b148306df')
INSERT INTO [dbo].[CharacterEnchantment] ([Cure], [CasterId], [CharacterEnchantmentId], [SubjectId], [DurationInYears], [EnchantmentId]) VALUES ('Zeus can transform himself back', '0518164a-7b64-480c-ac99-cdf8a4fe4e88', '2c1ded99-d44d-4b85-9b05-d1045769399f', '0518164a-7b64-480c-ac99-cdf8a4fe4e88', 0.0, '585ac7e1-96a3-4bf4-9b26-fec62e5eb704')
INSERT INTO [dbo].[CharacterEnchantment] ([Cure], [CasterId], [CharacterEnchantmentId], [SubjectId], [DurationInYears], [EnchantmentId]) VALUES ('Removal of sword by rightful King', '26d44d5a-e188-4784-87e4-86d432ca47e6', '414b6f8f-df98-4849-9538-e334b39e22fd', 'ca6667c5-d0b1-4960-a93c-cfdb56a0ce9c', 20.0, '73c453b5-006b-4ad6-8ab3-cba14af678b3')
INSERT INTO [dbo].[CharacterEnchantment] ([Cure], [CasterId], [CharacterEnchantmentId], [SubjectId], [DurationInYears], [EnchantmentId]) VALUES ('Nobody wants to be cured of this!', NULL, 'b8c69350-52b6-4d21-a388-ee0b47b49f3b', 'bb1885ae-331a-44e1-b2c0-ebb5a212aee9', 0.0, 'b25b88b3-4386-48a4-9596-fb6293101a9e')
INSERT INTO [dbo].[CharacterEnchantment] ([Cure], [CasterId], [CharacterEnchantmentId], [SubjectId], [DurationInYears], [EnchantmentId]) VALUES ('Wears off at midnight', '00423445-8761-44f8-a24e-65335a00a728', 'fafa2982-8dc5-4892-a3bb-fa4ef7aaaf76', 'bc68ceff-0bc8-44ad-ac2d-2e1a52efe41d', 0.0, '7bc798ce-7ccd-4ef5-b9e3-b2c8899d6b65')

-- Insert scripts for table: CharacterStory
PRINT 'Inserting rows into table: CharacterStory'
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('044e8f2d-120f-46cf-9db0-99155f49135a', 0, 'cabd1c8c-84fc-49a1-9d49-c472ef1a496d', '34765c1b-b806-4405-9056-0dabcffee670')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('a730d561-f5ea-4808-aa6f-abd940fa5525', 0, 'cabd1c8c-84fc-49a1-9d49-c472ef1a496d', '8b928b4c-5d7f-424d-9b3e-12b3fdcf7c93')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('00423445-8761-44f8-a24e-65335a00a728', 0, 'da47837d-c6a5-490b-96cf-808137d0e760', '9010b987-32bc-4403-a1e0-1a5403b6d79e')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('ca6667c5-d0b1-4960-a93c-cfdb56a0ce9c', 1, 'a698b0b0-2745-4045-a16c-0b2927897890', '446c195b-e107-4a57-b993-1e7ee20c7d77')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('4b541188-dbff-4034-8aaa-514f8b6a698b', 0, 'fae426a4-5989-4429-9918-9cff85bd4b1f', 'beb55cf6-ecea-4590-8053-203b7f858f4b')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('9340ee4a-0afc-4313-b7a7-84d1d74749fa', 0, '05a61915-db96-4878-8e79-e8248c64aa23', '9c10d3ea-89f2-4f95-9b76-234df7980ed2')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('e0b752f5-5f70-47be-929a-56e81788385f', 0, 'fae426a4-5989-4429-9918-9cff85bd4b1f', '455cf8b9-d9aa-4d85-a7ee-2763e0d78409')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('22547990-f666-4963-aa72-3094c4608e58', 0, 'da47837d-c6a5-490b-96cf-808137d0e760', '1a02b48a-25d1-42bc-82a9-316079025d6c')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('ce086468-f0da-4d74-abb6-8520505e77f7', 1, '05a61915-db96-4878-8e79-e8248c64aa23', 'ee08d8d4-28af-4a1e-afc0-3194aca6b10a')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('ca6667c5-d0b1-4960-a93c-cfdb56a0ce9c', 1, 'fae426a4-5989-4429-9918-9cff85bd4b1f', '0ef97846-0483-4fa2-a284-3263b711815c')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('5a5be6ef-798c-41e0-a0f0-0c45c62aef7e', 0, 'cf9e9ed8-e279-4832-ae45-56d76bdf3a69', '9b493964-fa5d-460d-83d9-3682f3ca24ba')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('22547990-f666-4963-aa72-3094c4608e58', 0, '05a61915-db96-4878-8e79-e8248c64aa23', 'c2c528cc-d575-4437-b51a-3a4e1ce11622')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('703b0d2f-1992-4fc7-9b46-9fe40749c005', 0, 'a698b0b0-2745-4045-a16c-0b2927897890', 'ac9da42f-f20b-476f-8f7f-3a78ba2de1d1')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('86d8535f-7e73-42da-841c-28319ff9637e', 0, 'ad1c0dcb-5c9b-4bbb-8b5f-b732e60ac278', 'ec4e7523-7f97-4eaf-9499-3b1878259ed8')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('9340ee4a-0afc-4313-b7a7-84d1d74749fa', 0, 'bc800dbe-adfe-469a-ab16-f36a7dfce573', '7c574656-bb87-4231-8f5b-3d8b1ec268e3')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('5a5be6ef-798c-41e0-a0f0-0c45c62aef7e', 0, 'ad1c0dcb-5c9b-4bbb-8b5f-b732e60ac278', '5b2e667d-c57a-4431-9a5e-4279bc6d5e33')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('fad2b51e-b6ec-4586-966e-fe8d5b0badc5', 0, '8fe239f2-9caf-4b49-b727-332d8499054f', 'a206e348-0031-4b60-831b-46be1d7a7fc0')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('46c2bb06-8344-462a-a2e5-8e4b00bea032', 1, 'bc800dbe-adfe-469a-ab16-f36a7dfce573', '06f191fd-f6cb-4ea2-bbe3-4a76ab26b0cc')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('26d44d5a-e188-4784-87e4-86d432ca47e6', 0, 'fae426a4-5989-4429-9918-9cff85bd4b1f', '2766c783-c0a2-4a4e-9c8d-4bc01d9bf61c')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('b32b4258-9e90-45c7-9a2b-104157bf86b6', 0, 'a698b0b0-2745-4045-a16c-0b2927897890', 'dac34c1c-027c-4904-8ee0-4cac60f91b74')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('7e4d655d-185d-4196-b8e2-1afd195396bf', 0, '60dbd709-c899-4570-a3bc-a2ce089b7d20', '44b8fe76-41ca-405c-ab35-4d785aba4ac4')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('1cc03ed6-d8a4-4334-b516-d9aa5a6663a5', 0, '8fe239f2-9caf-4b49-b727-332d8499054f', '2a6cc8b1-5132-4e8d-b296-4ffdd217dd4b')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('bb1885ae-331a-44e1-b2c0-ebb5a212aee9', 1, '60dbd709-c899-4570-a3bc-a2ce089b7d20', '5e6f7513-cb6b-4001-b3f4-55506d4cb561')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('b5f629c8-1660-4ad4-ad09-d1c9be5d59ce', 1, 'bc800dbe-adfe-469a-ab16-f36a7dfce573', '38f5f30b-70a9-4b15-8c70-5c1c2607fd24')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('c20ac754-26f6-42b7-bd78-ef1dde2ce084', 0, '26c4af57-679c-48e3-809f-7ea0060796dd', 'aa532727-a3c3-4a53-89fe-646696a8e07d')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('147f40aa-c0ee-4148-8489-cf975c5ecb1a', 0, '0a065b0f-cde9-4bb3-b0ba-9d2d8a899edd', '23173429-d3c7-4f84-8c2a-67a6d0db0c2a')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('0fe6aac7-67a3-4885-819b-ecd9bd622ed0', 1, 'cabd1c8c-84fc-49a1-9d49-c472ef1a496d', '3f72f14c-fe07-4fd5-9584-6b3a0a07a24e')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('c95e2f0b-0742-4103-a112-00aa96d1a9d2', 0, 'ad1c0dcb-5c9b-4bbb-8b5f-b732e60ac278', '594e50ba-cb91-4de5-96d5-6e7b273c00fc')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('0518164a-7b64-480c-ac99-cdf8a4fe4e88', 0, '8fe239f2-9caf-4b49-b727-332d8499054f', '2925cb1b-c374-4cd8-b2ca-7601426fcd49')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('69e8dca9-5ac5-46cd-82d6-9ecd4c8a62f6', 0, 'ad1c0dcb-5c9b-4bbb-8b5f-b732e60ac278', 'bc41cc95-b43d-4c64-8354-7834e5fe05de')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('b2629d13-5457-4186-9a63-567730fa6ce5', 0, 'a698b0b0-2745-4045-a16c-0b2927897890', 'a64583a9-fae1-47a5-b1b4-7de68598c75a')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('0518164a-7b64-480c-ac99-cdf8a4fe4e88', 0, 'cf9e9ed8-e279-4832-ae45-56d76bdf3a69', '280c5a6d-e9b5-4f13-ac61-825f4e1522ae')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('defb20b8-83ce-4352-a86c-5e8fa3bbde7c', 0, 'cabd1c8c-84fc-49a1-9d49-c472ef1a496d', '6912c324-b5d7-4a22-94c0-85e62f347814')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('0518164a-7b64-480c-ac99-cdf8a4fe4e88', 1, 'ad1c0dcb-5c9b-4bbb-8b5f-b732e60ac278', '90e4bc1e-77b0-4ec6-a2ec-89c0a651da4c')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('3ff4f437-585a-46cc-9253-da6f56441bc5', 1, '0a065b0f-cde9-4bb3-b0ba-9d2d8a899edd', '7a5409ee-bc53-469d-9d20-8e0c9d5b5a27')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('762b6f84-1b8a-4eaf-92dd-a3ff70f5a044', 0, 'fae426a4-5989-4429-9918-9cff85bd4b1f', 'a577ef39-65d1-4a5e-bf76-8eb41415ce5b')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('e2300593-76a7-4030-975a-6ee51e8089dd', 1, '26c4af57-679c-48e3-809f-7ea0060796dd', 'd0aadac2-c76f-4c1e-a5ad-96c23ec502a0')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('b665e501-2ca7-4033-85c4-69e484d19260', 1, '8fe239f2-9caf-4b49-b727-332d8499054f', '729f2baa-c11a-4a45-9aca-a7f7bb44113a')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('e0b752f5-5f70-47be-929a-56e81788385f', 0, 'a698b0b0-2745-4045-a16c-0b2927897890', 'f165f020-07d9-40ad-88bd-aa21e2f3b2e8')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('bc9b329a-1369-493c-8de0-92d5e9a71f4c', 1, '8fe239f2-9caf-4b49-b727-332d8499054f', '0205a0ae-a7c8-48c4-b47c-aed1f9c0e340')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('7a75e647-e2c4-4cdf-86e4-a7530ae9a99b', 0, '8fe239f2-9caf-4b49-b727-332d8499054f', 'f85808ee-e19a-4d05-baae-b5b12fbeab99')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('9f240ee8-4435-495c-9592-17efa1a8161b', 1, '42e81a48-bcef-41e2-8d9a-4931cbcec5cf', '7bd8c25f-e338-4a42-802b-b5db88f6cdb1')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('f163b084-ebc4-4760-a2a1-6f77087477a6', 0, 'cabd1c8c-84fc-49a1-9d49-c472ef1a496d', '30cfce53-1642-4a07-9616-b5e50607499b')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('39e50617-c50a-4cd8-a5b2-7529e7b8ea40', 1, 'cf9e9ed8-e279-4832-ae45-56d76bdf3a69', '0650bb4c-6824-4e32-84d7-b74dfddf7b13')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('96ac274f-36d5-4bf1-9de0-61d558483d21', 0, 'ad1c0dcb-5c9b-4bbb-8b5f-b732e60ac278', '0e2d651f-490d-4c2c-ac93-bca46fd42f6c')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('788a4c49-9db3-4cb4-888d-e46131bb1f17', 0, 'ad1c0dcb-5c9b-4bbb-8b5f-b732e60ac278', 'ab99b226-dd66-46b1-82fc-bdfbf2203802')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('22547990-f666-4963-aa72-3094c4608e58', 0, '0a065b0f-cde9-4bb3-b0ba-9d2d8a899edd', 'aedbd68a-aa58-4aca-a01a-c0991e236341')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('5a5be6ef-798c-41e0-a0f0-0c45c62aef7e', 0, 'ad1c0dcb-5c9b-4bbb-8b5f-b732e60ac278', 'ab41d478-fc51-4f25-820a-c6f8e51d1179')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('553df60a-2f58-44d0-bfa2-c1562d5d8673', 0, '26c4af57-679c-48e3-809f-7ea0060796dd', 'ecefd422-be13-45be-8a32-c78d52894f4b')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('e416f088-4184-435f-a55f-155298fefe8d', 0, '42e81a48-bcef-41e2-8d9a-4931cbcec5cf', '2f5b5186-6c32-4b65-884f-cb3eef0af065')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('000d3d58-69a9-47af-bd17-5efa003fe90c', 0, 'cabd1c8c-84fc-49a1-9d49-c472ef1a496d', '67a8b6f0-d64e-4ec1-b7d2-d1a874c6f700')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('788a4c49-9db3-4cb4-888d-e46131bb1f17', 0, 'cf9e9ed8-e279-4832-ae45-56d76bdf3a69', 'd47f04ef-14c8-4308-b07c-dd5e74ad3666')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('0518164a-7b64-480c-ac99-cdf8a4fe4e88', 0, '42e81a48-bcef-41e2-8d9a-4931cbcec5cf', 'e601946f-cdec-49a5-9fdc-e0fb5c0485bd')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('9340ee4a-0afc-4313-b7a7-84d1d74749fa', 0, 'da47837d-c6a5-490b-96cf-808137d0e760', '46b3f86a-ca42-4686-8ecb-ed85f087f3c4')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('0b91b0e1-6855-41f9-92b9-aa24bb8aea33', 0, 'cabd1c8c-84fc-49a1-9d49-c472ef1a496d', 'e5549d11-e9d2-4020-a6dc-ef6b8d572f88')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('147f40aa-c0ee-4148-8489-cf975c5ecb1a', 0, 'bc800dbe-adfe-469a-ab16-f36a7dfce573', 'b81eb6c5-bc42-45ce-acc3-f87e71170c69')
INSERT INTO [dbo].[CharacterStory] ([CharacterId], [IsMajorCharacter], [StoryId], [CharacterStoryId]) VALUES ('bc68ceff-0bc8-44ad-ac2d-2e1a52efe41d', 1, 'da47837d-c6a5-490b-96cf-808137d0e760', 'da388515-432a-4751-94f8-fdadf6970a9f')

-- No records are in CharacterWish
PRINT 'No records are in CharacterWish'
-- Insert scripts for table: Classification
PRINT 'Inserting rows into table: Classification'
INSERT INTO [dbo].[Classification] ([ClassificationId], [Classification]) VALUES ('e56d7c37-c651-48bb-8d2e-254618218e15', 'Mesopotamian clay tablets')
INSERT INTO [dbo].[Classification] ([ClassificationId], [Classification]) VALUES ('34d3755d-09c0-4e98-ae09-3fd5b1b2cad8', 'Arthurian legend')
INSERT INTO [dbo].[Classification] ([ClassificationId], [Classification]) VALUES ('58815cce-d0bd-4476-9dd2-8066624fa9ea', 'Traditional')
INSERT INTO [dbo].[Classification] ([ClassificationId], [Classification]) VALUES ('2dc78540-2e24-4f56-8bc2-a39acba562e3', 'Greek mythology')
INSERT INTO [dbo].[Classification] ([ClassificationId], [Classification]) VALUES ('c332f89f-0113-4c53-8986-e3612b06bf13', 'Created for television')

-- Insert scripts for table: Enchantment
PRINT 'Inserting rows into table: Enchantment'
-- Warning - TIMESTAMP datatype not supported for Insert scripts
INSERT INTO [dbo].[Enchantment] ([Name], [EnchantmentId]) VALUES ('Condemned to roam earth', 'f2365380-7fa8-4c05-a1df-230643a9524a')
INSERT INTO [dbo].[Enchantment] ([Name], [EnchantmentId]) VALUES ('Turn carriage into pumpkin', 'c9af2748-daac-4ef9-b0b1-320b148306df')
INSERT INTO [dbo].[Enchantment] ([Name], [EnchantmentId]) VALUES ('Sharing superhuman powers', '1a1411f1-d0af-4af4-aa14-32254de77625')
INSERT INTO [dbo].[Enchantment] ([Name], [EnchantmentId]) VALUES ('Musical talent', '124d8dfb-b48a-4815-a9db-369912de6da9')
INSERT INTO [dbo].[Enchantment] ([Name], [EnchantmentId]) VALUES ('Change appearance', '0bfc5d8c-ed8c-4c69-a60d-4eb310781bc0')
INSERT INTO [dbo].[Enchantment] ([Name], [EnchantmentId]) VALUES ('Sleep for 100 years', '7672fbeb-680d-4620-93c4-5bcf6327af7a')
INSERT INTO [dbo].[Enchantment] ([Name], [EnchantmentId]) VALUES ('Wit', 'cd2a0c77-ee08-43f4-924f-5d08e5e9b1bc')
INSERT INTO [dbo].[Enchantment] ([Name], [EnchantmentId]) VALUES ('Grace', '22465440-4c5b-4c00-a8bc-69b4dc264df5')
INSERT INTO [dbo].[Enchantment] ([Name], [EnchantmentId]) VALUES ('Transform into frog', '280c86ec-3847-4d8a-898d-7e1e3f1f7e48')
INSERT INTO [dbo].[Enchantment] ([Name], [EnchantmentId]) VALUES ('Poison with enchanted apple', '28c242d8-b16e-4ea6-9b37-9df9451fff37')
INSERT INTO [dbo].[Enchantment] ([Name], [EnchantmentId]) VALUES ('Transform into stag', 'cf855d1f-b402-4b56-a2c4-a5aa484ea080')
INSERT INTO [dbo].[Enchantment] ([Name], [EnchantmentId]) VALUES ('Turn mouse into horse', '7bc798ce-7ccd-4ef5-b9e3-b2c8899d6b65')
INSERT INTO [dbo].[Enchantment] ([Name], [EnchantmentId]) VALUES ('Have a child', '38f49b5b-ee47-4687-90e2-bf29c283b4aa')
INSERT INTO [dbo].[Enchantment] ([Name], [EnchantmentId]) VALUES ('Embed stone in sword that can only be removed by rightful king', '73c453b5-006b-4ad6-8ab3-cba14af678b3')
INSERT INTO [dbo].[Enchantment] ([Name], [EnchantmentId]) VALUES ('Make vegetables irresistible', 'fdc061b0-ad1f-420a-8509-d174e5984918')
INSERT INTO [dbo].[Enchantment] ([Name], [EnchantmentId]) VALUES ('Beauty', '295af960-1e53-4b50-81f9-eceabf3c0f2b')
INSERT INTO [dbo].[Enchantment] ([Name], [EnchantmentId]) VALUES ('Superhuman strength', 'b25b88b3-4386-48a4-9596-fb6293101a9e')
INSERT INTO [dbo].[Enchantment] ([Name], [EnchantmentId]) VALUES ('Transform into swan', '585ac7e1-96a3-4bf4-9b26-fec62e5eb704')

-- Insert scripts for table: Ending
PRINT 'Inserting rows into table: Ending'
INSERT INTO [dbo].[Ending] ([EndingType], [EndingId]) VALUES ('Peculiar', 'ab0829fe-c57f-48b4-9a3a-0db6ce9ba308')
INSERT INTO [dbo].[Ending] ([EndingType], [EndingId]) VALUES ('Ambivalent', '6380c189-8ac8-4588-939a-23429c22ea79')
INSERT INTO [dbo].[Ending] ([EndingType], [EndingId]) VALUES ('Sad', '76bcf535-223c-4648-87f5-7bf7e22baeef')
INSERT INTO [dbo].[Ending] ([EndingType], [EndingId]) VALUES ('Happily ever after', 'b78a483f-5071-4f9f-b972-a21576238929')

-- Insert scripts for table: Location
PRINT 'Inserting rows into table: Location'
INSERT INTO [dbo].[Location] ([Location], [LocationId]) VALUES ('Tall Tower', 'a4a01bd5-bad9-4613-99e1-2d55506834f8')
INSERT INTO [dbo].[Location] ([Location], [LocationId]) VALUES ('Unknown', '725e9b76-a4cd-4983-a3c0-32269ba13c5b')
INSERT INTO [dbo].[Location] ([Location], [LocationId]) VALUES ('Market', 'ba4bb081-d18c-44fd-a898-3993555a474b')
INSERT INTO [dbo].[Location] ([Location], [LocationId]) VALUES ('The Underworld', 'cf4632f9-21f9-4b1a-8765-3c9cc04e22cd')
INSERT INTO [dbo].[Location] ([Location], [LocationId]) VALUES ('Ancient Greece', '68da3289-9211-4b1b-b7e8-3eb6b991ea13')
INSERT INTO [dbo].[Location] ([Location], [LocationId]) VALUES ('Lithuania', 'd693a5e5-54d1-4001-9dba-4029e2ebc96a')
INSERT INTO [dbo].[Location] ([Location], [LocationId]) VALUES ('Round Table', '5b565ab3-bdbb-4a8f-a445-626bee6e2bdc')
INSERT INTO [dbo].[Location] ([Location], [LocationId]) VALUES ('Mesopotamia', '65b27ba9-dc1d-461f-bfd8-714e33dba88a')
INSERT INTO [dbo].[Location] ([Location], [LocationId]) VALUES ('Forest', '8a2c95a6-4140-4e92-98c9-73ae12ca12b5')
INSERT INTO [dbo].[Location] ([Location], [LocationId]) VALUES ('Zeus', '48f906d1-c2e2-4558-8c37-846c5d396c2a')
INSERT INTO [dbo].[Location] ([Location], [LocationId]) VALUES ('Helicopter', '290b1fa9-5273-449f-bc2c-8851d82bf16c')
INSERT INTO [dbo].[Location] ([Location], [LocationId]) VALUES ('Road', '3ae93050-f488-48d5-accf-9539d76ce257')
INSERT INTO [dbo].[Location] ([Location], [LocationId]) VALUES ('Herb Garden', 'fe3351cc-b053-4102-a320-9b6b946092d5')
INSERT INTO [dbo].[Location] ([Location], [LocationId]) VALUES ('Glastonbury', '5b354c96-3774-4284-a0fb-9eff92b771d3')
INSERT INTO [dbo].[Location] ([Location], [LocationId]) VALUES ('Floating island', 'ddcf1e65-4eea-4143-9599-a0c745776a62')
INSERT INTO [dbo].[Location] ([Location], [LocationId]) VALUES ('Castle', 'a97689b2-a3b7-475b-9402-a4e9c78a9c92')
INSERT INTO [dbo].[Location] ([Location], [LocationId]) VALUES ('Cottage', '171d088c-27d0-4a83-9128-ab789f3b67aa')
INSERT INTO [dbo].[Location] ([Location], [LocationId]) VALUES ('Aeroplane', 'cfe37dbe-6e66-429c-b303-af1f3032bacd')
INSERT INTO [dbo].[Location] ([Location], [LocationId]) VALUES ('Cornwall', '32b40cc6-aea6-4f5b-ba84-bc67fc1ab564')
INSERT INTO [dbo].[Location] ([Location], [LocationId]) VALUES ('Mesoamerica', '17bd297b-54e7-4573-8e2c-c2b06fef44ba')
INSERT INTO [dbo].[Location] ([Location], [LocationId]) VALUES ('Ocean', '7730d610-826b-4dc3-b148-c6e199f8f9b0')
INSERT INTO [dbo].[Location] ([Location], [LocationId]) VALUES ('Submarine', 'cc2da835-7f3a-4c4d-80e2-c7d3a54d1042')
INSERT INTO [dbo].[Location] ([Location], [LocationId]) VALUES ('Camelot', '0f013fc3-3e6a-4310-bdfc-d48b426dcdc6')
INSERT INTO [dbo].[Location] ([Location], [LocationId]) VALUES ('California', 'b6f1bc5e-0d41-4d58-83d6-d93f5688e16c')
INSERT INTO [dbo].[Location] ([Location], [LocationId]) VALUES ('Mount Olympus', '90657c6c-3113-4dd4-8371-e70ac955bfb2')

-- Insert scripts for table: Source
PRINT 'Inserting rows into table: Source'
INSERT INTO [dbo].[Source] ([CountryOfOrigin], [SourceId], [Author]) VALUES ('Unknown', 'af9325ab-19c4-490d-bbb8-469d36301452', 'Unknown')
INSERT INTO [dbo].[Source] ([CountryOfOrigin], [SourceId], [Author]) VALUES ('Germany', 'c64a6bfe-b028-4bca-9e88-4e9a9a18784d', 'Jacob and Wilhelm Grimm')
INSERT INTO [dbo].[Source] ([CountryOfOrigin], [SourceId], [Author]) VALUES ('England', '006e55c6-7a35-49a7-9119-581bc191f13c', 'Sir Thomas Malory')
INSERT INTO [dbo].[Source] ([CountryOfOrigin], [SourceId], [Author]) VALUES ('USA', '99de5354-0ebb-435b-be56-7a83f0c8b390', 'Joss Whedon')
INSERT INTO [dbo].[Source] ([CountryOfOrigin], [SourceId], [Author]) VALUES ('Greece', 'de630900-720b-4211-9965-89014fe86ac7', 'Hesiod')
INSERT INTO [dbo].[Source] ([CountryOfOrigin], [SourceId], [Author]) VALUES ('Denmark', 'fd02bf00-de59-4b45-a834-994240d1f295', 'Hans Christian Anderson')
INSERT INTO [dbo].[Source] ([CountryOfOrigin], [SourceId], [Author]) VALUES ('Greece', '6987e0e8-a704-4dcf-aca3-99611ae60be1', 'Homer')
INSERT INTO [dbo].[Source] ([CountryOfOrigin], [SourceId], [Author]) VALUES ('Mesoamerica', 'a6a803c6-bd5e-4037-b74f-9eb6d412116d', 'Unknown')
INSERT INTO [dbo].[Source] ([CountryOfOrigin], [SourceId], [Author]) VALUES ('France', '22b6daa3-e266-45eb-b6cd-bc5c890ed282', 'Charles Perrault')
INSERT INTO [dbo].[Source] ([CountryOfOrigin], [SourceId], [Author]) VALUES ('Italy', '0803de2a-b8b7-487f-80ca-c8090b362abf', 'Giovanni Boccaccio')
INSERT INTO [dbo].[Source] ([CountryOfOrigin], [SourceId], [Author]) VALUES ('Turkey', '6919c74e-4051-47c1-9b58-d3f1da5e0b48', 'Aesop')
INSERT INTO [dbo].[Source] ([CountryOfOrigin], [SourceId], [Author]) VALUES ('Mesopotamia', '3c2a5dc4-a04d-4105-a5e2-faf71b2385a4', 'Nur-Aya')

-- Insert scripts for table: Species
PRINT 'Inserting rows into table: Species'
INSERT INTO [dbo].[Species] ([Immortal], [Description], [SpeciesId], [Species]) VALUES (0, 'Female practitioner of magic. Sometimes ethically dubious.', 'ee3a08b4-e93e-452a-8f74-1e5fdff3db50', 'Witch')
INSERT INTO [dbo].[Species] ([Immortal], [Description], [SpeciesId], [Species]) VALUES (0, 'Small human shaped creature with magical powers. Often troublemakers.', '5a37a3fc-a7f3-4497-bcc4-23df7d65b38d', 'Fairy')
INSERT INTO [dbo].[Species] ([Immortal], [Description], [SpeciesId], [Species]) VALUES (0, 'Includes natural born frogs and people who have been turned into frogs', 'e04f7747-4f4a-487e-b10e-2b8e5226eecf', 'Frog')
INSERT INTO [dbo].[Species] ([Immortal], [Description], [SpeciesId], [Species]) VALUES (1, 'Beings with supernatural powers; often worshipped and usually feared.', '82b270f3-7fef-48db-a293-4683dfe8ef3e', 'God')
INSERT INTO [dbo].[Species] ([Immortal], [Description], [SpeciesId], [Species]) VALUES (0, 'Kindly women who grant supernatural gifts; often bestow unusual baptism presents.', '61f40c7f-6191-4407-a9d8-4cb97f5495de', 'Fairy godmother')
INSERT INTO [dbo].[Species] ([Immortal], [Description], [SpeciesId], [Species]) VALUES (0, 'Like a witch, but male.', '5593a0da-a259-4df7-beea-7ae8c18727a6', 'Wizard')
INSERT INTO [dbo].[Species] ([Immortal], [Description], [SpeciesId], [Species]) VALUES (0, 'Like a person but much bigger. Tend to have great physical power.', 'b73ff788-21c7-49a0-8e23-81f89c4e693c', 'Giant')
INSERT INTO [dbo].[Species] ([Immortal], [Description], [SpeciesId], [Species]) VALUES (0, 'Includes natural born bulls, bulls sent by heaven and gods who transform into bulls.', '13926f90-f2de-4995-b91d-82bd5620bfc7', 'Bull')
INSERT INTO [dbo].[Species] ([Immortal], [Description], [SpeciesId], [Species]) VALUES (0, 'Presumably means 4 human great great grandparents and 8 divine great great grandparents', '80802ec4-8cc6-4588-af3a-900b270bf623', 'One third human, two thirds fivine')
INSERT INTO [dbo].[Species] ([Immortal], [Description], [SpeciesId], [Species]) VALUES (1, 'Preternatural creatures such as angels or demons; sometimes belong to particular places or objects.', '5e1b7d5b-6fee-45b3-8989-a20228567af1', 'Spirit')
INSERT INTO [dbo].[Species] ([Immortal], [Description], [SpeciesId], [Species]) VALUES (1, 'Beautiful young women who inhabit, or represent, natural features. Can be goddesses.', '4bd30b54-14c3-4309-b9aa-a8affab95828', 'Nymph')
INSERT INTO [dbo].[Species] ([Immortal], [Description], [SpeciesId], [Species]) VALUES (0, 'Creatures resembling small old men, who live underground and guard treasure.', 'c67dcab5-42c8-4dbe-b22e-b8fa81719027', 'Dwarf')
INSERT INTO [dbo].[Species] ([Immortal], [Description], [SpeciesId], [Species]) VALUES (0, 'A member of the genus Homo sapiens. Often manipulated in some way by supernatural beings.', '8c55f0c8-6588-4fec-9c55-f7ee8ae40d22', 'Human')

-- Insert scripts for table: Story
PRINT 'Inserting rows into table: Story'
INSERT INTO [dbo].[Story] ([Summary], [SourceId], [EndingId], [ClassificationId], [StoryId], [Name]) VALUES ('Arthur was the illegitimate son of a king, Uther Pendragon. He became King of Britain by being the only person who could pull a sword out of a stone, and subsequently became involved in an endless series of battles, only stopping to unknowingly father a son, Mordred, with his half-sister Margawse. When Arthur''s position was secure he married Guenevere and acquired a large round table and some knights. These Knights of the Round Table included Gawain and Tor and, later, Lancelot and Galahad. Arthur conquered Rome, and the knights went off to have some adventures of their own. Guenevere had an adventure with Lancelot; this adultery lasted for 25 years until Arthur noticed. Guenevere was almost burned at the stake for treason 3 times; she was rescued each time and eventually returned to Arthur. However, while Arthur was busily besieging Lancelot''s castle to retrieve his wayward wife, Mordred had usurped the British throne. Arthur fought and killed Mordred but was himself mortally wounded.', '006e55c6-7a35-49a7-9119-581bc191f13c', '76bcf535-223c-4648-87f5-7bf7e22baeef', '34d3755d-09c0-4e98-ae09-3fd5b1b2cad8', 'a698b0b0-2745-4045-a16c-0b2927897890', 'Le Morte d''Arthur')
INSERT INTO [dbo].[Story] ([Summary], [SourceId], [EndingId], [ClassificationId], [StoryId], [Name]) VALUES ('Artemis and Apollo were the children of Zeus and Leto. When Hera, Zeus'' wife, discovered Leto was pregnant with twins she was furious and forbade Leto to give birth on land or sea. Leto was forced to roam the earth for a bit and then luckily found a floating island which, being neither land nor sea, allowed her to sit down and have her children. Apollo became the god of music and prophecy, disposed of a troublesome serpent at Deplhi and may have helped to found the city of Troy. Artemis became goddess of the hunt and of women in childbirth. She also became quite bad tempered, killing several of her companions and turning Actaeon into a stag after he accidentally saw her in the bath.', '6987e0e8-a704-4dcf-aca3-99611ae60be1', '6380c189-8ac8-4588-939a-23429c22ea79', '2dc78540-2e24-4f56-8bc2-a39acba562e3', '8fe239f2-9caf-4b49-b727-332d8499054f', 'Artemis and Apollo')
INSERT INTO [dbo].[Story] ([Summary], [SourceId], [EndingId], [ClassificationId], [StoryId], [Name]) VALUES ('The goddess Athena was the result of a curious interaction between Zeus and Metis. Zeus seduced Metis and she became pregnant with Athena. This might seem like a straightforward story, but took a bizarre turn when Zeus heard a prophecy that the second child born to Metis would replace him. Zeus decided that the best way to deal with this prophecy was to eat Metis.  In spite of her ingestion, Metis was able to make armour for her unborn daughter, and Athena later emerged from Zeus''s forehead as an adult wearing this armour. Athena overcame her unusual origins to make a successful career as a warrior goddess and the patroness of Athens.', '6987e0e8-a704-4dcf-aca3-99611ae60be1', 'ab0829fe-c57f-48b4-9a3a-0db6ce9ba308', '2dc78540-2e24-4f56-8bc2-a39acba562e3', '42e81a48-bcef-41e2-8d9a-4931cbcec5cf', 'Athena')
INSERT INTO [dbo].[Story] ([Summary], [SourceId], [EndingId], [ClassificationId], [StoryId], [Name]) VALUES ('Persephone was the daughter of Demeter and Zeus. She had an uneventful life until one day, when she was picking flowers on the plain of Enna, Hades opened the earth and came up from the underworld to abduct her. Only Zeus and Helios saw the abduction. Demeter was distraught at her daughter''s disappearance and searched the world for her. Unfortunately she neglected her duties as harvest goddess to do so and consequently no crops would grow. Zeus eventually grew weary of the wilting planet and sent Hermes to retrieve Persephone. However, Hades tricked her into eating four pomegranate seeds before she left and she was obliged to make annual return trips to the underworld, staying one month for each pomegranate seed. During these enforced four month absences, Demeter would not allow vegetation to grow.', 'af9325ab-19c4-490d-bbb8-469d36301452', '76bcf535-223c-4648-87f5-7bf7e22baeef', '2dc78540-2e24-4f56-8bc2-a39acba562e3', 'cf9e9ed8-e279-4832-ae45-56d76bdf3a69', 'Persephone')
INSERT INTO [dbo].[Story] ([Summary], [SourceId], [EndingId], [ClassificationId], [StoryId], [Name]) VALUES ('Quetzalcoatl was the son of Coatlicue. He created the cosmos and then proceeded to destroy it four times. For the fifth making of the world he traveled into Mictlan (the underworld), collected some old human bones from the goddess Cihuacoatl and made a new batch of humans by mixing these bones with his own blood. Seemingly satisfied with his work this time, he allowed these humans to live and even gave them agriculture and calendars. Sadly, a regrettable drunken incident with a priestess caused Quetzalcoatl to throw himself into a fire, although his heart survived and flew into the sky to become the morning star.', 'a6a803c6-bd5e-4037-b74f-9eb6d412116d', 'ab0829fe-c57f-48b4-9a3a-0db6ce9ba308', '58815cce-d0bd-4476-9dd2-8066624fa9ea', '26c4af57-679c-48e3-809f-7ea0060796dd', 'Quetzalcoatl')
INSERT INTO [dbo].[Story] ([Summary], [SourceId], [EndingId], [ClassificationId], [StoryId], [Name]) VALUES ('A young girl has a terrible life at the hands her evil stepmother and two unattractive stepsisters. When the prince of her kingdom holds a ball to find a wife, her stepfamily exclude her but her fairy godmother magics various animals and vegetables into party wear and transport so that she can go. There is one condition - the enchantment can only last until midnight. Cinderella goes to the ball and dances with the prince but has to run away at midnight, leaving a glass shoe behind. The prince searches the kingdom for the owner of this unlikely footwear. He finds Cinderella and they are married.', '22b6daa3-e266-45eb-b6cd-bc5c890ed282', 'b78a483f-5071-4f9f-b972-a21576238929', '58815cce-d0bd-4476-9dd2-8066624fa9ea', 'da47837d-c6a5-490b-96cf-808137d0e760', 'Cinderella')
INSERT INTO [dbo].[Story] ([Summary], [SourceId], [EndingId], [ClassificationId], [StoryId], [Name]) VALUES ('Uther Pendragon, King of Britain was at war with Sir Jordanus, the Duke of Tintagil. During negotiations Uther fell in love with the Duke''s wife, Igraine. Sir Jordanus and Igraine fled the negotiations and returned to separate castles in Cornwall. Uther besieged both castles and, when this failed , sent for Merlin, a magician. Merlin used an enchantment to make Uther look like Sir Jordanus. Uther visited Igraine in this disguise and conceived a son, Arthur. In exchange for the enchantment Merlin took Arthur when he was born and gave him to an obscure family to raise. Uther died and Britain suffered many years of civil war. These wars ended when Merlin produced a sword stuck inside an anvil which only Arthur could remove. Rather inexplicably, Arthur''s ability to remove the sword gave him the throne of England (though not without dispute).', '006e55c6-7a35-49a7-9119-581bc191f13c', '6380c189-8ac8-4588-939a-23429c22ea79', '34d3755d-09c0-4e98-ae09-3fd5b1b2cad8', 'fae426a4-5989-4429-9918-9cff85bd4b1f', 'The Birth of Arthur')
INSERT INTO [dbo].[Story] ([Summary], [SourceId], [EndingId], [ClassificationId], [StoryId], [Name]) VALUES ('A married couple had the misfortune both to long for a child and live next door to a witch''s herb garden. The man stole some herbs from the witch''s garden because his wife wanted some. However, having eaten some, his wife wanted more. This time the witch caught him. She let him have more herbs, in exchange for the child his wife would now bear. When Rapunzel was born the witch took her away and locked her in a tall tower with no door. The witch got into the tower by climbing up Rapunzel''s extremely long hair. A wandering handsome prince also began to visit Rapunzel by climbing up her hair. When the witch discovered this she was furious. She banished Rapunzel to a desert, and told the prince he would never see Rapunzel again. The prince was so distraught he fell out of the tower and blinded himself on a thorn bush. In this unhappy state he wandered around for several years until he accidentally bumped into Rapunzel in the desert. Rapunzel cured his blindness by crying and the price took her to his kingdom. (The witch presumably went back to her herb garden.)', 'c64a6bfe-b028-4bca-9e88-4e9a9a18784d', 'b78a483f-5071-4f9f-b972-a21576238929', '58815cce-d0bd-4476-9dd2-8066624fa9ea', '0a065b0f-cde9-4bb3-b0ba-9d2d8a899edd', 'Rapunzel')
INSERT INTO [dbo].[Story] ([Summary], [SourceId], [EndingId], [ClassificationId], [StoryId], [Name]) VALUES ('A young girl reluctantly accepts her destiny as sole designated vampire slayer. This destiny comes with a package of superhuman strengths, which is fortunate as Buffy is really quite tiny. Buffy and her friends Willow and Xander battle monsters, demons and several attempts to end the world in a succession of stylish outfits. Eventually her home town of Sunnydale is destroyed and, having shared her powers with other potential slayers, Buffy is free to go to Rome and dance in nightclubs.', '99de5354-0ebb-435b-be56-7a83f0c8b390', '6380c189-8ac8-4588-939a-23429c22ea79', 'c332f89f-0113-4c53-8986-e3612b06bf13', '60dbd709-c899-4570-a3bc-a2ce089b7d20', 'Buffy the Vampire Slayer')
INSERT INTO [dbo].[Story] ([Summary], [SourceId], [EndingId], [ClassificationId], [StoryId], [Name]) VALUES ('Zeus was the youngest son of the Titans Cronus and Rhea. Cronus was king of the gods and wished to remain so; when he was told that one his children would depose him, he swallowed five of them - Poseidon, Hades, Hera, Demeter and Hestia. Cronus thought he''s swallowed his sixth child too, but Rhea has swapped the infant Zeus for a stone and Cronus had been too preoccupied with eating his other children to notice. Zeus was raised by a goat until he was old enough to confront Cronus and demand the regurgitation of his siblings. Once his brothers and sisters were free, Zeus defeated and banished the Titans, and divided control of the universe with his brothers.', 'de630900-720b-4211-9965-89014fe86ac7', '6380c189-8ac8-4588-939a-23429c22ea79', '2dc78540-2e24-4f56-8bc2-a39acba562e3', 'ad1c0dcb-5c9b-4bbb-8b5f-b732e60ac278', 'Zeus and the Titans')
INSERT INTO [dbo].[Story] ([Summary], [SourceId], [EndingId], [ClassificationId], [StoryId], [Name]) VALUES ('A young king of Uruk, who is 1/3 human and 2/3 divine, oppresses his subjects. The god Anu sends creates a wild man, Enkidu, to be a rival for Gilgamesh. Enkidu is tamed and fights Gilgamesh. The pair become friends and successfully fight Huwawa and the Bull of Heaven. The gods decided that because of their success one of the two must die. Enkidu suffers a long and wordy illness and expires. The grieving Gilgamesh panics about his own death and sets out to find the secret of eternal life. He eventually finds a magic plant which will give him immortality. He is on his way back to Uruk to test the plant on an old man when a snake eats the plant. His long journey has been pointless, so he goes home.', '3c2a5dc4-a04d-4105-a5e2-faf71b2385a4', '76bcf535-223c-4648-87f5-7bf7e22baeef', 'e56d7c37-c651-48bb-8d2e-254618218e15', 'cabd1c8c-84fc-49a1-9d49-c472ef1a496d', 'The Epic of Gilgamesh')
INSERT INTO [dbo].[Story] ([Summary], [SourceId], [EndingId], [ClassificationId], [StoryId], [Name]) VALUES ('Snow White''s troubles began with a magic mirror. She was living contentedly with her father, a king, and her stepmother, a very proud and beautiful queen. The magic mirror belonged to the queen, and every day it told her she was the most beautiful woman in the kingdom. However, one morning the mirror cheerfully announced that Snow White was the most beautiful woman in the kingdom. The queen dispatched a huntsman to take her stepdaughter into the woods and kill her. The huntsman spared Snow White, and she took refuge in a household of seven dwarves who had agreed to offer her shelter in exchange for a life of domestic servitude. The queen was not fooled by the huntsman''s deception, primarily because the magic mirror told her that Snow White was still alive. After several failed assassination attempts the queen poisoned Snow White with an apple. The dwarves put Snow White into a glass coffin, but she didn''t decay, and eventually the dwarves gave the coffin to a passing prince. The prince spent an unhealthy amount of time in his castle with the coffin, until an exasperated servant hit Snow White and dislodged the poisoned apple. Snow White came back to life and married the prince. The queen, alerted by the magic mirror, went to the wedding and somehow managed to dance herself to death.', 'c64a6bfe-b028-4bca-9e88-4e9a9a18784d', 'b78a483f-5071-4f9f-b972-a21576238929', '58815cce-d0bd-4476-9dd2-8066624fa9ea', '05a61915-db96-4878-8e79-e8248c64aa23', 'Snow White')
INSERT INTO [dbo].[Story] ([Summary], [SourceId], [EndingId], [ClassificationId], [StoryId], [Name]) VALUES ('Hansel and Gretel, children of an impoverished woodcutter, were abandoned in a forest at the suggestion of their stepmother. They made their way home but, when the family''s food ran out again, they were dumped for a second time, and this time they got lost. After three days they found a house made of bread and cake and quite understandably ate some of it. Unfortunately the house belonged to a wicked witch, whose preferred diet was small children. The witch captured the children and began fattening Hansel for the cooking pot. As the witch had poor eyesight she couldn''t see Hansel getting larger, and each day he held out a twig instead of his finger to fool the witch into thinking he was still skinny. This worked for a while, but then the witch''s desire for roast Hansel overcame her and she decided to cook him anyway. Gretel tricked the witch into climbing into the oven and the children escaped, having first ransacked the cottage for valuables. They took their spoils home to their father (who was pleased to see them, even though he had left them in the forest to be eaten by animals) and they all lived happily together (without their stepmother, who had conveniently died in their absence).', 'c64a6bfe-b028-4bca-9e88-4e9a9a18784d', 'b78a483f-5071-4f9f-b972-a21576238929', '58815cce-d0bd-4476-9dd2-8066624fa9ea', 'bc800dbe-adfe-469a-ab16-f36a7dfce573', 'Hansel and Gretel')

-- Insert scripts for table: StoryLocation
PRINT 'Inserting rows into table: StoryLocation'
INSERT INTO [dbo].[StoryLocation] ([StoryLocationId], [LocationId], [StoryId]) VALUES ('71c4214f-f199-48bd-ae67-0a808b0311cb', 'a97689b2-a3b7-475b-9402-a4e9c78a9c92', '05a61915-db96-4878-8e79-e8248c64aa23')
INSERT INTO [dbo].[StoryLocation] ([StoryLocationId], [LocationId], [StoryId]) VALUES ('b9966a19-d065-4c50-b205-1aff3b0003d4', '8a2c95a6-4140-4e92-98c9-73ae12ca12b5', '0a065b0f-cde9-4bb3-b0ba-9d2d8a899edd')
INSERT INTO [dbo].[StoryLocation] ([StoryLocationId], [LocationId], [StoryId]) VALUES ('ebfbeb4a-3933-4cc4-9044-1f2f4a1b1954', 'ddcf1e65-4eea-4143-9599-a0c745776a62', '8fe239f2-9caf-4b49-b727-332d8499054f')
INSERT INTO [dbo].[StoryLocation] ([StoryLocationId], [LocationId], [StoryId]) VALUES ('7a359c01-d9f7-4314-a444-228b74b909b0', '90657c6c-3113-4dd4-8371-e70ac955bfb2', '8fe239f2-9caf-4b49-b727-332d8499054f')
INSERT INTO [dbo].[StoryLocation] ([StoryLocationId], [LocationId], [StoryId]) VALUES ('638c2db0-76bf-4693-ae6c-2e8285c88f85', '8a2c95a6-4140-4e92-98c9-73ae12ca12b5', 'bc800dbe-adfe-469a-ab16-f36a7dfce573')
INSERT INTO [dbo].[StoryLocation] ([StoryLocationId], [LocationId], [StoryId]) VALUES ('216aa031-0e68-4388-b45e-2ee91183c41d', 'cf4632f9-21f9-4b1a-8765-3c9cc04e22cd', 'cf9e9ed8-e279-4832-ae45-56d76bdf3a69')
INSERT INTO [dbo].[StoryLocation] ([StoryLocationId], [LocationId], [StoryId]) VALUES ('faffe62c-afc2-47f1-a81e-3402a7be11c0', 'd693a5e5-54d1-4001-9dba-4029e2ebc96a', 'bc800dbe-adfe-469a-ab16-f36a7dfce573')
INSERT INTO [dbo].[StoryLocation] ([StoryLocationId], [LocationId], [StoryId]) VALUES ('9eff95d4-427e-4d73-969a-34a700ca47fb', '65b27ba9-dc1d-461f-bfd8-714e33dba88a', 'cabd1c8c-84fc-49a1-9d49-c472ef1a496d')
INSERT INTO [dbo].[StoryLocation] ([StoryLocationId], [LocationId], [StoryId]) VALUES ('95e9076d-9929-4a3c-bf76-3f3ba3ba28df', '68da3289-9211-4b1b-b7e8-3eb6b991ea13', 'cf9e9ed8-e279-4832-ae45-56d76bdf3a69')
INSERT INTO [dbo].[StoryLocation] ([StoryLocationId], [LocationId], [StoryId]) VALUES ('a502d75d-7c61-4559-a40d-3f60ea9faee2', 'b6f1bc5e-0d41-4d58-83d6-d93f5688e16c', '60dbd709-c899-4570-a3bc-a2ce089b7d20')
INSERT INTO [dbo].[StoryLocation] ([StoryLocationId], [LocationId], [StoryId]) VALUES ('3446882c-d38f-4112-873b-4cf59eadca23', '5b565ab3-bdbb-4a8f-a445-626bee6e2bdc', 'a698b0b0-2745-4045-a16c-0b2927897890')
INSERT INTO [dbo].[StoryLocation] ([StoryLocationId], [LocationId], [StoryId]) VALUES ('a266ceb8-8c77-43ff-bd88-64628d1cc9da', '48f906d1-c2e2-4558-8c37-846c5d396c2a', '42e81a48-bcef-41e2-8d9a-4931cbcec5cf')
INSERT INTO [dbo].[StoryLocation] ([StoryLocationId], [LocationId], [StoryId]) VALUES ('5627a6eb-a88d-48b7-ac9d-80a272d78ca7', '171d088c-27d0-4a83-9128-ab789f3b67aa', '05a61915-db96-4878-8e79-e8248c64aa23')
INSERT INTO [dbo].[StoryLocation] ([StoryLocationId], [LocationId], [StoryId]) VALUES ('346c8eca-980b-4547-9830-a44ffa3cc82c', '68da3289-9211-4b1b-b7e8-3eb6b991ea13', '8fe239f2-9caf-4b49-b727-332d8499054f')
INSERT INTO [dbo].[StoryLocation] ([StoryLocationId], [LocationId], [StoryId]) VALUES ('760fd79d-7c6c-40fd-93ed-b1a88119ea1f', '171d088c-27d0-4a83-9128-ab789f3b67aa', 'da47837d-c6a5-490b-96cf-808137d0e760')
INSERT INTO [dbo].[StoryLocation] ([StoryLocationId], [LocationId], [StoryId]) VALUES ('e117fcaa-6121-4778-9848-b8b917eff894', '0f013fc3-3e6a-4310-bdfc-d48b426dcdc6', 'a698b0b0-2745-4045-a16c-0b2927897890')
INSERT INTO [dbo].[StoryLocation] ([StoryLocationId], [LocationId], [StoryId]) VALUES ('3b768f5b-939c-4dd6-8cfa-baea1e43c479', '8a2c95a6-4140-4e92-98c9-73ae12ca12b5', '05a61915-db96-4878-8e79-e8248c64aa23')
INSERT INTO [dbo].[StoryLocation] ([StoryLocationId], [LocationId], [StoryId]) VALUES ('50245757-a88c-467f-b62c-c0286c391aec', 'fe3351cc-b053-4102-a320-9b6b946092d5', '0a065b0f-cde9-4bb3-b0ba-9d2d8a899edd')
INSERT INTO [dbo].[StoryLocation] ([StoryLocationId], [LocationId], [StoryId]) VALUES ('a24a82ed-6833-4d5f-a570-c02c7168e4c1', '17bd297b-54e7-4573-8e2c-c2b06fef44ba', '26c4af57-679c-48e3-809f-7ea0060796dd')
INSERT INTO [dbo].[StoryLocation] ([StoryLocationId], [LocationId], [StoryId]) VALUES ('82ad4976-f57b-4e0a-a3ba-c769c01a0fc9', '32b40cc6-aea6-4f5b-ba84-bc67fc1ab564', 'fae426a4-5989-4429-9918-9cff85bd4b1f')
INSERT INTO [dbo].[StoryLocation] ([StoryLocationId], [LocationId], [StoryId]) VALUES ('f3882019-9f04-4b3c-afa7-db551df04143', 'a4a01bd5-bad9-4613-99e1-2d55506834f8', '0a065b0f-cde9-4bb3-b0ba-9d2d8a899edd')
INSERT INTO [dbo].[StoryLocation] ([StoryLocationId], [LocationId], [StoryId]) VALUES ('3008c8ed-fbaf-41b4-8351-e3d13a0064a9', 'cf4632f9-21f9-4b1a-8765-3c9cc04e22cd', '26c4af57-679c-48e3-809f-7ea0060796dd')
INSERT INTO [dbo].[StoryLocation] ([StoryLocationId], [LocationId], [StoryId]) VALUES ('75048507-057e-46ed-8139-ef61c6fbdc05', '90657c6c-3113-4dd4-8371-e70ac955bfb2', '42e81a48-bcef-41e2-8d9a-4931cbcec5cf')
INSERT INTO [dbo].[StoryLocation] ([StoryLocationId], [LocationId], [StoryId]) VALUES ('89fb776a-32f6-465c-a49a-f3bb98a55b27', '171d088c-27d0-4a83-9128-ab789f3b67aa', 'bc800dbe-adfe-469a-ab16-f36a7dfce573')

-- Insert scripts for table: Wish
PRINT 'Inserting rows into table: Wish'
INSERT INTO [dbo].[Wish] ([WishId], [Name]) VALUES ('505fe546-78af-4472-a7ff-4a99e7354556', 'Long life')
INSERT INTO [dbo].[Wish] ([WishId], [Name]) VALUES ('f04c3ab9-0f32-4c7b-8da1-5bcfce29fa5f', 'Wealth')
INSERT INTO [dbo].[Wish] ([WishId], [Name]) VALUES ('41f0d3b3-385d-4183-80d8-6529b68709c0', 'Harm to another')
INSERT INTO [dbo].[Wish] ([WishId], [Name]) VALUES ('6c128858-92aa-4295-a63a-be931ccd0230', 'Beauty')
INSERT INTO [dbo].[Wish] ([WishId], [Name]) VALUES ('1370e359-bdf5-445b-b1c5-ffba77bd42e0', 'Children')

-- Enabling all Constraints
Print 'Enabling all Constraints'
exec sp_MSforeachtable 'ALTER TABLE ? CHECK CONSTRAINT ALL'

-- Enabling all Triggers
Print 'Enabling all Triggers'
exec sp_MSforeachtable 'ALTER TABLE ? ENABLE TRIGGER ALL'


-- COMMITTING TRANSACTION DATA
PRINT 'Committing transaction DATA'
IF @@TRANCOUNT>0
	COMMIT TRANSACTION _DATA_
GO

SET NOEXEC OFF

