diff --git a/components/SQLCE4Umbraco/Properties/AssemblyInfo.cs b/components/SQLCE4Umbraco/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..73fb6ee0a9 --- /dev/null +++ b/components/SQLCE4Umbraco/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("SqlCE4Umbraco")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("SqlCE4Umbraco")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2010")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("04436b0a-1dc6-4ee1-9d96-4c04f1a9f429")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/components/SQLCE4Umbraco/Sql/Total.sql b/components/SQLCE4Umbraco/Sql/Total.sql new file mode 100644 index 0000000000..4057691bb8 --- /dev/null +++ b/components/SQLCE4Umbraco/Sql/Total.sql @@ -0,0 +1,985 @@ +/******************************************************************************************* + + + + + + + + Umbraco database installation script for SQL Server CE 4 + +IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT + + Database version: 4.1.0.0 + + Please increment this version number if ANY change is made to this script, + so compatibility with scripts for other database systems can be verified easily. + The first 3 digits depict the Umbraco version, the last digit is the database version. + (e.g. version 4.0.0.3 means "Umbraco version 4.0.0, database version 3") + + Check-in policy: only commit this script if + * you ran the Umbraco installer completely; + * you ran it on the targetted database system; + * you ran the Runway and Module installations; + * you were able to browse the Boost site; + * you were able to open the Umbraco administration panel; + * you have documented the code change in this script; + * you have incremented the version number in this script. + +IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT + + + + + + + +********************************************************************************************/ + +CREATE TABLE [umbracoRelation] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[parentId] [int] NOT NULL, +[childId] [int] NOT NULL, +[relType] [int] NOT NULL, +[datetime] [datetime] NOT NULL CONSTRAINT [DF_umbracoRelation_datetime] DEFAULT (getdate()), +[comment] [nvarchar] (1000) NOT NULL +) + +; +ALTER TABLE [umbracoRelation] ADD CONSTRAINT [PK_umbracoRelation] PRIMARY KEY ([id]) +; +CREATE TABLE [cmsDocument] +( +[nodeId] [int] NOT NULL, +[published] [bit] NOT NULL, +[documentUser] [int] NOT NULL, +[versionId] [uniqueidentifier] NOT NULL, +[text] [nvarchar] (255) NOT NULL, +[releaseDate] [datetime] NULL, +[expireDate] [datetime] NULL, +[updateDate] [datetime] NOT NULL CONSTRAINT [DF_cmsDocument_updateDate] DEFAULT (getdate()), +[templateId] [int] NULL, +[alias] [nvarchar] (255) NULL , +[newest] [bit] NOT NULL CONSTRAINT [DF_cmsDocument_newest] DEFAULT (0) +) + +; +ALTER TABLE [cmsDocument] ADD CONSTRAINT [PK_cmsDocument] PRIMARY KEY ([versionId]) +; +CREATE TABLE [umbracoLog] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[userId] [int] NOT NULL, +[NodeId] [int] NOT NULL, +[Datestamp] [datetime] NOT NULL CONSTRAINT [DF_umbracoLog_Datestamp] DEFAULT (getdate()), +[logHeader] [nvarchar] (50) NOT NULL, +[logComment] [nvarchar] (1000) NULL +) + +; +ALTER TABLE [umbracoLog] ADD CONSTRAINT [PK_umbracoLog] PRIMARY KEY ([id]) +; + +/* TABLES ARE NEVER USED, REMOVED FOR 4.1 + +CREATE TABLE [umbracoUserGroup] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[userGroupName] [nvarchar] (255) NOT NULL +) +; +ALTER TABLE [umbracoUserGroup] ADD CONSTRAINT [PK_userGroup] PRIMARY KEY ([id]) +; +CREATE TABLE [umbracoUser2userGroup] +( +[user] [int] NOT NULL, +[userGroup] [int] NOT NULL +) +; +ALTER TABLE [umbracoUser2userGroup] ADD CONSTRAINT [PK_user2userGroup] PRIMARY KEY ([user], [userGroup]) +; + +*/ + +CREATE TABLE [umbracoApp] +( +[sortOrder] [tinyint] NOT NULL CONSTRAINT [DF_app_sortOrder] DEFAULT (0), +[appAlias] [nvarchar] (50) NOT NULL, +[appIcon] [nvarchar] (255) NOT NULL, +[appName] [nvarchar] (255) NOT NULL, +[appInitWithTreeAlias] [nvarchar] (255) NULL +) + +; +ALTER TABLE [umbracoApp] ADD CONSTRAINT [PK_umbracoApp] PRIMARY KEY ([appAlias]) +; +CREATE TABLE [cmsPropertyData] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[contentNodeId] [int] NOT NULL, +[versionId] [uniqueidentifier] NULL, +[propertytypeid] [int] NOT NULL, +[dataInt] [int] NULL, +[dataDate] [datetime] NULL, +[dataNvarchar] [nvarchar] (500) NULL, +[dataNtext] [ntext] NULL +) + +; +ALTER TABLE [cmsPropertyData] ADD CONSTRAINT [PK_cmsPropertyData] PRIMARY KEY ([id]) +; +CREATE INDEX [IX_cmsPropertyData] ON [cmsPropertyData] ([id]) +; +CREATE TABLE [cmsContent] +( +[pk] [int] NOT NULL IDENTITY(1, 1), +[nodeId] [int] NOT NULL, +[contentType] [int] NOT NULL +) + +; +ALTER TABLE [cmsContent] ADD CONSTRAINT [PK_cmsContent] PRIMARY KEY ([pk]) +; +CREATE TABLE [cmsContentType] +( +[pk] [int] NOT NULL IDENTITY(1, 1), +[nodeId] [int] NOT NULL, +[alias] [nvarchar] (255) NULL, +[icon] [nvarchar] (255) NULL +) + +; +ALTER TABLE [cmsContentType] ADD CONSTRAINT [PK_cmsContentType] PRIMARY KEY ([pk]) +; +CREATE TABLE [cmsMacroPropertyType] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[macroPropertyTypeAlias] [nvarchar] (50) NULL, +[macroPropertyTypeRenderAssembly] [nvarchar] (255) NULL, +[macroPropertyTypeRenderType] [nvarchar] (255) NULL, +[macroPropertyTypeBaseType] [nvarchar] (255) NULL +) + +; +ALTER TABLE [cmsMacroPropertyType] ADD CONSTRAINT [PK_macroPropertyType] PRIMARY KEY ([id]) +; + +/* TABLE IS NEVER USED, REMOVED FOR 4.1 + +CREATE TABLE [umbracoStylesheetProperty] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[stylesheetPropertyEditor] [bit] NOT NULL CONSTRAINT [DF_stylesheetProperty_stylesheetPropertyEditor] DEFAULT (0), +[stylesheet] [int] NOT NULL, +[stylesheetPropertyAlias] [nvarchar] (50) NULL, +[stylesheetPropertyName] [nvarchar] (255) NULL, +[stylesheetPropertyValue] [nvarchar] (400) NULL +) +; + +ALTER TABLE [umbracoStylesheetProperty] ADD CONSTRAINT [PK_stylesheetProperty] PRIMARY KEY ([id]) +; + +*/ + +CREATE TABLE [cmsTab] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[contenttypeNodeId] [int] NOT NULL, +[text] [nvarchar] (255) NOT NULL, +[sortorder] [int] NOT NULL +) + +; +ALTER TABLE [cmsTab] ADD CONSTRAINT [PK_cmsTab] PRIMARY KEY ([id]) +; +CREATE TABLE [cmsTemplate] +( +[pk] [int] NOT NULL IDENTITY(1, 1), +[nodeId] [int] NOT NULL, +[master] [int] NULL, +[alias] [nvarchar] (100) NULL, +[design] [ntext] NOT NULL +) + +; +ALTER TABLE [cmsTemplate] ADD CONSTRAINT [PK_templates] PRIMARY KEY ([pk]) +; +CREATE TABLE [umbracoUser2app] +( +[user] [int] NOT NULL, +[app] [nvarchar] (50) NOT NULL +) + +; +ALTER TABLE [umbracoUser2app] ADD CONSTRAINT [PK_user2app] PRIMARY KEY ([user], [app]) +; +CREATE TABLE [umbracoUserType] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[userTypeAlias] [nvarchar] (50) NULL, +[userTypeName] [nvarchar] (255) NOT NULL, +[userTypeDefaultPermissions] [nvarchar] (50) NULL +) + +; +ALTER TABLE [umbracoUserType] ADD CONSTRAINT [PK_userType] PRIMARY KEY ([id]) +; +CREATE TABLE [umbracoUser] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[userDisabled] [bit] NOT NULL CONSTRAINT [DF_umbracoUser_userDisabled] DEFAULT (0), +[userNoConsole] [bit] NOT NULL CONSTRAINT [DF_umbracoUser_userNoConsole] DEFAULT (0), +[userType] [int] NOT NULL, +[startStructureID] [int] NOT NULL, +[startMediaID] [int] NULL, +[userName] [nvarchar] (255) NOT NULL, +[userLogin] [nvarchar] (125) NOT NULL, +[userPassword] [nvarchar] (125) NOT NULL, +[userEmail] [nvarchar] (255) NOT NULL, +[userDefaultPermissions] [nvarchar] (50) NULL, +[userLanguage] [nvarchar] (10) NULL +) + +; +ALTER TABLE [umbracoUser] ADD CONSTRAINT [PK_user] PRIMARY KEY ([id]) +; +CREATE TABLE [cmsDocumentType] +( +[contentTypeNodeId] [int] NOT NULL, +[templateNodeId] [int] NOT NULL, +[IsDefault] [bit] NOT NULL CONSTRAINT [DF_cmsDocumentType_IsDefault] DEFAULT (0) +) + +; +ALTER TABLE [cmsDocumentType] ADD CONSTRAINT [PK_cmsDocumentType] PRIMARY KEY ([contentTypeNodeId], [templateNodeId]) +; +CREATE TABLE [cmsMemberType] +( +[pk] [int] NOT NULL IDENTITY(1, 1), +[NodeId] [int] NOT NULL, +[propertytypeId] [int] NOT NULL, +[memberCanEdit] [bit] NOT NULL CONSTRAINT [DF_cmsMemberType_memberCanEdit] DEFAULT (0), +[viewOnProfile] [bit] NOT NULL CONSTRAINT [DF_cmsMemberType_viewOnProfile] DEFAULT (0) +) + +; +ALTER TABLE [cmsMemberType] ADD CONSTRAINT [PK_cmsMemberType] PRIMARY KEY ([pk]) +; +CREATE TABLE [cmsMember] +( +[nodeId] [int] NOT NULL, +[Email] [nvarchar] (1000) NOT NULL CONSTRAINT [DF_cmsMember_Email] DEFAULT (''), +[LoginName] [nvarchar] (1000) NOT NULL CONSTRAINT [DF_cmsMember_LoginName] DEFAULT (''), +[Password] [nvarchar] (1000) NOT NULL CONSTRAINT [DF_cmsMember_Password] DEFAULT ('') +) + +; +CREATE TABLE [umbracoNode] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[trashed] [bit] NOT NULL CONSTRAINT [DF_umbracoNode_trashed] DEFAULT (0), +[parentID] [int] NOT NULL, +[nodeUser] [int] NULL, +[level] [int] NOT NULL, +[path] [nvarchar] (150) NOT NULL, +[sortOrder] [int] NOT NULL, +[uniqueID] [uniqueidentifier] NULL, +[text] [nvarchar] (255) NULL, +[nodeObjectType] [uniqueidentifier] NULL, +[createDate] [datetime] NOT NULL CONSTRAINT [DF_umbracoNode_createDate] DEFAULT (getdate()) +) + +; +ALTER TABLE [umbracoNode] ADD CONSTRAINT [PK_structure] PRIMARY KEY ([id]) +; +; +CREATE TABLE [cmsPropertyType] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[dataTypeId] [int] NOT NULL, +[contentTypeId] [int] NOT NULL, +[tabId] [int] NULL, +[Alias] [nvarchar] (255) NOT NULL, +[Name] [nvarchar] (255) NULL, +[helpText] [nvarchar] (1000) NULL, +[sortOrder] [int] NOT NULL CONSTRAINT [DF__cmsProper__sortO__1EA48E88] DEFAULT (0), +[mandatory] [bit] NOT NULL CONSTRAINT [DF__cmsProper__manda__2180FB33] DEFAULT (0), +[validationRegExp] [nvarchar] (255) NULL, +[Description] [nvarchar] (2000) NULL +) + +; +ALTER TABLE [cmsPropertyType] ADD CONSTRAINT [PK_cmsPropertyType] PRIMARY KEY ([id]) +; + +CREATE TABLE [cmsMacroProperty] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[macroPropertyHidden] [bit] NOT NULL CONSTRAINT [DF_macroProperty_macroPropertyHidden] DEFAULT (0), +[macroPropertyType] [int] NOT NULL, +[macro] [int] NOT NULL, +[macroPropertySortOrder] [tinyint] NOT NULL CONSTRAINT [DF_macroProperty_macroPropertySortOrder] DEFAULT (0), +[macroPropertyAlias] [nvarchar] (50) NOT NULL, +[macroPropertyName] [nvarchar] (255) NOT NULL +) + +; +ALTER TABLE [cmsMacroProperty] ADD CONSTRAINT [PK_macroProperty] PRIMARY KEY ([id]) +; +CREATE TABLE [cmsMacro] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[macroUseInEditor] [bit] NOT NULL CONSTRAINT [DF_macro_macroUseInEditor] DEFAULT (0), +[macroRefreshRate] [int] NOT NULL CONSTRAINT [DF_macro_macroRefreshRate] DEFAULT (0), +[macroAlias] [nvarchar] (255) NOT NULL, +[macroName] [nvarchar] (255) NULL, +[macroScriptType] [nvarchar] (255) NULL, +[macroScriptAssembly] [nvarchar] (255) NULL, +[macroXSLT] [nvarchar] (255) NULL, +[macroCacheByPage] [bit] NOT NULL CONSTRAINT [DF_cmsMacro_macroCacheByPage] DEFAULT (1), +[macroCachePersonalized] [bit] NOT NULL CONSTRAINT [DF_cmsMacro_macroCachePersonalized] DEFAULT (0), +[macroDontRender] [bit] NOT NULL CONSTRAINT [DF_cmsMacro_macroDontRender] DEFAULT (0) +) + +; +ALTER TABLE [cmsMacro] ADD CONSTRAINT [PK_macro] PRIMARY KEY ([id]) +; +CREATE TABLE [cmsContentVersion] +( +[id] [int] NOT NULL IDENTITY(1, 1) PRIMARY KEY, +[ContentId] [int] NOT NULL, +[VersionId] [uniqueidentifier] NOT NULL, +[VersionDate] [datetime] NOT NULL CONSTRAINT [DF_cmsContentVersion_VersionDate] DEFAULT (getdate()) +) + +; +CREATE TABLE [umbracoAppTree] +( +[treeSilent] [bit] NOT NULL CONSTRAINT [DF_umbracoAppTree_treeSilent] DEFAULT (0), +[treeInitialize] [bit] NOT NULL CONSTRAINT [DF_umbracoAppTree_treeInitialize] DEFAULT (1), +[treeSortOrder] [tinyint] NOT NULL, +[appAlias] [nvarchar] (50) NOT NULL, +[treeAlias] [nvarchar] (150) NOT NULL, +[treeTitle] [nvarchar] (255) NOT NULL, +[treeIconClosed] [nvarchar] (255) NOT NULL, +[treeIconOpen] [nvarchar] (255) NOT NULL, +[treeHandlerAssembly] [nvarchar] (255) NOT NULL, +[treeHandlerType] [nvarchar] (255) NOT NULL, +[action] [nvarchar] (255) NULL +) + +; +ALTER TABLE [umbracoAppTree] ADD CONSTRAINT [PK_umbracoAppTree] PRIMARY KEY ([appAlias], [treeAlias]) +; + +CREATE TABLE [cmsContentTypeAllowedContentType] +( +[Id] [int] NOT NULL, +[AllowedId] [int] NOT NULL +) + +; +ALTER TABLE [cmsContentTypeAllowedContentType] ADD CONSTRAINT [PK_cmsContentTypeAllowedContentType] PRIMARY KEY ([Id], [AllowedId]) +; +CREATE TABLE [cmsContentXml] +( +[nodeId] [int] NOT NULL, +[xml] [ntext] NOT NULL +) + +; +ALTER TABLE [cmsContentXml] ADD CONSTRAINT [PK_cmsContentXml] PRIMARY KEY ([nodeId]) +; +CREATE TABLE [cmsDataType] +( +[pk] [int] NOT NULL IDENTITY(1, 1), +[nodeId] [int] NOT NULL, +[controlId] [uniqueidentifier] NOT NULL, +[dbType] [nvarchar] (50) NOT NULL +) + +; +ALTER TABLE [cmsDataType] ADD CONSTRAINT [PK_cmsDataType] PRIMARY KEY ([pk]) +; +CREATE TABLE [cmsDataTypePreValues] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[datatypeNodeId] [int] NOT NULL, +[value] [nvarchar] (255) NULL, +[sortorder] [int] NOT NULL, +[alias] [nvarchar] (50) NULL +) + +; +ALTER TABLE [cmsDataTypePreValues] ADD CONSTRAINT [PK_cmsDataTypePreValues] PRIMARY KEY ([id]) +; +CREATE TABLE [cmsDictionary] +( +[pk] [int] NOT NULL IDENTITY(1, 1), +[id] [uniqueidentifier] NOT NULL, +[parent] [uniqueidentifier] NOT NULL, +[key] [nvarchar] (1000) NOT NULL +) + +; +ALTER TABLE [cmsDictionary] ADD CONSTRAINT [PK_cmsDictionary] PRIMARY KEY ([pk]) +; +CREATE TABLE [cmsLanguageText] +( +[pk] [int] NOT NULL IDENTITY(1, 1), +[languageId] [int] NOT NULL, +[UniqueId] [uniqueidentifier] NOT NULL, +[value] [nvarchar] (1000) NOT NULL +) + +; +ALTER TABLE [cmsLanguageText] ADD CONSTRAINT [PK_cmsLanguageText] PRIMARY KEY ([pk]) +; +CREATE TABLE [cmsMember2MemberGroup] +( +[Member] [int] NOT NULL, +[MemberGroup] [int] NOT NULL +) + +; +ALTER TABLE [cmsMember2MemberGroup] ADD CONSTRAINT [PK_cmsMember2MemberGroup] PRIMARY KEY ([Member], [MemberGroup]) +; +CREATE TABLE [cmsStylesheet] +( +[nodeId] [int] NOT NULL, +[filename] [nvarchar] (100) NOT NULL, +[content] [ntext] NULL +) + +; +CREATE TABLE [cmsStylesheetProperty] +( +[nodeId] [int] NOT NULL, +[stylesheetPropertyEditor] [bit] NULL, +[stylesheetPropertyAlias] [nvarchar] (50) NULL, +[stylesheetPropertyValue] [nvarchar] (400) NULL +) + +; +CREATE TABLE [umbracoDomains] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[domainDefaultLanguage] [int] NULL, +[domainRootStructureID] [int] NULL, +[domainName] [nvarchar] (255) NOT NULL +) + +; +ALTER TABLE [umbracoDomains] ADD CONSTRAINT [PK_domains] PRIMARY KEY ([id]) +; +CREATE TABLE [umbracoLanguage] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[languageISOCode] [nvarchar] (10) NULL, +[languageCultureName] [nvarchar] (100) NULL +) + +; +ALTER TABLE [umbracoLanguage] ADD CONSTRAINT [PK_language] PRIMARY KEY ([id]) +; +CREATE TABLE [umbracoRelationType] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[dual] [bit] NOT NULL, +[parentObjectType] [uniqueidentifier] NOT NULL, +[childObjectType] [uniqueidentifier] NOT NULL, +[name] [nvarchar] (255) NOT NULL, +[alias] [nvarchar] (100) NULL +) + +; +ALTER TABLE [umbracoRelationType] ADD CONSTRAINT [PK_umbracoRelationType] PRIMARY KEY ([id]) +; + +/* TABLE IS NEVER USED, REMOVED FOR 4.1 + +CREATE TABLE [umbracoStylesheet] +( +[nodeId] [int] NOT NULL, +[filename] [nvarchar] (100) NOT NULL, +[content] [ntext] NULL +) +; + +ALTER TABLE [umbracoStylesheet] ADD CONSTRAINT [PK_umbracoStylesheet] PRIMARY KEY ([nodeId]) +; + +*/ + +CREATE TABLE [umbracoUser2NodeNotify] +( +[userId] [int] NOT NULL, +[nodeId] [int] NOT NULL, +[action] [nchar] (1) NOT NULL +) + +; +ALTER TABLE [umbracoUser2NodeNotify] ADD CONSTRAINT [PK_umbracoUser2NodeNotify] PRIMARY KEY ([userId], [nodeId], [action]) +; +CREATE TABLE [umbracoUser2NodePermission] +( +[userId] [int] NOT NULL, +[nodeId] [int] NOT NULL, +[permission] [nchar] (1) NOT NULL +) + +; +ALTER TABLE [umbracoUser2NodePermission] ADD CONSTRAINT [PK_umbracoUser2NodePermission] PRIMARY KEY ([userId], [nodeId], [permission]) +; +CREATE TABLE [umbracoUserLogins] +( +[contextID] [uniqueidentifier] NOT NULL, +[userID] [int] NOT NULL, +[timeout] [bigint] NOT NULL +) + +; +ALTER TABLE [umbracoAppTree] ADD +CONSTRAINT [FK_umbracoAppTree_umbracoApp] FOREIGN KEY ([appAlias]) REFERENCES [umbracoApp] ([appAlias]) +; +ALTER TABLE [cmsPropertyData] ADD +CONSTRAINT [FK_cmsPropertyData_umbracoNode] FOREIGN KEY ([contentNodeId]) REFERENCES [umbracoNode] ([id]) +; + +/* TABLES ARE NEVER USED, REMOVED FOR 4.1 + +ALTER TABLE [umbracoUser2userGroup] ADD +CONSTRAINT [FK_user2userGroup_user] FOREIGN KEY ([user]) REFERENCES [umbracoUser] ([id]), +CONSTRAINT [FK_user2userGroup_userGroup] FOREIGN KEY ([userGroup]) REFERENCES [umbracoUserGroup] ([id]) +; + +*/ + +ALTER TABLE [cmsDocument] ADD +CONSTRAINT [FK_cmsDocument_umbracoNode] FOREIGN KEY ([nodeId]) REFERENCES [umbracoNode] ([id]) +; +ALTER TABLE [cmsMacroProperty] ADD +CONSTRAINT [FK_umbracoMacroProperty_umbracoMacroPropertyType] FOREIGN KEY ([macroPropertyType]) REFERENCES [cmsMacroPropertyType] ([id]) +; +ALTER TABLE [umbracoUser] ADD +CONSTRAINT [FK_user_userType] FOREIGN KEY ([userType]) REFERENCES [umbracoUserType] ([id]) +; +ALTER TABLE [umbracoNode] ADD +CONSTRAINT [FK_umbracoNode_umbracoNode] FOREIGN KEY ([parentID]) REFERENCES [umbracoNode] ([id]) +; +ALTER TABLE [cmsTemplate] ADD +CONSTRAINT [FK_cmsTemplate_umbracoNode] FOREIGN KEY ([nodeId]) REFERENCES [umbracoNode] ([id]) +; +ALTER TABLE [cmsContentType] ADD +CONSTRAINT [FK_cmsContentType_umbracoNode] FOREIGN KEY ([nodeId]) REFERENCES [umbracoNode] ([id]) +; +ALTER TABLE [cmsPropertyType] ADD +CONSTRAINT [FK_cmsPropertyType_cmsTab] FOREIGN KEY ([tabId]) REFERENCES [cmsTab] ([id]) +; +ALTER TABLE [cmsContent] ADD +CONSTRAINT [FK_cmsContent_umbracoNode] FOREIGN KEY ([nodeId]) REFERENCES [umbracoNode] ([id]) +; +ALTER TABLE [umbracoUser2app] ADD +CONSTRAINT [FK_umbracoUser2app_umbracoApp] FOREIGN KEY ([app]) REFERENCES [umbracoApp] ([appAlias]), +CONSTRAINT [FK_umbracoUser2app_umbracoUser] FOREIGN KEY ([user]) REFERENCES [umbracoUser] ([id]) +; + +ALTER TABLE [cmsTemplate] DROP CONSTRAINT [FK_cmsTemplate_umbracoNode] +; +ALTER TABLE [cmsPropertyType] DROP CONSTRAINT [FK_cmsPropertyType_cmsTab] +; +ALTER TABLE [cmsContent] DROP CONSTRAINT [FK_cmsContent_umbracoNode] +; +ALTER TABLE [cmsMacroProperty] DROP CONSTRAINT [FK_umbracoMacroProperty_umbracoMacroPropertyType] +; +ALTER TABLE [umbracoAppTree] DROP CONSTRAINT [FK_umbracoAppTree_umbracoApp] +; +ALTER TABLE [umbracoUser2app] DROP CONSTRAINT [FK_umbracoUser2app_umbracoApp] +; +ALTER TABLE [umbracoUser2app] DROP CONSTRAINT [FK_umbracoUser2app_umbracoUser] +; +ALTER TABLE [cmsPropertyData] DROP CONSTRAINT [FK_cmsPropertyData_umbracoNode] +; + +/* TABLE IS NEVER USED, REMOVED FOR 4.1 + +ALTER TABLE [umbracoUser2userGroup] DROP CONSTRAINT [FK_user2userGroup_user] +; +ALTER TABLE [umbracoUser2userGroup] DROP CONSTRAINT [FK_user2userGroup_userGroup] +; + +*/ + +ALTER TABLE [umbracoUser] DROP CONSTRAINT [FK_user_userType] +; +ALTER TABLE [cmsContentType] DROP CONSTRAINT [FK_cmsContentType_umbracoNode] +; +ALTER TABLE [cmsDocument] DROP CONSTRAINT [FK_cmsDocument_umbracoNode] +; +ALTER TABLE [umbracoNode] DROP CONSTRAINT [FK_umbracoNode_umbracoNode] +; +!!!SET IDENTITY_INSERT [umbracoNode] ON +|INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (-92, 0, -1, 0, 11, N'-1,-92', 37, 'f0bc4bfb-b499-40d6-ba86-058885a5178c', N'Label', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20040930 14:01:49.920') +|INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (-90, 0, -1, 0, 11, N'-1,-90', 35, '84c6b441-31df-4ffe-b67e-67d5bc3ae65a', N'Upload', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20040930 14:01:49.920') +|INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (-89, 0, -1, 0, 11, N'-1,-89', 34, 'c6bac0dd-4ab9-45b1-8e30-e4b619ee5da3', N'Textbox multiple', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20040930 14:01:49.920') +|INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (-88, 0, -1, 0, 11, N'-1,-88', 33, '0cc0eba1-9960-42c9-bf9b-60e150b429ae', N'Textstring', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20040930 14:01:49.920') +|INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (-87, 0, -1, 0, 11, N'-1,-87', 32, 'ca90c950-0aff-4e72-b976-a30b1ac57dad', N'Richtext editor', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20040930 14:01:49.920') +||INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (-51, 0, -1, 0, 11, N'-1,-51', 4, '2e6d3631-066e-44b8-aec4-96f09099b2b5', N'Numeric', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20040930 14:01:49.920') +||INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (-49, 0, -1, 0, 11, N'-1,-49', 2, '92897bc6-a5f3-4ffe-ae27-f2e7e33dda49', N'True/false', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20040930 14:01:49.920') +|INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (-43, 0, -1, 0, 1, N'-1,-43', 2, 'fbaf13a8-4036-41f2-93a3-974f678c312a', N'Checkbox list', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20041015 14:11:04.367') +|INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (-42, 0, -1, 0, 1, N'-1,-42', 2, '0b6a45e7-44ba-430d-9da5-4e46060b9e03', N'Dropdown', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20041015 14:10:59.000') +|INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (-41, 0, -1, 0, 1, N'-1,-41', 2, '5046194e-4237-453c-a547-15db3a07c4e1', N'Date Picker', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20041015 14:10:54.303') +|INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (-40, 0, -1, 0, 1, N'-1,-40', 2, 'bb5f57c9-ce2b-4bb9-b697-4caca783a805', N'Radiobox', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20041015 14:10:49.253') +|INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (-39, 0, -1, 0, 1, N'-1,-39', 2, 'f38f0ac7-1d27-439c-9f3f-089cd8825a53', N'Dropdown multiple', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20041015 14:10:44.480') +|INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (-38, 0, -1, 0, 1, N'-1,-38', 2, 'fd9f1447-6c61-4a7c-9595-5aa39147d318', N'Folder Browser', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20041015 14:10:37.020') +|INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (-37, 0, -1, 0, 1, N'-1,-37', 2, '0225af17-b302-49cb-9176-b9f35cab9c17', N'Approved Color', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20041015 14:10:30.580') +|INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (-36, 0, -1, 0, 1, N'-1,-36', 2, 'e4d66c0f-b935-4200-81f0-025f7256b89a', N'Date Picker with time', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20041015 14:10:23.007') +|INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (-1, 0, -1, 0, 0, N'-1', 0, '916724a5-173d-4619-b97e-b9de133dd6f5', N'SYSTEM DATA: umbraco master root', 'ea7d8624-4cfe-4578-a871-24aa946bf34d', '20040930 14:01:49.920') +||INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (1031, 0, -1, 1, 1, N'-1,1031', 2, 'f38bd2d7-65d0-48e6-95dc-87ce06ec2d3d', N'Folder', '4ea4382b-2f5a-4c2b-9587-ae9b3cf3602e', '20041201 00:13:40.743') +|INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (1032, 0, -1, 1, 1, N'-1,1032', 2, 'cc07b313-0843-4aa8-bbda-871c8da728c8', N'Image', '4ea4382b-2f5a-4c2b-9587-ae9b3cf3602e', '20041201 00:13:43.737') +|INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (1033, 0, -1, 1, 1, N'-1,1033', 2, '4c52d8ab-54e6-40cd-999c-7a5f24903e4d', N'File', '4ea4382b-2f5a-4c2b-9587-ae9b3cf3602e', '20041201 00:13:46.210') +||INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (1034, 0, -1, 0, 1, N'-1,1034', 2, 'a6857c73-d6e9-480c-b6e6-f15f6ad11125', N'Content Picker', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20060103 13:07:29.203') +|INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (1035, 0, -1, 0, 1, N'-1,1035', 2, '93929b9a-93a2-4e2a-b239-d99334440a59', N'Media Picker', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20060103 13:07:36.143') +|INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (1036, 0, -1, 0, 1, N'-1,1036', 2, '2b24165f-9782-4aa3-b459-1de4a4d21f60', N'Member Picker', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20060103 13:07:40.260') +|INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (1038, 0, -1, 0, 1, N'-1,1038', 2, '1251c96c-185c-4e9b-93f4-b48205573cbd', N'Simple Editor', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20060103 13:07:55.250') +|INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (1039, 0, -1, 0, 1, N'-1,1039', 2, '06f349a9-c949-4b6a-8660-59c10451af42', N'Ultimate Picker', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20060103 13:07:55.250') +|INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (1040, 0, -1, 0, 1, N'-1,1040', 2, '21e798da-e06e-4eda-a511-ed257f78d4fa', N'Related Links', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20060103 13:07:55.250') +|INSERT INTO [umbracoNode] ([id], [trashed], [parentID], [nodeUser], [level], [path], [sortOrder], [uniqueID], [text], [nodeObjectType], [createDate]) VALUES (1041, 0, -1, 0, 1, N'-1,1041', 2, 'b6b73142-b9c1-4bf8-a16d-e1c23320b549', N'Tags', '30a2a501-1978-4ddb-a57b-f7efed43ba3c', '20060103 13:07:55.250') +|SET IDENTITY_INSERT [umbracoNode] OFF +; +!!!SET IDENTITY_INSERT [cmsContentType] ON +|INSERT INTO [cmsContentType] ([pk], [nodeId], [alias], [icon]) VALUES (532, 1031, N'Folder', N'folder.gif') +|INSERT INTO [cmsContentType] ([pk], [nodeId], [alias], [icon]) VALUES (533, 1032, N'Image', N'mediaPhoto.gif') +|INSERT INTO [cmsContentType] ([pk], [nodeId], [alias], [icon]) VALUES (534, 1033, N'File', N'mediaMulti.gif') +|SET IDENTITY_INSERT [cmsContentType] OFF +; +!!!SET IDENTITY_INSERT [umbracoUser] ON +|INSERT INTO [umbracoUser] ([id], [userDisabled], [userNoConsole], [userType], [startStructureID], [startMediaID], [userName], [userLogin], [userPassword], [userEmail], [userDefaultPermissions], [userLanguage]) VALUES (0, 0, 0, 1, -1, -1, N'Administrator', N'admin', N'default', N'', NULL, N'en') +|SET IDENTITY_INSERT [umbracoUser] OFF +; +!!!SET IDENTITY_INSERT [umbracoUserType] ON +|INSERT INTO [umbracoUserType] ([id], [userTypeAlias], [userTypeName], [userTypeDefaultPermissions]) VALUES (1, N'admin', N'Administrators', N'CADMOSKTPIURZ:') +|INSERT INTO [umbracoUserType] ([id], [userTypeAlias], [userTypeName], [userTypeDefaultPermissions]) VALUES (2, N'writer', N'Writer', N'CAH:') +|INSERT INTO [umbracoUserType] ([id], [userTypeAlias], [userTypeName], [userTypeDefaultPermissions]) VALUES (3, N'editor', N'Editors', N'CADMOSKTPUZ:') +|insert into umbracoUserType ([id], [userTypeAlias], [userTypeName], [userTypeDefaultPermissions]) values (4, N'translator', N'Translator', 'A') +|SET IDENTITY_INSERT [umbracoUserType] OFF +; +!!!INSERT INTO [umbracoUser2app] ([user], [app]) VALUES (0, N'content') +|INSERT INTO [umbracoUser2app] ([user], [app]) VALUES (0, N'developer') +|INSERT INTO [umbracoUser2app] ([user], [app]) VALUES (0, N'media') +|INSERT INTO [umbracoUser2app] ([user], [app]) VALUES (0, N'member') +|INSERT INTO [umbracoUser2app] ([user], [app]) VALUES (0, N'settings') +|INSERT INTO [umbracoUser2app] ([user], [app]) VALUES (0, N'users') +|INSERT INTO [umbracoApp] ([appAlias], [sortOrder], [appIcon], [appName], [appInitWithTreeAlias]) VALUES (N'content', 0, N'.traycontent', N'Indhold', N'content') +|INSERT INTO [umbracoApp] ([appAlias], [sortOrder], [appIcon], [appName], [appInitWithTreeAlias]) VALUES (N'developer', 7, N'.traydeveloper', N'Developer', NULL) +|INSERT INTO [umbracoApp] ([appAlias], [sortOrder], [appIcon], [appName], [appInitWithTreeAlias]) VALUES (N'media', 1, N'.traymedia', N'Mediearkiv', NULL) +|INSERT INTO [umbracoApp] ([appAlias], [sortOrder], [appIcon], [appName], [appInitWithTreeAlias]) VALUES (N'member', 8, N'.traymember', N'Medlemmer', NULL) +|INSERT INTO [umbracoApp] ([appAlias], [sortOrder], [appIcon], [appName], [appInitWithTreeAlias]) VALUES (N'settings', 6, N'.traysettings', N'Indstillinger', NULL) +|INSERT INTO [umbracoApp] ([appAlias], [sortOrder], [appIcon], [appName], [appInitWithTreeAlias]) VALUES (N'users', 5, N'.trayusers', N'Brugere', NULL) +|INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'content', N'content', 1, 1, 0, N'Indhold', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadContent') +|INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'developer', N'cacheBrowser', 0, 1, 0, N'CacheBrowser', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadCache') +|INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'developer', N'CacheItem', 0, 0, 0, N'Cachebrowser', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadCacheItem') +|INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'developer', N'datatype', 0, 1, 1, N'Datatyper', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadDataTypes') +|INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'developer', N'macros', 0, 1, 2, N'Macros', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadMacros') +|INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'developer', N'xslt', 0, 1, 5, N'XSLT Files', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadXslt') +|INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'media', N'media', 0, 1, 0, N'Medier', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadMedia') +|INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'member', N'member', 0, 1, 0, N'Medlemmer', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadMembers') +|INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'member', N'memberGroup', 0, 1, 1, N'MemberGroups', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadMemberGroups') +|INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'member', N'memberType', 0, 1, 2, N'Medlemstyper', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadMemberTypes') +|INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType], [action]) VALUES (N'settings', N'dictionary', 0, 1, 3, N'Dictionary', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadDictionary', N'openDictionary()') +|INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'settings', N'languages', 0, 1, 4, N'Languages', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadLanguages') +|INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'settings', N'mediaTypes', 0, 1, 5, N'Medietyper', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadMediaTypes') +|INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'settings', N'nodeTypes', 0, 1, 6, N'Dokumenttyper', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadNodeTypes') +|INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'settings', N'stylesheetProperty', 0, 0, 0, N'Stylesheet Property', N'', N'', N'umbraco', N'loadStylesheetProperty') +|INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'settings', N'stylesheets', 0, 1, 0, N'Stylesheets', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadStylesheets') +|INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'settings', N'templates', 0, 1, 1, N'Templates', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadTemplates') +|INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'users', N'users', 0, 1, 0, N'Brugere', N'.sprTreeFolder', N'.sprTreeFolder_o', N'umbraco', N'loadUsers') +; +!!!SET IDENTITY_INSERT [cmsMacroPropertyType] ON +|INSERT INTO [cmsMacroPropertyType] ([id], [macroPropertyTypeAlias], [macroPropertyTypeRenderAssembly], [macroPropertyTypeRenderType], [macroPropertyTypeBaseType]) VALUES (3, N'mediaCurrent', N'umbraco.macroRenderings', N'media', N'Int32') +|INSERT INTO [cmsMacroPropertyType] ([id], [macroPropertyTypeAlias], [macroPropertyTypeRenderAssembly], [macroPropertyTypeRenderType], [macroPropertyTypeBaseType]) VALUES (4, N'contentSubs', N'umbraco.macroRenderings', N'content', N'Int32') +|INSERT INTO [cmsMacroPropertyType] ([id], [macroPropertyTypeAlias], [macroPropertyTypeRenderAssembly], [macroPropertyTypeRenderType], [macroPropertyTypeBaseType]) VALUES (5, N'contentRandom', N'umbraco.macroRenderings', N'content', N'Int32') +|INSERT INTO [cmsMacroPropertyType] ([id], [macroPropertyTypeAlias], [macroPropertyTypeRenderAssembly], [macroPropertyTypeRenderType], [macroPropertyTypeBaseType]) VALUES (6, N'contentPicker', N'umbraco.macroRenderings', N'content', N'Int32') +|INSERT INTO [cmsMacroPropertyType] ([id], [macroPropertyTypeAlias], [macroPropertyTypeRenderAssembly], [macroPropertyTypeRenderType], [macroPropertyTypeBaseType]) VALUES (13, N'number', N'umbraco.macroRenderings', N'numeric', N'Int32') +|INSERT INTO [cmsMacroPropertyType] ([id], [macroPropertyTypeAlias], [macroPropertyTypeRenderAssembly], [macroPropertyTypeRenderType], [macroPropertyTypeBaseType]) VALUES (14, N'bool', N'umbraco.macroRenderings', N'yesNo', N'Boolean') +|INSERT INTO [cmsMacroPropertyType] ([id], [macroPropertyTypeAlias], [macroPropertyTypeRenderAssembly], [macroPropertyTypeRenderType], [macroPropertyTypeBaseType]) VALUES (16, N'text', N'umbraco.macroRenderings', N'text', N'String') +|INSERT INTO [cmsMacroPropertyType] ([id], [macroPropertyTypeAlias], [macroPropertyTypeRenderAssembly], [macroPropertyTypeRenderType], [macroPropertyTypeBaseType]) VALUES (17, N'contentTree', N'umbraco.macroRenderings', N'content', N'Int32') +|INSERT INTO [cmsMacroPropertyType] ([id], [macroPropertyTypeAlias], [macroPropertyTypeRenderAssembly], [macroPropertyTypeRenderType], [macroPropertyTypeBaseType]) VALUES (18, N'contentType', N'umbraco.macroRenderings', N'contentTypeSingle', N'Int32') +|INSERT INTO [cmsMacroPropertyType] ([id], [macroPropertyTypeAlias], [macroPropertyTypeRenderAssembly], [macroPropertyTypeRenderType], [macroPropertyTypeBaseType]) VALUES (19, N'contentTypeMultiple', N'umbraco.macroRenderings', N'contentTypeMultiple', N'Int32') +|INSERT INTO [cmsMacroPropertyType] ([id], [macroPropertyTypeAlias], [macroPropertyTypeRenderAssembly], [macroPropertyTypeRenderType], [macroPropertyTypeBaseType]) VALUES (20, N'contentAll', N'umbraco.macroRenderings', N'content', N'Int32') +|INSERT INTO [cmsMacroPropertyType] ([id], [macroPropertyTypeAlias], [macroPropertyTypeRenderAssembly], [macroPropertyTypeRenderType], [macroPropertyTypeBaseType]) VALUES (21, N'tabPicker', N'umbraco.macroRenderings', N'tabPicker', N'String') +|INSERT INTO [cmsMacroPropertyType] ([id], [macroPropertyTypeAlias], [macroPropertyTypeRenderAssembly], [macroPropertyTypeRenderType], [macroPropertyTypeBaseType]) VALUES (22, N'tabPickerMultiple', N'umbraco.macroRenderings', N'tabPickerMultiple', N'String') +|INSERT INTO [cmsMacroPropertyType] ([id], [macroPropertyTypeAlias], [macroPropertyTypeRenderAssembly], [macroPropertyTypeRenderType], [macroPropertyTypeBaseType]) VALUES (23, N'propertyTypePicker', N'umbraco.macroRenderings', N'propertyTypePicker', N'String') +|INSERT INTO [cmsMacroPropertyType] ([id], [macroPropertyTypeAlias], [macroPropertyTypeRenderAssembly], [macroPropertyTypeRenderType], [macroPropertyTypeBaseType]) VALUES (24, N'propertyTypePickerMultiple', N'umbraco.macroRenderings', N'propertyTypePickerMultiple', N'String') +|INSERT INTO [cmsMacroPropertyType] ([id], [macroPropertyTypeAlias], [macroPropertyTypeRenderAssembly], [macroPropertyTypeRenderType], [macroPropertyTypeBaseType]) VALUES (25, N'textMultiLine', N'umbraco.macroRenderings', N'textMultiple', N'String') +|SET IDENTITY_INSERT [cmsMacroPropertyType] OFF +; +!!!SET IDENTITY_INSERT [cmsTab] ON +|INSERT INTO [cmsTab] ([id], [contenttypeNodeId], [text], [sortorder]) VALUES (3, 1032, N'Image', 1) +|INSERT INTO [cmsTab] ([id], [contenttypeNodeId], [text], [sortorder]) VALUES (4, 1033, N'File', 1) +|INSERT INTO [cmsTab] ([id], [contenttypeNodeId], [text], [sortorder]) VALUES (5, 1031, N'Contents', 1) +|SET IDENTITY_INSERT [cmsTab] OFF +; +!!!SET IDENTITY_INSERT [cmsPropertyType] ON +|INSERT INTO [cmsPropertyType] ([id], [dataTypeId], [contentTypeId], [tabId], [Alias], [Name], [helpText], [sortOrder], [mandatory], [validationRegExp], [Description]) VALUES (6, -90, 1032, 3, N'umbracoFile', N'Upload image', NULL, 0, 0, NULL, NULL) +|INSERT INTO [cmsPropertyType] ([id], [dataTypeId], [contentTypeId], [tabId], [Alias], [Name], [helpText], [sortOrder], [mandatory], [validationRegExp], [Description]) VALUES (7, -92, 1032, 3, N'umbracoWidth', N'Width', NULL, 0, 0, NULL, NULL) +|INSERT INTO [cmsPropertyType] ([id], [dataTypeId], [contentTypeId], [tabId], [Alias], [Name], [helpText], [sortOrder], [mandatory], [validationRegExp], [Description]) VALUES (8, -92, 1032, 3, N'umbracoHeight', N'Height', NULL, 0, 0, NULL, NULL) +|INSERT INTO [cmsPropertyType] ([id], [dataTypeId], [contentTypeId], [tabId], [Alias], [Name], [helpText], [sortOrder], [mandatory], [validationRegExp], [Description]) VALUES (9, -92, 1032, 3, N'umbracoBytes', N'Size', NULL, 0, 0, NULL, NULL) +|INSERT INTO [cmsPropertyType] ([id], [dataTypeId], [contentTypeId], [tabId], [Alias], [Name], [helpText], [sortOrder], [mandatory], [validationRegExp], [Description]) VALUES (10, -92, 1032, 3, N'umbracoExtension', N'Type', NULL, 0, 0, NULL, NULL) +|INSERT INTO [cmsPropertyType] ([id], [dataTypeId], [contentTypeId], [tabId], [Alias], [Name], [helpText], [sortOrder], [mandatory], [validationRegExp], [Description]) VALUES (24, -90, 1033, 4, N'umbracoFile', N'Upload file', NULL, 0, 0, NULL, NULL) +|INSERT INTO [cmsPropertyType] ([id], [dataTypeId], [contentTypeId], [tabId], [Alias], [Name], [helpText], [sortOrder], [mandatory], [validationRegExp], [Description]) VALUES (25, -92, 1033, 4, N'umbracoExtension', N'Type', NULL, 0, 0, NULL, NULL) +|INSERT INTO [cmsPropertyType] ([id], [dataTypeId], [contentTypeId], [tabId], [Alias], [Name], [helpText], [sortOrder], [mandatory], [validationRegExp], [Description]) VALUES (26, -92, 1033, 4, N'umbracoBytes', N'Size', NULL, 0, 0, NULL, NULL) +|INSERT INTO [cmsPropertyType] ([id], [dataTypeId], [contentTypeId], [tabId], [Alias], [Name], [helpText], [sortOrder], [mandatory], [validationRegExp], [Description]) VALUES (27, -38, 1031, 5, N'contents', N'Contents:', NULL, 0, 0, NULL, NULL) +|SET IDENTITY_INSERT [cmsPropertyType] OFF +; +!!!SET IDENTITY_INSERT [umbracoLanguage] ON +|INSERT INTO [umbracoLanguage] ([id], [languageISOCode], [languageCultureName]) VALUES (1, N'en-US', N'en-US') +|SET IDENTITY_INSERT [umbracoLanguage] OFF +; +INSERT INTO [cmsContentTypeAllowedContentType] ([Id], [AllowedId]) VALUES (1031, 1031) +; +INSERT INTO [cmsContentTypeAllowedContentType] ([Id], [AllowedId]) VALUES (1031, 1032) +; +INSERT INTO [cmsContentTypeAllowedContentType] ([Id], [AllowedId]) VALUES (1031, 1033) +; +!!!SET IDENTITY_INSERT [cmsDataType] ON +|INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (4, -49, '38b352c1-e9f8-4fd8-9324-9a2eab06d97a', 'Integer') +|INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (6, -51, '1413afcb-d19a-4173-8e9a-68288d2a73b8', 'Integer') +|INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (8, -87, '5E9B75AE-FACE-41c8-B47E-5F4B0FD82F83', 'Ntext') +|INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (9, -88, 'ec15c1e5-9d90-422a-aa52-4f7622c63bea', 'Nvarchar') +|INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (10, -89, '67db8357-ef57-493e-91ac-936d305e0f2a', 'Ntext') +|INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (11, -90, '5032a6e6-69e3-491d-bb28-cd31cd11086c', 'Nvarchar') +|INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (12, -91, 'a74ea9c9-8e18-4d2a-8cf6-73c6206c5da6', 'Nvarchar') +|INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (13, -92, '6c738306-4c17-4d88-b9bd-6546f3771597', 'Nvarchar') +|INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (14, -36, 'b6fb1622-afa5-4bbf-a3cc-d9672a442222', 'Date') +|INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (15, -37, 'f8d60f68-ec59-4974-b43b-c46eb5677985', 'Nvarchar') +|INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (16, -38, 'cccd4ae9-f399-4ed2-8038-2e88d19e810c', 'Nvarchar') +|INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (17, -39, '928639ed-9c73-4028-920c-1e55dbb68783', 'Nvarchar') +|INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (18, -40, 'a52c7c1c-c330-476e-8605-d63d3b84b6a6', 'Nvarchar') +|INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (19, -41, '23e93522-3200-44e2-9f29-e61a6fcbb79a', 'Date') +|INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (20, -42, 'a74ea9c9-8e18-4d2a-8cf6-73c6206c5da6', 'Integer') +|INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (21, -43, 'b4471851-82b6-4c75-afa4-39fa9c6a75e9', 'Nvarchar') +|INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (22, -44, 'a3776494-0574-4d93-b7de-efdfdec6f2d1', 'Ntext') +|INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (23, -128, 'a52c7c1c-c330-476e-8605-d63d3b84b6a6', 'Nvarchar') +|INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (24, -129, '928639ed-9c73-4028-920c-1e55dbb68783', 'Nvarchar') +|INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (25, -130, 'a74ea9c9-8e18-4d2a-8cf6-73c6206c5da6', 'Nvarchar') +|INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (26, -131, 'a74ea9c9-8e18-4d2a-8cf6-73c6206c5da6', 'Nvarchar') +|INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (27, -132, 'a74ea9c9-8e18-4d2a-8cf6-73c6206c5da6', 'Nvarchar') +|INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (28, -133, '6c738306-4c17-4d88-b9bd-6546f3771597', 'Ntext') +|INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (29, -134, '928639ed-9c73-4028-920c-1e55dbb68783', 'Nvarchar') +|INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (30, -50, 'aaf99bb2-dbbe-444d-a296-185076bf0484', 'Date') +|INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (31, 1034, '158aa029-24ed-4948-939e-c3da209e5fba', 'Integer') +|INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (32, 1035, 'ead69342-f06d-4253-83ac-28000225583b', 'Integer') +|INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (33, 1036, '39f533e4-0551-4505-a64b-e0425c5ce775', 'Integer') +|INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (35, 1038, '60b7dabf-99cd-41eb-b8e9-4d2e669bbde9', 'Ntext') +|INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (36, 1039, 'cdbf0b5d-5cb2-445f-bc12-fcaaec07cf2c', 'Ntext') +|INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (37, 1040, '71b8ad1a-8dc2-425c-b6b8-faa158075e63', 'Ntext') +|INSERT INTO [cmsDataType] ([pk], [nodeId], [controlId], [dbType]) VALUES (38, 1041, '4023e540-92f5-11dd-ad8b-0800200c9a66', 'Ntext') +|SET IDENTITY_INSERT [cmsDataType] OFF +; +ALTER TABLE [cmsTemplate] ADD CONSTRAINT [FK_cmsTemplate_umbracoNode] FOREIGN KEY ([nodeId]) REFERENCES [umbracoNode] ([id]) +; +ALTER TABLE [cmsPropertyType] ADD CONSTRAINT [FK_cmsPropertyType_cmsTab] FOREIGN KEY ([tabId]) REFERENCES [cmsTab] ([id]) +; +ALTER TABLE [cmsContent] ADD CONSTRAINT [FK_cmsContent_umbracoNode] FOREIGN KEY ([nodeId]) REFERENCES [umbracoNode] ([id]) +; +ALTER TABLE [cmsMacroProperty] ADD CONSTRAINT [FK_umbracoMacroProperty_umbracoMacroPropertyType] FOREIGN KEY ([macroPropertyType]) REFERENCES [cmsMacroPropertyType] ([id]) +; +ALTER TABLE [umbracoAppTree] ADD CONSTRAINT [FK_umbracoAppTree_umbracoApp] FOREIGN KEY ([appAlias]) REFERENCES [umbracoApp] ([appAlias]) +; +ALTER TABLE [umbracoUser2app] ADD CONSTRAINT [FK_umbracoUser2app_umbracoApp] FOREIGN KEY ([app]) REFERENCES [umbracoApp] ([appAlias]) +; +ALTER TABLE [umbracoUser2app] ADD CONSTRAINT [FK_umbracoUser2app_umbracoUser] FOREIGN KEY ([user]) REFERENCES [umbracoUser] ([id]) +; +ALTER TABLE [cmsPropertyData] ADD CONSTRAINT [FK_cmsPropertyData_umbracoNode] FOREIGN KEY ([contentNodeId]) REFERENCES [umbracoNode] ([id]) +; +ALTER TABLE [umbracoUser] ADD CONSTRAINT [FK_user_userType] FOREIGN KEY ([userType]) REFERENCES [umbracoUserType] ([id]) +; +ALTER TABLE [cmsContentType] ADD CONSTRAINT [FK_cmsContentType_umbracoNode] FOREIGN KEY ([nodeId]) REFERENCES [umbracoNode] ([id]) +; +ALTER TABLE [cmsDocument] ADD CONSTRAINT [FK_cmsDocument_umbracoNode] FOREIGN KEY ([nodeId]) REFERENCES [umbracoNode] ([id]) +; +ALTER TABLE [umbracoNode] ADD CONSTRAINT [FK_umbracoNode_umbracoNode] FOREIGN KEY ([parentID]) REFERENCES [umbracoNode] ([id]) +; +!!!set identity_insert umbracoNode on +|insert into umbracoNode (id, trashed, parentID, nodeUser, level, path, sortOrder, uniqueID, text, nodeObjectType) values (-20, 0, -1, 0, 0, '-1,-20', 0, '0F582A79-1E41-4CF0-BFA0-76340651891A', 'Recycle Bin', '01BB7FF2-24DC-4C0C-95A2-C24EF72BBAC8') +|set identity_insert umbracoNode off +; +ALTER TABLE cmsDataTypePreValues ALTER COLUMN value NVARCHAR(2500) NULL +; +CREATE TABLE [cmsTask] +( +[closed] [bit] NOT NULL CONSTRAINT [DF__cmsTask__closed__04E4BC85] DEFAULT ((0)), +[id] [int] NOT NULL IDENTITY(1, 1), +[taskTypeId] [int] NOT NULL, +[nodeId] [int] NOT NULL, +[parentUserId] [int] NOT NULL, +[userId] [int] NOT NULL, +[DateTime] [datetime] NOT NULL CONSTRAINT [DF__cmsTask__DateTim__05D8E0BE] DEFAULT (getdate()), +[Comment] [nvarchar] (500) NULL +) +; +ALTER TABLE [cmsTask] ADD CONSTRAINT [PK_cmsTask] PRIMARY KEY ([id]) +; +CREATE TABLE [cmsTaskType] +( +[id] [int] NOT NULL IDENTITY(1, 1), +[alias] [nvarchar] (255) NOT NULL +) +; +ALTER TABLE [cmsTaskType] ADD CONSTRAINT [PK_cmsTaskType] PRIMARY KEY ([id]) +; +ALTER TABLE [cmsTask] ADD +CONSTRAINT [FK_cmsTask_cmsTaskType] FOREIGN KEY ([taskTypeId]) REFERENCES [cmsTaskType] ([id]) +; +insert into cmsTaskType (alias) values ('toTranslate') +; +/* Add send to translate actions to admins and editors */ +update umbracoUserType set userTypeDefaultPermissions = userTypeDefaultPermissions + '5' where userTypeAlias in ('editor','admin') +; +/* Add translator usertype */ +; +insert into umbracoRelationType (dual, parentObjectType, childObjectType, name, alias) values (1, 'c66ba18e-eaf3-4cff-8a22-41b16d66a972', 'c66ba18e-eaf3-4cff-8a22-41b16d66a972', 'Relate Document On Copy','relateDocumentOnCopy') +; +ALTER TABLE cmsMacro ADD macroPython nvarchar(255) +; + +INSERT INTO [umbracoAppTree]([treeSilent], [treeInitialize], [treeSortOrder], [appAlias], [treeAlias], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES(0, 1, 4, 'developer', 'python', 'Python Files', 'folder.gif', 'folder_o.gif', 'umbraco', 'loadPython') +; +INSERT INTO [umbracoAppTree]([treeSilent], [treeInitialize], [treeSortOrder], [appAlias], [treeAlias], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES(0, 1, 2, 'settings', 'scripts', 'Scripts', 'folder.gif', 'folder_o.gif', 'umbraco', 'loadScripts') +; +alter TABLE [cmsContentType] +add [thumbnail] nvarchar(255) NOT NULL CONSTRAINT +[DF_cmsContentType_thumbnail] DEFAULT ('folder.png') +; +alter TABLE [cmsContentType] +add [description] nvarchar(1500) NULL +; +ALTER TABLE umbracoLog ALTER COLUMN logComment NVARCHAR(4000) NULL +; +!!!SET IDENTITY_INSERT [cmsDataTypePreValues] ON +|insert into cmsDataTypePreValues (id, dataTypeNodeId, [value], sortorder, alias) values (3,-87,',code,undo,redo,cut,copy,mcepasteword,stylepicker,bold,italic,bullist,numlist,outdent,indent,mcelink,unlink,mceinsertanchor,mceimage,umbracomacro,mceinserttable,mcecharmap,' + nchar(124) + '1' + nchar(124) + '1,2,3,' + nchar(124) + '0' + nchar(124) + '500,400' + nchar(124) + '1049,' + nchar(124) + '', 0, '') +|insert into cmsDataTypePreValues (id, dataTypeNodeId, [value], sortorder, alias) values (4,1041,'default', 0, 'group') +|SET IDENTITY_INSERT [cmsDataTypePreValues] OFF +; +/* 3.1 SQL changes */ +INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'developer', N'packager', 0, 1, 3, N'Packages', N'folder.gif', N'folder_o.gif', N'umbraco', N'loadPackager') +; +INSERT INTO [umbracoAppTree] ([appAlias], [treeAlias], [treeSilent], [treeInitialize], [treeSortOrder], [treeTitle], [treeIconClosed], [treeIconOpen], [treeHandlerAssembly], [treeHandlerType]) VALUES (N'developer', N'packagerPackages', 0, 0, 1, N'Packager Packages', N'folder.gif', N'folder_o.gif', N'umbraco', N'loadPackages'); + + +/* Add ActionBrowse as a default permission to all user types that have ActionUpdate */ +UPDATE umbracoUserType SET userTypeDefaultPermissions = userTypeDefaultPermissions + 'F' WHERE CHARINDEX('A',userTypeDefaultPermissions,0) >= 1 +AND CHARINDEX('F',userTypeDefaultPermissions,0) < 1 +; +/* Add ActionToPublish to all users types that have the alias 'writer' */ +UPDATE umbracoUserType SET userTypeDefaultPermissions = userTypeDefaultPermissions + 'H' WHERE userTypeAlias = 'writer' +AND CHARINDEX('F',userTypeDefaultPermissions,0) < 1 +; +/* Add ActionBrowse to all user permissions for nodes that have the ActionUpdate permission */ +INSERT INTO umbracoUser2NodePermission (userID, nodeId, permission) +SELECT userID, nodeId, 'F' FROM umbracoUser2NodePermission WHERE permission='A' +; +/* Add ActionToPublish permissions to all nodes for users that are of type 'writer' */ +INSERT INTO umbracoUser2NodePermission (userID, nodeId, permission) +SELECT DISTINCT userID, nodeId, 'H' FROM umbracoUser2NodePermission WHERE userId IN +(SELECT umbracoUser.id FROM umbracoUserType INNER JOIN umbracoUser ON umbracoUserType.id = umbracoUser.userType WHERE (umbracoUserType.userTypeAlias = 'writer')) +; +/* Add the contentRecycleBin tree type */ +INSERT INTO umbracoAppTree (treeSilent, treeInitialize, treeSortOrder, appAlias, treeAlias, treeTitle, treeIconClosed, treeIconOpen, treeHandlerAssembly, treeHandlerType) +VALUES (0, 0, 0, 'content', 'contentRecycleBin', 'RecycleBin', 'folder.gif', 'folder_o.gif', 'umbraco', 'cms.presentation.Trees.ContentRecycleBin') +; +/* Add the UserType tree type */ +INSERT INTO umbracoAppTree (treeSilent, treeInitialize, treeSortOrder, appAlias, treeAlias, treeTitle, treeIconClosed, treeIconOpen, treeHandlerAssembly, treeHandlerType) +VALUES (0, 1, 1, 'users', 'userTypes', 'User Types', 'folder.gif', 'folder_o.gif', 'umbraco', 'cms.presentation.Trees.UserTypes') +; +/* Add the User Permission tree type */ +INSERT INTO umbracoAppTree (treeSilent, treeInitialize, treeSortOrder, appAlias, treeAlias, treeTitle, treeIconClosed, treeIconOpen, treeHandlerAssembly, treeHandlerType) +VALUES (0, 1, 2, 'users', 'userPermissions', 'User Permissions', 'folder.gif', 'folder_o.gif', 'umbraco', 'cms.presentation.Trees.UserPermissions'); + + +/* TRANSLATION RELATED SQL */ +INSERT INTO [umbracoApp] ([appAlias], [sortOrder], [appIcon], [appName], [appInitWithTreeAlias]) VALUES (N'translation', 5, N'.traytranslation', N'Translation', NULL) +; +INSERT INTO umbracoAppTree (treeSilent, treeInitialize, treeSortOrder, appAlias, treeAlias, treeTitle, treeIconClosed, treeIconOpen, treeHandlerAssembly, treeHandlerType) +VALUES (0, 1, 1, 'translation','openTasks', 'Tasks assigned to you', '.sprTreeFolder', '.sprTreeFolder_o', 'umbraco', 'loadOpenTasks'); +; +INSERT INTO umbracoAppTree (treeSilent, treeInitialize, treeSortOrder, appAlias, treeAlias, treeTitle, treeIconClosed, treeIconOpen, treeHandlerAssembly, treeHandlerType) +VALUES (0, 1, 2, 'translation','yourTasks', 'Tasks created by you', '.sprTreeFolder', '.sprTreeFolder_o', 'umbraco', 'loadYourTasks'); +; +alter TABLE [cmsContentType] +add [masterContentType] int NULL CONSTRAINT +[DF_cmsContentType_masterContentType] DEFAULT (0) +; +CREATE TABLE [cmsTagRelationship]( + [nodeId] [int] NOT NULL, + [tagId] [int] NOT NULL) +; + +CREATE TABLE [cmsTags]( + [id] [int] IDENTITY(1,1) NOT NULL, + [tag] [nvarchar](200) NULL, + [parentId] [int] NULL, + [group] [nvarchar](100) NULL) +; +alter TABLE [umbracoUser] +add [defaultToLiveEditing] bit NOT NULL CONSTRAINT +[DF_umbracoUser_defaultToLiveEditing] DEFAULT (0) +; + +/* INSERT NEW MEDIA RECYCLE BIN NODE */ +!!!SET IDENTITY_INSERT [umbracoNode] ON +|INSERT INTO umbracoNode (id, trashed, parentID, nodeUser, level, path, sortOrder, uniqueID, text, nodeObjectType) VALUES (-21, 0, -1, 0, 0, '-1,-21', 0, 'BF7C7CBC-952F-4518-97A2-69E9C7B33842', 'Recycle Bin', 'CF3D8E34-1C1C-41e9-AE56-878B57B32113') +|SET IDENTITY_INSERT [umbracoNode] OFF +; +/* Add the mediaRecycleBin tree type */ +INSERT INTO umbracoAppTree (treeSilent, treeInitialize, treeSortOrder, appAlias, treeAlias, treeTitle, treeIconClosed, treeIconOpen, treeHandlerAssembly, treeHandlerType) +VALUES (0, 0, 0, 'media', 'mediaRecycleBin', 'RecycleBin', 'folder.gif', 'folder_o.gif', 'umbraco', 'cms.presentation.Trees.MediaRecycleBin') +; + +/* PREVIEW */ +CREATE TABLE [cmsPreviewXml]( + [nodeId] [int] NOT NULL, + [versionId] [uniqueidentifier] NOT NULL, + [timestamp] [datetime] NOT NULL, + [xml] [ntext] NOT NULL) +; + + + + +/*********************************************************************************************************************** + +ADD NEW PRIMARY KEYS, FOREIGN KEYS AND INDEXES FOR VERSION 4.1 + +IMPORTANT!!!!! +YOU MUST MAKE SURE THAT THE SCRIPT BELOW THIS MATCHES THE KeysIndexesAndConstraints.sql FILE FOR THE MANUAL UPGRADE + +*/ + +/************************** CLEANUP ***********************************************/ + +/************************** CLEANUP END ********************************************/ + +/************************** RESEEDING NEEDED FOR SQL CE 4 ************************/ +ALTER TABLE [umbracoNode] ALTER COLUMN id IDENTITY(1042,1) +; +ALTER TABLE [cmsContentType] ALTER COLUMN pk IDENTITY(535,1) +; +ALTER TABLE [umbracoUser] ALTER COLUMN id IDENTITY(1,1) +; +ALTER TABLE [umbracoUserType] ALTER COLUMN id IDENTITY(5,1) +; +ALTER TABLE [cmsMacroPropertyType] ALTER COLUMN id IDENTITY(26,1) +; +ALTER TABLE [cmsTab] ALTER COLUMN id IDENTITY(6,1) +; +ALTER TABLE [cmsPropertyType] ALTER COLUMN id IDENTITY(28,1) +; +ALTER TABLE [umbracoLanguage] ALTER COLUMN id IDENTITY(2,1) +; +ALTER TABLE [cmsDataType] ALTER COLUMN pk IDENTITY(39,1) +; +ALTER TABLE [cmsDataTypePreValues] ALTER COLUMN id IDENTITY(5,1) \ No newline at end of file diff --git a/components/SQLCE4Umbraco/SqlCE4Umbraco.csproj b/components/SQLCE4Umbraco/SqlCE4Umbraco.csproj new file mode 100644 index 0000000000..b8248d5389 --- /dev/null +++ b/components/SQLCE4Umbraco/SqlCE4Umbraco.csproj @@ -0,0 +1,89 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {5BA5425F-27A7-4677-865E-82246498AA2E} + Library + Properties + SQLCE4Umbraco + SQLCE4Umbraco + v4.0 + 512 + SAK + SAK + SAK + SAK + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + False + ..\..\foreign dlls\SQLCE4\System.Data.SqlServerCe.dll + + + + + + + + bin\umbraco.DataLayer.dll + + + + + + + + + + + + True + True + SqlCEResources.resx + + + + + + + + + + ResXFileCodeGenerator + SqlCEResources1.Designer.cs + + + + + XCOPY "C:\Users\hartvig\Documents\Visual Studio 2008\Projects\SQLCE4Umbraco\SQLCE4Umbraco\bin\Debug\SQLCE4Umbraco.*" "C:\Websites\Umbraco 4.5.2\1.0.3891.20292\build\bin" /Y + + + \ No newline at end of file diff --git a/components/SQLCE4Umbraco/SqlCE4Umbraco.csproj.vspscc b/components/SQLCE4Umbraco/SqlCE4Umbraco.csproj.vspscc new file mode 100644 index 0000000000..feffdecaa4 --- /dev/null +++ b/components/SQLCE4Umbraco/SqlCE4Umbraco.csproj.vspscc @@ -0,0 +1,10 @@ +"" +{ +"FILE_VERSION" = "9237" +"ENLISTMENT_CHOICE" = "NEVER" +"PROJECT_FILE_RELATIVE_PATH" = "" +"NUMBER_OF_EXCLUDED_FILES" = "0" +"ORIGINAL_PROJECT_FILE_PATH" = "" +"NUMBER_OF_NESTED_PROJECTS" = "0" +"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" +} diff --git a/components/SQLCE4Umbraco/SqlCEDataReader.cs b/components/SQLCE4Umbraco/SqlCEDataReader.cs new file mode 100644 index 0000000000..88734237a3 --- /dev/null +++ b/components/SQLCE4Umbraco/SqlCEDataReader.cs @@ -0,0 +1,44 @@ +/************************************************************************************ + * + * Umbraco Data Layer + * MIT Licensed work + * ©2008 Ruben Verborgh + * + ***********************************************************************************/ + +using System.Data.SqlServerCe; +using umbraco.DataLayer; + +namespace SqlCE4Umbraco +{ + /// + /// Class that adapts a SqlDataReader.SqlDataReader to a RecordsReaderAdapter. + /// + public class SqlCeDataReaderHelper : RecordsReaderAdapter + { + #region Public Constructors + + /// + /// Initializes a new instance of the class. + /// + /// The data reader. + public SqlCeDataReaderHelper(System.Data.SqlServerCe.SqlCeDataReader dataReader) : base(dataReader) { } + + #endregion + + #region RecordsReaderAdapter Members + + /// + /// Gets a value indicating whether this instance has records. + /// + /// + /// true if this instance has records; otherwise, false. + /// + public override bool HasRecords + { + get { return DataReader.HasRows; } + } + + #endregion + } +} diff --git a/components/SQLCE4Umbraco/SqlCEHelper.cs b/components/SQLCE4Umbraco/SqlCEHelper.cs new file mode 100644 index 0000000000..c475db2d40 --- /dev/null +++ b/components/SQLCE4Umbraco/SqlCEHelper.cs @@ -0,0 +1,99 @@ +/************************************************************************************ + * + * Umbraco Data Layer + * MIT Licensed work + * ©2008 Ruben Verborgh + * + ***********************************************************************************/ + +using System; +using System.Data; +using System.Data.SqlServerCe; +using System.Xml; +using System.Diagnostics; +using umbraco.DataLayer; +using umbraco.DataLayer.SqlHelpers.SqlServer; + + +namespace SqlCE4Umbraco +{ + /// + /// Sql Helper for an SQL Server database. + /// + public class SqlCEHelper : SqlHelper + { + /// + /// Initializes a new instance of the class. + /// + /// The connection string. + public SqlCEHelper(string connectionString) : base(connectionString) + { + m_Utility = new SqlCEUtility(this); + } + + /// + /// Creates a new parameter for use with this specific implementation of ISqlHelper. + /// + /// Name of the parameter. + /// Value of the parameter. + /// A new parameter of the correct type. + /// Abstract factory pattern + public override IParameter CreateParameter(string parameterName, object value) + { + return new SqlCEParameter(parameterName, value); + } + + /// + /// Executes a command that returns a single value. + /// + /// The command text. + /// The parameters. + /// The return value of the command. + protected override object ExecuteScalar(string commandText, SqlCeParameter[] parameters) + { + #if DEBUG && DebugDataLayer + // Log Query Execution + Trace.TraceInformation(GetType().Name + " SQL ExecuteScalar: " + commandText); + #endif + + return SqlCeApplicationBlock.ExecuteScalar(ConnectionString, CommandType.Text, commandText, parameters); + } + + /// + /// Executes a command and returns the number of rows affected. + /// + /// The command text. + /// The parameters. + /// + /// The number of rows affected by the command. + /// + protected override int ExecuteNonQuery(string commandText, SqlCeParameter[] parameters) + { + #if DEBUG && DebugDataLayer + // Log Query Execution + Trace.TraceInformation(GetType().Name + " SQL ExecuteNonQuery: " + commandText); + #endif + + return SqlCeApplicationBlock.ExecuteNonQuery(ConnectionString, CommandType.Text, commandText, parameters); + } + + /// + /// Executes a command and returns a records reader containing the results. + /// + /// The command text. + /// The parameters. + /// + /// A data reader containing the results of the command. + /// + protected override IRecordsReader ExecuteReader(string commandText, SqlCeParameter[] parameters) + { + #if DEBUG && DebugDataLayer + // Log Query Execution + Trace.TraceInformation(GetType().Name + " SQL ExecuteReader: " + commandText); + #endif + + return new SqlCeDataReaderHelper(SqlCeApplicationBlock.ExecuteReader(ConnectionString, CommandType.Text, + commandText, parameters)); + } + } +} \ No newline at end of file diff --git a/components/SQLCE4Umbraco/SqlCEInstaller.cs b/components/SQLCE4Umbraco/SqlCEInstaller.cs new file mode 100644 index 0000000000..cadd02197e --- /dev/null +++ b/components/SQLCE4Umbraco/SqlCEInstaller.cs @@ -0,0 +1,128 @@ +/************************************************************************************ + * + * Umbraco Data Layer + * MIT Licensed work + * ©2008 Ruben Verborgh + * + ***********************************************************************************/ + +using System; +using System.Resources; +using umbraco.DataLayer.Utility.Installer; +using System.Diagnostics; + +namespace SqlCE4Umbraco +{ + /// + /// Database installer for an SQL Server data source. + /// + public class SqlCEInstaller : DefaultInstallerUtility + { + #region Private Constants + + /// The latest database version this installer supports. + private const DatabaseVersion LatestVersionSupported = DatabaseVersion.Version4_1; + + /// The specifications to determine the database version. + private static readonly VersionSpecs[] m_VersionSpecs = new VersionSpecs[] { + new VersionSpecs("id","umbracoNode", "-21", DatabaseVersion.Version4_1), + new VersionSpecs("action","umbracoAppTree",DatabaseVersion.Version4), + new VersionSpecs("description","cmsContentType",DatabaseVersion.Version3), + new VersionSpecs("id","sysobjects",DatabaseVersion.None) }; + + #endregion + + #region Public Properties + + /// + /// Gets a value indicating whether the installer can upgrade the data source. + /// + /// + /// true if the installer can upgrade the data source; otherwise, false. + /// + /// Empty data sources can't be upgraded, just installed. + public override bool CanUpgrade + { + get + { + return false; + } + } + + #endregion + + #region Protected Properties + + /// + /// Gets the version specification for evaluation by DetermineCurrentVersion. + /// Only first matching specification is taken into account. + /// + /// The version specifications. + protected override VersionSpecs[] VersionSpecs + { + get { return m_VersionSpecs; } + } + + #endregion + + #region Public Constructors + + /// + /// Initializes a new instance of the class. + /// + /// The SQL helper. + public SqlCEInstaller(SqlCEHelper sqlHelper) : base(sqlHelper, LatestVersionSupported) + { } + + #endregion + + #region DefaultInstaller Members + + /// + /// Returns the sql to do a full install + /// + protected override string FullInstallSql + { + get { return SqlCEResources.Total; } + } + + + /// + /// Returns the sql to do an upgrade + /// + protected override string UpgradeSql + { + get + { + string upgradeFile = string.Format("{0}_Upgrade", CurrentVersion.ToString()); + return SqlCEResources.ResourceManager.GetString(upgradeFile); + } + } + + // We need to override this as the default way of detection a db connection checks for systables that doesn't exist + // in a CE db + protected override DatabaseVersion DetermineCurrentVersion() + { + DatabaseVersion version = base.DetermineCurrentVersion(); + if (version != DatabaseVersion.Unavailable) + { + return version; + } + + // verify connection + try + { + if (SqlCeApplicationBlock.VerifyConnection(base.SqlHelper.ConnectionString)) + return DatabaseVersion.None; + } + catch (Exception e) + { + Trace.WriteLine(e.ToString()); + } + + return DatabaseVersion.Unavailable; + } + + #endregion + } +} diff --git a/components/SQLCE4Umbraco/SqlCEParameter.cs b/components/SQLCE4Umbraco/SqlCEParameter.cs new file mode 100644 index 0000000000..9aa0b4c400 --- /dev/null +++ b/components/SQLCE4Umbraco/SqlCEParameter.cs @@ -0,0 +1,34 @@ +/************************************************************************************ + * + * Umbraco Data Layer + * MIT Licensed work + * ©2008 Ruben Verborgh + * + ***********************************************************************************/ + +using System; +using System.Data.SqlServerCe; +using System.Data.SqlTypes; +using umbraco.DataLayer; + +namespace SqlCE4Umbraco +{ + /// + /// Parameter class for the SqlCEHelper. + /// + public class SqlCEParameter : SqlParameterAdapter + { + #region Public Constructors + + /// + /// Initializes a new instance of the class. + /// + /// Name of the parameter. + /// Value of the parameter. + public SqlCEParameter(string parameterName, object value) + : base(new SqlCeParameter(parameterName, value)) + { } + + #endregion + } +} diff --git a/components/SQLCE4Umbraco/SqlCEResources.resx b/components/SQLCE4Umbraco/SqlCEResources.resx new file mode 100644 index 0000000000..089865313d --- /dev/null +++ b/components/SQLCE4Umbraco/SqlCEResources.resx @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + sql\total.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + + \ No newline at end of file diff --git a/components/SQLCE4Umbraco/SqlCEResources1.Designer.cs b/components/SQLCE4Umbraco/SqlCEResources1.Designer.cs new file mode 100644 index 0000000000..3e2939cf74 --- /dev/null +++ b/components/SQLCE4Umbraco/SqlCEResources1.Designer.cs @@ -0,0 +1,88 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.1 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace SqlCE4Umbraco { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class SqlCEResources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal SqlCEResources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SQLCE4Umbraco.SqlCEResources", typeof(SqlCEResources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to /******************************************************************************************* + /// + /// + /// + /// + /// + /// + /// + /// Umbraco database installation script for SQL Server + /// + ///IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT + /// + /// Database version: 4.1.0.0 + /// + /// Please increment this version number if ANY change is made to this script, + /// so compatibility with scripts for other database systems can be verified easily. + /// The first 3 digits depict the Umbraco versi [rest of string was truncated]";. + /// + internal static string Total { + get { + return ResourceManager.GetString("Total", resourceCulture); + } + } + } +} diff --git a/components/SQLCE4Umbraco/SqlCETableUtility.cs b/components/SQLCE4Umbraco/SqlCETableUtility.cs new file mode 100644 index 0000000000..b404885d3e --- /dev/null +++ b/components/SQLCE4Umbraco/SqlCETableUtility.cs @@ -0,0 +1,243 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Text; +using umbraco.DataLayer.Utility.Table; +using umbraco.DataLayer; +using umbraco; + +namespace SqlCE4Umbraco +{ + /// + /// SQL Server implementation of . + /// + public class SqlCETableUtility : DefaultTableUtility + { + /// + /// Initializes a new instance of the class. + /// + /// The SQL helper. + public SqlCETableUtility(SqlCEHelper sqlHelper) + : base(sqlHelper) + { } + + #region DefaultTableUtility members + + /// + /// Gets the table with the specified name. + /// + /// The name. + /// The table, or null if no table with that name exists. + public override ITable GetTable(string name) + { + if (name == null) + throw new ArgumentNullException("name"); + + ITable table = null; + + // get name in correct casing + name = SqlHelper.ExecuteScalar("SELECT name FROM sys.tables WHERE name=@name", + SqlHelper.CreateParameter("name", name)); + if (name != null) + { + table = new DefaultTable(name); + + using (IRecordsReader reader = SqlHelper.ExecuteReader( + @"SELECT c.name AS Name, st.name AS DataType, c.max_length, c.is_nullable, c.is_identity + FROM sys.tables AS t + JOIN sys.columns AS c ON t.object_id = c.object_id + JOIN sys.schemas AS s ON s.schema_id = t.schema_id + JOIN sys.types AS ty ON ty.user_type_id = c.user_type_id + JOIN sys.types st ON ty.system_type_id = st.user_type_id + WHERE t.name = @name + ORDER BY c.column_id", SqlHelper.CreateParameter("name", name))) + { + while (reader.Read()) + { + table.AddField(table.CreateField(reader.GetString("Name"), GetType(reader))); + } + } + } + + return table; + } + + /// + /// Saves or updates the table. + /// + /// The table to be saved. + public override void SaveTable(ITable table) + { + if (table == null) + throw new ArgumentNullException("table"); + + ITable oldTable = GetTable(table.Name); + + // create the table if it didn't exist, update fields otherwise + if (oldTable == null) + { + CreateTable(table); + } + else + { + foreach (IField field in table) + { + // create the field if it did't exist in the old table + if (oldTable.FindField(field.Name)==null) + { + CreateColumn(table, field); + } + } + } + } + + #endregion + + #region Protected Helper Methods + + /// + /// Creates the table in the data source. + /// + /// The table. + protected virtual void CreateTable(ITable table) + { + Debug.Assert(table != null); + + // create enumerator and check for first field + IEnumerator fieldEnumerator = table.GetEnumerator(); + bool hasNext = fieldEnumerator.MoveNext(); + if(!hasNext) + throw new ArgumentException("The table must contain at least one field."); + + // create query + StringBuilder createTableQuery = new StringBuilder(); + createTableQuery.AppendFormat("CREATE TABLE [{0}] (", SqlHelper.EscapeString(table.Name)); + + // add fields + while (hasNext) + { + // add field name and type + IField field = fieldEnumerator.Current; + createTableQuery.Append('[').Append(field.Name).Append(']'); + createTableQuery.Append(' ').Append(GetDatabaseType(field)); + + // append comma if a following field exists + hasNext = fieldEnumerator.MoveNext(); + if (hasNext) + { + createTableQuery.Append(','); + } + } + + // close CREATE TABLE x (...) bracket + createTableQuery.Append(')'); + + // execute query + try + { + SqlHelper.ExecuteNonQuery(createTableQuery.ToString()); + } + catch (Exception executeException) + { + throw new UmbracoException(String.Format("Could not create table '{0}'.", table), executeException); + } + } + + /// + /// Creates a new column in the table. + /// + /// The table. + /// The field used to create the column. + protected virtual void CreateColumn(ITable table, IField field) + { + Debug.Assert(table != null && field != null); + + StringBuilder addColumnQuery = new StringBuilder(); + addColumnQuery.AppendFormat("ALTER TABLE [{0}] ADD [{1}] {2}", + SqlHelper.EscapeString(table.Name), + SqlHelper.EscapeString(field.Name), + SqlHelper.EscapeString(GetDatabaseType(field))); + try + { + SqlHelper.ExecuteNonQuery(addColumnQuery.ToString()); + } + catch (Exception executeException) + { + throw new UmbracoException(String.Format("Could not create column '{0}' in table '{1}'.", + field, table.Name), executeException); + } + } + + /// + /// Gets the .Net type corresponding to the specified database data type. + /// + /// The data type reader. + /// The .Net type + protected virtual Type GetType(IRecordsReader dataTypeReader) + { + string typeName = dataTypeReader.GetString("DataType"); + + switch (typeName) + { + case "bit": return typeof(bool); + case "tinyint": return typeof(byte); + case "datetime": return typeof(DateTime); + // TODO: return different decimal type according to field precision + case "decimal": return typeof(decimal); + case "uniqueidentifier": return typeof(Guid); + case "smallint": return typeof(Int16); + case "int": return typeof(Int32); + case "bigint": return typeof(Int64); + case "nvarchar": return typeof(string); + default: + throw new ArgumentException(String.Format("Cannot convert database type '{0}' to a .Net type.", + typeName)); + } + } + + /// + /// Gets the database type corresponding to the field, complete with field properties. + /// + /// The field. + /// The database type. + protected virtual string GetDatabaseType(IField field) + { + StringBuilder fieldBuilder = new StringBuilder(); + + fieldBuilder.Append(GetDatabaseTypeName(field)); + fieldBuilder.Append(field.HasProperty(FieldProperties.Identity) ? " IDENTITY(1,1)" : String.Empty); + fieldBuilder.Append(field.HasProperty(FieldProperties.NotNull) ? " NOT NULL" : " NULL"); + + return fieldBuilder.ToString(); + } + + /// + /// Gets the name of the database type, without field properties. + /// + /// The field. + /// + protected virtual string GetDatabaseTypeName(IField field) + { + switch (field.DataType.FullName) + { + case "System.Boolean": return "bit"; + case "System.Byte": return "tinyint"; + case "System.DateTime": return "datetime"; + case "System.Decimal": return "decimal(28)"; + case "System.Double": return "decimal(15)"; + case "System.Single": return "decimal(7)"; + case "System.Guid": return "uniqueidentifier"; + case "System.Int16": return "smallint"; + case "System.Int32": return "int"; + case "System.Int64": return "bigint";; + case "System.String": + string type = "nvarchar"; + return field.Size == 0 ? type : String.Format("{0}({1})", type, field.Size); + default: + throw new ArgumentException(String.Format("Cannot convert '{0}' to a database type.", field)); + } + } + + #endregion + } +} diff --git a/components/SQLCE4Umbraco/SqlCEUtility.cs b/components/SQLCE4Umbraco/SqlCEUtility.cs new file mode 100644 index 0000000000..28d5dbd71e --- /dev/null +++ b/components/SQLCE4Umbraco/SqlCEUtility.cs @@ -0,0 +1,53 @@ +/************************************************************************************ + * + * Umbraco Data Layer + * MIT Licensed work + * ©2008 Ruben Verborgh + * + ***********************************************************************************/ + +using umbraco.DataLayer.Utility; +using umbraco.DataLayer.Utility.Installer; +using umbraco.DataLayer.Utility.Table; + +namespace SqlCE4Umbraco +{ + /// + /// Utility for an SQL Server data source. + /// + public class SqlCEUtility : DefaultUtility + { + #region Public Constructors + + /// + /// Initializes a new instance of the class. + /// + /// The SQL helper. + public SqlCEUtility(SqlCEHelper sqlHelper) : base(sqlHelper) + { } + + #endregion + + #region DefaultUtility Members + + /// + /// Creates an installer. + /// + /// The SQL Server installer. + public override IInstallerUtility CreateInstaller() + { + return new SqlCEInstaller(SqlHelper); + } + + /// + /// Creates a table utility. + /// + /// The table utility + public override ITableUtility CreateTableUtility() + { + return new SqlCETableUtility(SqlHelper); + } + + #endregion + } +} diff --git a/components/SQLCE4Umbraco/SqlCeApplicationBlock.cs b/components/SQLCE4Umbraco/SqlCeApplicationBlock.cs new file mode 100644 index 0000000000..0d7dd5e8bf --- /dev/null +++ b/components/SQLCE4Umbraco/SqlCeApplicationBlock.cs @@ -0,0 +1,196 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Data.SqlServerCe; +using System.Data; +using System.Diagnostics; + +namespace SqlCE4Umbraco +{ + public class SqlCeApplicationBlock + { + /// + /// + /// + /// + /// + /// + /// + /// + public static object ExecuteScalar( + string connectionString, + CommandType commandType, + string commandText, + params SqlCeParameter[] commandParameters + ) + { + object retVal; + + try + { + using (SqlCeConnection conn = new SqlCeConnection()) + { + conn.ConnectionString = connectionString; + conn.Open(); + using (SqlCeCommand cmd = new SqlCeCommand(commandText, conn)) + { + AttachParameters(cmd, commandParameters); + Debug.WriteLine("---------------------------------SCALAR-------------------------------------"); + Debug.WriteLine(commandText); + Debug.WriteLine("----------------------------------------------------------------------------"); + retVal = cmd.ExecuteScalar(); + } + } + + return retVal; + } + catch (Exception ee) + { + throw new SqlCeProviderException("Error running Scalar: \nSQL Statement:\n" + commandText + "\n\nException:\n" + ee.ToString()); + } + } + + /// + /// + /// + /// + /// + /// + /// + public static int ExecuteNonQuery( + string connectionString, + CommandType commandType, + string commandText, + params SqlCeParameter[] commandParameters + ) + { + try + { + int rowsAffected; + using (SqlCeConnection conn = new SqlCeConnection()) + { + // this is for multiple queries in the installer + if (commandText.Trim().StartsWith("!!!")) + { + commandText = commandText.Trim().Trim('!'); + string[] commands = commandText.Split('|'); + string currentCmd = String.Empty; + conn.ConnectionString = connectionString; + conn.Open(); + + foreach (string cmd in commands) + { + try + { + currentCmd = cmd; + if (!String.IsNullOrWhiteSpace(cmd)) + { + SqlCeCommand c = new SqlCeCommand(cmd, conn); + c.ExecuteNonQuery(); + } + } + catch (Exception e) + { + Debug.WriteLine("*******************************************************************"); + Debug.WriteLine(currentCmd); + Debug.WriteLine(e); + Debug.WriteLine("*******************************************************************"); + } + } + return 1; + } + else + { + Debug.WriteLine("----------------------------------------------------------------------------"); + Debug.WriteLine(commandText); + Debug.WriteLine("----------------------------------------------------------------------------"); + conn.ConnectionString = connectionString; + conn.Open(); + SqlCeCommand cmd = new SqlCeCommand(commandText, conn); + AttachParameters(cmd, commandParameters); + rowsAffected = cmd.ExecuteNonQuery(); + } + } + + return rowsAffected; + } + catch (Exception ee) + { + throw new SqlCeProviderException("Error running NonQuery: \nSQL Statement:\n" + commandText + "\n\nException:\n" + ee.ToString()); + } + } + + /// + /// + /// + /// + /// + /// + /// + /// + public static SqlCeDataReader ExecuteReader( + string connectionString, + CommandType commandType, + string commandText, + params SqlCeParameter[] commandParameters + ) + { + try + { + Debug.WriteLine("---------------------------------READER-------------------------------------"); + Debug.WriteLine(commandText); + Debug.WriteLine("----------------------------------------------------------------------------"); + SqlCeDataReader reader; + SqlCeConnection conn = new SqlCeConnection(); + conn.ConnectionString = connectionString; + conn.Open(); + try + { + SqlCeCommand cmd = new SqlCeCommand(commandText, conn); + AttachParameters(cmd, commandParameters); + reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); + } + catch + { + conn.Close(); + throw; + } + + return reader; + } + catch (Exception ee) + { + throw new SqlCeProviderException("Error running Reader: \nSQL Statement:\n" + commandText + "\n\nException:\n" + ee.ToString()); + } + } + + public static bool VerifyConnection(string connectionString) + { + bool isConnected = false; + using (SqlCeConnection conn = new SqlCeConnection()) + { + conn.ConnectionString = connectionString; + conn.Open(); + isConnected = conn.State == ConnectionState.Open; + } + + return isConnected; + } + + private static void AttachParameters(SqlCeCommand command, SqlCeParameter[] commandParameters) + { + foreach (SqlCeParameter parameter in commandParameters) + { + if ((parameter.Direction == ParameterDirection.InputOutput) && (parameter.Value == null)) + { + parameter.Value = DBNull.Value; + } + command.Parameters.Add(parameter); + } + } + + + + } +} diff --git a/components/SQLCE4Umbraco/SqlCeProviderException.cs b/components/SQLCE4Umbraco/SqlCeProviderException.cs new file mode 100644 index 0000000000..e7c105fd4d --- /dev/null +++ b/components/SQLCE4Umbraco/SqlCeProviderException.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SqlCE4Umbraco +{ + public class SqlCeProviderException : Exception + { + public SqlCeProviderException() : base() + { + + } + + public SqlCeProviderException(string message) : base(message) + { + + } + } +} diff --git a/foreign dlls/SQLCE4/System.Data.SqlServerCe.Entity.dll b/foreign dlls/SQLCE4/System.Data.SqlServerCe.Entity.dll new file mode 100644 index 0000000000..8142f0c105 Binary files /dev/null and b/foreign dlls/SQLCE4/System.Data.SqlServerCe.Entity.dll differ diff --git a/foreign dlls/SQLCE4/System.Data.SqlServerCe.dll b/foreign dlls/SQLCE4/System.Data.SqlServerCe.dll new file mode 100644 index 0000000000..376bdacf9f Binary files /dev/null and b/foreign dlls/SQLCE4/System.Data.SqlServerCe.dll differ diff --git a/foreign dlls/SQLCE4/amd64/sqlceca40.dll b/foreign dlls/SQLCE4/amd64/sqlceca40.dll new file mode 100644 index 0000000000..aa6b2e0ed2 Binary files /dev/null and b/foreign dlls/SQLCE4/amd64/sqlceca40.dll differ diff --git a/foreign dlls/SQLCE4/amd64/sqlcecompact40.dll b/foreign dlls/SQLCE4/amd64/sqlcecompact40.dll new file mode 100644 index 0000000000..263e458f23 Binary files /dev/null and b/foreign dlls/SQLCE4/amd64/sqlcecompact40.dll differ diff --git a/foreign dlls/SQLCE4/amd64/sqlceer40EN.dll b/foreign dlls/SQLCE4/amd64/sqlceer40EN.dll new file mode 100644 index 0000000000..197f38eb06 Binary files /dev/null and b/foreign dlls/SQLCE4/amd64/sqlceer40EN.dll differ diff --git a/foreign dlls/SQLCE4/amd64/sqlceme40.dll b/foreign dlls/SQLCE4/amd64/sqlceme40.dll new file mode 100644 index 0000000000..8f42f181c4 Binary files /dev/null and b/foreign dlls/SQLCE4/amd64/sqlceme40.dll differ diff --git a/foreign dlls/SQLCE4/amd64/sqlceqp40.dll b/foreign dlls/SQLCE4/amd64/sqlceqp40.dll new file mode 100644 index 0000000000..899b080cbb Binary files /dev/null and b/foreign dlls/SQLCE4/amd64/sqlceqp40.dll differ diff --git a/foreign dlls/SQLCE4/amd64/sqlcese40.dll b/foreign dlls/SQLCE4/amd64/sqlcese40.dll new file mode 100644 index 0000000000..fa39afa751 Binary files /dev/null and b/foreign dlls/SQLCE4/amd64/sqlcese40.dll differ diff --git a/foreign dlls/SQLCE4/x86/sqlceca40.dll b/foreign dlls/SQLCE4/x86/sqlceca40.dll new file mode 100644 index 0000000000..53d50a29f8 Binary files /dev/null and b/foreign dlls/SQLCE4/x86/sqlceca40.dll differ diff --git a/foreign dlls/SQLCE4/x86/sqlcecompact40.dll b/foreign dlls/SQLCE4/x86/sqlcecompact40.dll new file mode 100644 index 0000000000..452a26e49e Binary files /dev/null and b/foreign dlls/SQLCE4/x86/sqlcecompact40.dll differ diff --git a/foreign dlls/SQLCE4/x86/sqlceer40EN.dll b/foreign dlls/SQLCE4/x86/sqlceer40EN.dll new file mode 100644 index 0000000000..f8656b0a91 Binary files /dev/null and b/foreign dlls/SQLCE4/x86/sqlceer40EN.dll differ diff --git a/foreign dlls/SQLCE4/x86/sqlceme40.dll b/foreign dlls/SQLCE4/x86/sqlceme40.dll new file mode 100644 index 0000000000..6aeb1cb49b Binary files /dev/null and b/foreign dlls/SQLCE4/x86/sqlceme40.dll differ diff --git a/foreign dlls/SQLCE4/x86/sqlceqp40.dll b/foreign dlls/SQLCE4/x86/sqlceqp40.dll new file mode 100644 index 0000000000..d1498fa33b Binary files /dev/null and b/foreign dlls/SQLCE4/x86/sqlceqp40.dll differ diff --git a/foreign dlls/SQLCE4/x86/sqlcese40.dll b/foreign dlls/SQLCE4/x86/sqlcese40.dll new file mode 100644 index 0000000000..731b01d797 Binary files /dev/null and b/foreign dlls/SQLCE4/x86/sqlcese40.dll differ diff --git a/umbraco.sln b/umbraco.sln index c96d807021..8c9ec446b6 100644 --- a/umbraco.sln +++ b/umbraco.sln @@ -108,9 +108,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "assets", "assets", "{194009 assets\Umbraco.sdf = assets\Umbraco.sdf EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SqlCE4Umbraco", "components\SQLCE4Umbraco\SqlCE4Umbraco.csproj", "{5BA5425F-27A7-4677-865E-82246498AA2E}" +EndProject Global GlobalSection(TeamFoundationVersionControl) = preSolution - SccNumberOfProjects = 14 + SccNumberOfProjects = 15 SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} SccTeamFoundationServer = https://tfs.codeplex.com/tfs/tfs01 SccLocalPath0 = . @@ -153,6 +155,9 @@ Global SccProjectUniqueName13 = umbraco.Test\\umbraco.Test.csproj SccProjectName13 = umbraco.Test SccLocalPath13 = umbraco.Test + SccProjectUniqueName14 = components\\SQLCE4Umbraco\\SqlCE4Umbraco.csproj + SccProjectName14 = components/SQLCE4Umbraco + SccLocalPath14 = components\\SQLCE4Umbraco EndGlobalSection GlobalSection(TestCaseManagementSettings) = postSolution CategoryFile = umbraco2.vsmdi @@ -211,6 +216,10 @@ Global {6277C9FB-3A9A-4537-AA86-82DA9B2527FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6277C9FB-3A9A-4537-AA86-82DA9B2527FD}.Release|Any CPU.ActiveCfg = Release|Any CPU {6277C9FB-3A9A-4537-AA86-82DA9B2527FD}.Release|Any CPU.Build.0 = Release|Any CPU + {5BA5425F-27A7-4677-865E-82246498AA2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5BA5425F-27A7-4677-865E-82246498AA2E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5BA5425F-27A7-4677-865E-82246498AA2E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5BA5425F-27A7-4677-865E-82246498AA2E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE