2017-12-18 18:26:32 +01:00
using System ;
using NPoco ;
using Umbraco.Core.Configuration ;
using Umbraco.Core.Logging ;
2018-03-21 11:32:07 +01:00
using Umbraco.Core.Migrations.Upgrade ;
2017-12-18 18:26:32 +01:00
using Umbraco.Core.Models ;
2017-12-28 09:06:33 +01:00
using Umbraco.Core.Persistence.Dtos ;
2017-12-18 18:26:32 +01:00
namespace Umbraco.Core.Migrations.Install
{
/// <summary>
/// Creates the initial database data during install.
/// </summary>
internal class DatabaseDataCreator
{
private readonly IDatabase _database ;
private readonly ILogger _logger ;
public DatabaseDataCreator ( IDatabase database , ILogger logger )
{
_database = database ;
_logger = logger ;
}
/// <summary>
/// Initialize the base data creation by inserting the data foundation for umbraco
/// specific to a table
/// </summary>
/// <param name="tableName">Name of the table to create base data for</param>
public void InitializeBaseData ( string tableName )
{
2018-08-14 15:08:32 +01:00
_logger . Info < DatabaseDataCreator > ( "Creating data in {TableName}" , tableName ) ;
2017-12-18 18:26:32 +01:00
if ( tableName . Equals ( Constants . DatabaseSchema . Tables . Node ) )
CreateNodeData ( ) ;
if ( tableName . Equals ( Constants . DatabaseSchema . Tables . Lock ) )
CreateLockData ( ) ;
if ( tableName . Equals ( Constants . DatabaseSchema . Tables . ContentType ) )
CreateContentTypeData ( ) ;
if ( tableName . Equals ( Constants . DatabaseSchema . Tables . User ) )
CreateUserData ( ) ;
if ( tableName . Equals ( Constants . DatabaseSchema . Tables . UserGroup ) )
CreateUserGroupData ( ) ;
if ( tableName . Equals ( Constants . DatabaseSchema . Tables . User2UserGroup ) )
CreateUser2UserGroupData ( ) ;
if ( tableName . Equals ( Constants . DatabaseSchema . Tables . UserGroup2App ) )
CreateUserGroup2AppData ( ) ;
if ( tableName . Equals ( Constants . DatabaseSchema . Tables . PropertyTypeGroup ) )
CreatePropertyTypeGroupData ( ) ;
if ( tableName . Equals ( Constants . DatabaseSchema . Tables . PropertyType ) )
CreatePropertyTypeData ( ) ;
if ( tableName . Equals ( Constants . DatabaseSchema . Tables . Language ) )
CreateLanguageData ( ) ;
if ( tableName . Equals ( Constants . DatabaseSchema . Tables . ContentChildType ) )
CreateContentChildTypeData ( ) ;
if ( tableName . Equals ( Constants . DatabaseSchema . Tables . DataType ) )
CreateDataTypeData ( ) ;
if ( tableName . Equals ( Constants . DatabaseSchema . Tables . RelationType ) )
CreateRelationTypeData ( ) ;
2019-02-06 08:07:50 +01:00
2018-03-21 11:32:07 +01:00
if ( tableName . Equals ( Constants . DatabaseSchema . Tables . KeyValue ) )
CreateKeyValueData ( ) ;
2018-08-14 15:08:32 +01:00
_logger . Info < DatabaseDataCreator > ( "Done creating table {TableName} data." , tableName ) ;
2017-12-18 18:26:32 +01:00
}
private void CreateNodeData ( )
{
2018-06-03 13:30:50 +02:00
void InsertDataTypeNodeDto ( int id , int sortOrder , string uniqueId , string text )
{
var nodeDto = new NodeDto
{
NodeId = id ,
Trashed = false ,
ParentId = - 1 ,
UserId = - 1 ,
Level = 1 ,
2018-06-18 21:40:06 +10:00
Path = "-1," + id ,
2018-06-03 13:30:50 +02:00
SortOrder = sortOrder ,
UniqueId = new Guid ( uniqueId ) ,
Text = text ,
NodeObjectType = Constants . ObjectTypes . DataType ,
CreateDate = DateTime . Now
} ;
_database . Insert ( Constants . DatabaseSchema . Tables . Node , "id" , false , nodeDto ) ;
}
2018-05-31 16:52:38 +10:00
_database . Insert ( Constants . DatabaseSchema . Tables . Node , "id" , false , new NodeDto { NodeId = - 1 , Trashed = false , ParentId = - 1 , UserId = - 1 , Level = 0 , Path = "-1" , SortOrder = 0 , UniqueId = new Guid ( "916724a5-173d-4619-b97e-b9de133dd6f5" ) , Text = "SYSTEM DATA: umbraco master root" , NodeObjectType = Constants . ObjectTypes . SystemRoot , CreateDate = DateTime . Now } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . Node , "id" , false , new NodeDto { NodeId = - 20 , Trashed = false , ParentId = - 1 , UserId = - 1 , Level = 0 , Path = "-1,-20" , SortOrder = 0 , UniqueId = new Guid ( "0F582A79-1E41-4CF0-BFA0-76340651891A" ) , Text = "Recycle Bin" , NodeObjectType = Constants . ObjectTypes . ContentRecycleBin , CreateDate = DateTime . Now } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . Node , "id" , false , new NodeDto { NodeId = - 21 , Trashed = false , ParentId = - 1 , UserId = - 1 , Level = 0 , Path = "-1,-21" , SortOrder = 0 , UniqueId = new Guid ( "BF7C7CBC-952F-4518-97A2-69E9C7B33842" ) , Text = "Recycle Bin" , NodeObjectType = Constants . ObjectTypes . MediaRecycleBin , CreateDate = DateTime . Now } ) ;
2019-07-02 10:49:20 +10:00
InsertDataTypeNodeDto ( Constants . DataTypes . LabelString , 35 , Constants . DataTypes . Guids . LabelString , "Label (string)" ) ;
2019-06-28 15:03:52 +10:00
InsertDataTypeNodeDto ( Constants . DataTypes . LabelInt , 36 , Constants . DataTypes . Guids . LabelInt , "Label (integer)" ) ;
InsertDataTypeNodeDto ( Constants . DataTypes . LabelBigint , 36 , Constants . DataTypes . Guids . LabelBigInt , "Label (bigint)" ) ;
InsertDataTypeNodeDto ( Constants . DataTypes . LabelDateTime , 37 , Constants . DataTypes . Guids . LabelDateTime , "Label (datetime)" ) ;
InsertDataTypeNodeDto ( Constants . DataTypes . LabelTime , 38 , Constants . DataTypes . Guids . LabelTime , "Label (time)" ) ;
InsertDataTypeNodeDto ( Constants . DataTypes . LabelDecimal , 39 , Constants . DataTypes . Guids . LabelDecimal , "Label (decimal)" ) ;
2019-07-02 10:49:20 +10:00
_database . Insert ( Constants . DatabaseSchema . Tables . Node , "id" , false , new NodeDto { NodeId = Constants . DataTypes . Upload , Trashed = false , ParentId = - 1 , UserId = - 1 , Level = 1 , Path = $"-1,{Constants.DataTypes.Upload}" , SortOrder = 34 , UniqueId = Constants . DataTypes . Guids . UploadGuid , Text = "Upload" , NodeObjectType = Constants . ObjectTypes . DataType , CreateDate = DateTime . Now } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . Node , "id" , false , new NodeDto { NodeId = Constants . DataTypes . Textarea , Trashed = false , ParentId = - 1 , UserId = - 1 , Level = 1 , Path = $"-1,{Constants.DataTypes.Textarea}" , SortOrder = 33 , UniqueId = Constants . DataTypes . Guids . TextareaGuid , Text = "Textarea" , NodeObjectType = Constants . ObjectTypes . DataType , CreateDate = DateTime . Now } ) ;
2019-07-02 11:07:59 +10:00
_database . Insert ( Constants . DatabaseSchema . Tables . Node , "id" , false , new NodeDto { NodeId = Constants . DataTypes . Textbox , Trashed = false , ParentId = - 1 , UserId = - 1 , Level = 1 , Path = $"-1,{Constants.DataTypes.Textbox}" , SortOrder = 32 , UniqueId = Constants . DataTypes . Guids . TextstringGuid , Text = "Textstring" , NodeObjectType = Constants . ObjectTypes . DataType , CreateDate = DateTime . Now } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . Node , "id" , false , new NodeDto { NodeId = Constants . DataTypes . RichtextEditor , Trashed = false , ParentId = - 1 , UserId = - 1 , Level = 1 , Path = $"-1,{Constants.DataTypes.RichtextEditor}" , SortOrder = 4 , UniqueId = Constants . DataTypes . Guids . RichtextEditorGuid , Text = "Richtext editor" , NodeObjectType = Constants . ObjectTypes . DataType , CreateDate = DateTime . Now } ) ;
2019-06-28 15:03:52 +10:00
_database . Insert ( Constants . DatabaseSchema . Tables . Node , "id" , false , new NodeDto { NodeId = - 51 , Trashed = false , ParentId = - 1 , UserId = - 1 , Level = 1 , Path = "-1,-51" , SortOrder = 2 , UniqueId = Constants . DataTypes . Guids . NumericGuid , Text = "Numeric" , NodeObjectType = Constants . ObjectTypes . DataType , CreateDate = DateTime . Now } ) ;
2019-07-02 10:49:20 +10:00
_database . Insert ( Constants . DatabaseSchema . Tables . Node , "id" , false , new NodeDto { NodeId = Constants . DataTypes . Boolean , Trashed = false , ParentId = - 1 , UserId = - 1 , Level = 1 , Path = $"-1,{Constants.DataTypes.Boolean}" , SortOrder = 2 , UniqueId = Constants . DataTypes . Guids . CheckboxGuid , Text = "True/false" , NodeObjectType = Constants . ObjectTypes . DataType , CreateDate = DateTime . Now } ) ;
2019-06-28 15:03:52 +10:00
_database . Insert ( Constants . DatabaseSchema . Tables . Node , "id" , false , new NodeDto { NodeId = - 43 , Trashed = false , ParentId = - 1 , UserId = - 1 , Level = 1 , Path = "-1,-43" , SortOrder = 2 , UniqueId = Constants . DataTypes . Guids . CheckboxListGuid , Text = "Checkbox list" , NodeObjectType = Constants . ObjectTypes . DataType , CreateDate = DateTime . Now } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . Node , "id" , false , new NodeDto { NodeId = Constants . DataTypes . DropDownSingle , Trashed = false , ParentId = - 1 , UserId = - 1 , Level = 1 , Path = $"-1,{Constants.DataTypes.DropDownSingle}" , SortOrder = 2 , UniqueId = Constants . DataTypes . Guids . DropdownGuid , Text = "Dropdown" , NodeObjectType = Constants . ObjectTypes . DataType , CreateDate = DateTime . Now } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . Node , "id" , false , new NodeDto { NodeId = - 41 , Trashed = false , ParentId = - 1 , UserId = - 1 , Level = 1 , Path = "-1,-41" , SortOrder = 2 , UniqueId = Constants . DataTypes . Guids . DatePickerGuid , Text = "Date Picker" , NodeObjectType = Constants . ObjectTypes . DataType , CreateDate = DateTime . Now } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . Node , "id" , false , new NodeDto { NodeId = - 40 , Trashed = false , ParentId = - 1 , UserId = - 1 , Level = 1 , Path = "-1,-40" , SortOrder = 2 , UniqueId = Constants . DataTypes . Guids . RadioboxGuid , Text = "Radiobox" , NodeObjectType = Constants . ObjectTypes . DataType , CreateDate = DateTime . Now } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . Node , "id" , false , new NodeDto { NodeId = Constants . DataTypes . DropDownMultiple , Trashed = false , ParentId = - 1 , UserId = - 1 , Level = 1 , Path = $"-1,{Constants.DataTypes.DropDownMultiple}" , SortOrder = 2 , UniqueId = Constants . DataTypes . Guids . DropdownMultipleGuid , Text = "Dropdown multiple" , NodeObjectType = Constants . ObjectTypes . DataType , CreateDate = DateTime . Now } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . Node , "id" , false , new NodeDto { NodeId = - 37 , Trashed = false , ParentId = - 1 , UserId = - 1 , Level = 1 , Path = "-1,-37" , SortOrder = 2 , UniqueId = Constants . DataTypes . Guids . ApprovedColorGuid , Text = "Approved Color" , NodeObjectType = Constants . ObjectTypes . DataType , CreateDate = DateTime . Now } ) ;
2019-07-02 10:49:20 +10:00
_database . Insert ( Constants . DatabaseSchema . Tables . Node , "id" , false , new NodeDto { NodeId = Constants . DataTypes . DateTime , Trashed = false , ParentId = - 1 , UserId = - 1 , Level = 1 , Path = $"-1,{Constants.DataTypes.DateTime}" , SortOrder = 2 , UniqueId = Constants . DataTypes . Guids . DatePickerWithTimeGuid , Text = "Date Picker with time" , NodeObjectType = Constants . ObjectTypes . DataType , CreateDate = DateTime . Now } ) ;
2019-06-28 15:03:52 +10:00
_database . Insert ( Constants . DatabaseSchema . Tables . Node , "id" , false , new NodeDto { NodeId = Constants . DataTypes . DefaultContentListView , Trashed = false , ParentId = - 1 , UserId = - 1 , Level = 1 , Path = $"-1,{Constants.DataTypes.DefaultContentListView}" , SortOrder = 2 , UniqueId = Constants . DataTypes . Guids . ListViewContentGuid , Text = Constants . Conventions . DataTypes . ListViewPrefix + "Content" , NodeObjectType = Constants . ObjectTypes . DataType , CreateDate = DateTime . Now } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . Node , "id" , false , new NodeDto { NodeId = Constants . DataTypes . DefaultMediaListView , Trashed = false , ParentId = - 1 , UserId = - 1 , Level = 1 , Path = $"-1,{Constants.DataTypes.DefaultMediaListView}" , SortOrder = 2 , UniqueId = Constants . DataTypes . Guids . ListViewMediaGuid , Text = Constants . Conventions . DataTypes . ListViewPrefix + "Media" , NodeObjectType = Constants . ObjectTypes . DataType , CreateDate = DateTime . Now } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . Node , "id" , false , new NodeDto { NodeId = Constants . DataTypes . DefaultMembersListView , Trashed = false , ParentId = - 1 , UserId = - 1 , Level = 1 , Path = $"-1,{Constants.DataTypes.DefaultMembersListView}" , SortOrder = 2 , UniqueId = Constants . DataTypes . Guids . ListViewMembersGuid , Text = Constants . Conventions . DataTypes . ListViewPrefix + "Members" , NodeObjectType = Constants . ObjectTypes . DataType , CreateDate = DateTime . Now } ) ;
2018-05-31 16:52:38 +10:00
_database . Insert ( Constants . DatabaseSchema . Tables . Node , "id" , false , new NodeDto { NodeId = 1031 , Trashed = false , ParentId = - 1 , UserId = - 1 , Level = 1 , Path = "-1,1031" , SortOrder = 2 , UniqueId = new Guid ( "f38bd2d7-65d0-48e6-95dc-87ce06ec2d3d" ) , Text = Constants . Conventions . MediaTypes . Folder , NodeObjectType = Constants . ObjectTypes . MediaType , CreateDate = DateTime . Now } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . Node , "id" , false , new NodeDto { NodeId = 1032 , Trashed = false , ParentId = - 1 , UserId = - 1 , Level = 1 , Path = "-1,1032" , SortOrder = 2 , UniqueId = new Guid ( "cc07b313-0843-4aa8-bbda-871c8da728c8" ) , Text = Constants . Conventions . MediaTypes . Image , NodeObjectType = Constants . ObjectTypes . MediaType , CreateDate = DateTime . Now } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . Node , "id" , false , new NodeDto { NodeId = 1033 , Trashed = false , ParentId = - 1 , UserId = - 1 , Level = 1 , Path = "-1,1033" , SortOrder = 2 , UniqueId = new Guid ( "4c52d8ab-54e6-40cd-999c-7a5f24903e4d" ) , Text = Constants . Conventions . MediaTypes . File , NodeObjectType = Constants . ObjectTypes . MediaType , CreateDate = DateTime . Now } ) ;
2019-06-27 21:33:19 +01:00
_database . Insert ( Constants . DatabaseSchema . Tables . Node , "id" , false , new NodeDto { NodeId = Constants . DataTypes . Tags , Trashed = false , ParentId = - 1 , UserId = - 1 , Level = 1 , Path = $"-1,{Constants.DataTypes.Tags}" , SortOrder = 2 , UniqueId = new Guid ( "b6b73142-b9c1-4bf8-a16d-e1c23320b549" ) , Text = "Tags" , NodeObjectType = Constants . ObjectTypes . DataType , CreateDate = DateTime . Now } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . Node , "id" , false , new NodeDto { NodeId = Constants . DataTypes . ImageCropper , Trashed = false , ParentId = - 1 , UserId = - 1 , Level = 1 , Path = $"-1,{Constants.DataTypes.ImageCropper}" , SortOrder = 2 , UniqueId = new Guid ( "1df9f033-e6d4-451f-b8d2-e0cbc50a836f" ) , Text = "Image Cropper" , NodeObjectType = Constants . ObjectTypes . DataType , CreateDate = DateTime . Now } ) ;
2018-05-31 16:52:38 +10:00
_database . Insert ( Constants . DatabaseSchema . Tables . Node , "id" , false , new NodeDto { NodeId = 1044 , Trashed = false , ParentId = - 1 , UserId = - 1 , Level = 1 , Path = "-1,1044" , SortOrder = 0 , UniqueId = new Guid ( "d59be02f-1df9-4228-aa1e-01917d806cda" ) , Text = Constants . Conventions . MemberTypes . DefaultAlias , NodeObjectType = Constants . ObjectTypes . MemberType , CreateDate = DateTime . Now } ) ;
2017-12-18 18:26:32 +01:00
//New UDI pickers with newer Ids
2018-05-31 16:52:38 +10:00
_database . Insert ( Constants . DatabaseSchema . Tables . Node , "id" , false , new NodeDto { NodeId = 1046 , Trashed = false , ParentId = - 1 , UserId = - 1 , Level = 1 , Path = "-1,1046" , SortOrder = 2 , UniqueId = new Guid ( "FD1E0DA5-5606-4862-B679-5D0CF3A52A59" ) , Text = "Content Picker" , NodeObjectType = Constants . ObjectTypes . DataType , CreateDate = DateTime . Now } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . Node , "id" , false , new NodeDto { NodeId = 1047 , Trashed = false , ParentId = - 1 , UserId = - 1 , Level = 1 , Path = "-1,1047" , SortOrder = 2 , UniqueId = new Guid ( "1EA2E01F-EBD8-4CE1-8D71-6B1149E63548" ) , Text = "Member Picker" , NodeObjectType = Constants . ObjectTypes . DataType , CreateDate = DateTime . Now } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . Node , "id" , false , new NodeDto { NodeId = 1048 , Trashed = false , ParentId = - 1 , UserId = - 1 , Level = 1 , Path = "-1,1048" , SortOrder = 2 , UniqueId = new Guid ( "135D60E0-64D9-49ED-AB08-893C9BA44AE5" ) , Text = "Media Picker" , NodeObjectType = Constants . ObjectTypes . DataType , CreateDate = DateTime . Now } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . Node , "id" , false , new NodeDto { NodeId = 1049 , Trashed = false , ParentId = - 1 , UserId = - 1 , Level = 1 , Path = "-1,1049" , SortOrder = 2 , UniqueId = new Guid ( "9DBBCBBB-2327-434A-B355-AF1B84E5010A" ) , Text = "Multiple Media Picker" , NodeObjectType = Constants . ObjectTypes . DataType , CreateDate = DateTime . Now } ) ;
2019-01-23 08:56:20 +01:00
_database . Insert ( Constants . DatabaseSchema . Tables . Node , "id" , false , new NodeDto { NodeId = 1050 , Trashed = false , ParentId = - 1 , UserId = - 1 , Level = 1 , Path = "-1,1050" , SortOrder = 2 , UniqueId = new Guid ( "B4E3535A-1753-47E2-8568-602CF8CFEE6F" ) , Text = "Multi URL Picker" , NodeObjectType = Constants . ObjectTypes . DataType , CreateDate = DateTime . Now } ) ;
2017-12-18 18:26:32 +01:00
}
private void CreateLockData ( )
{
// all lock objects
_database . Insert ( Constants . DatabaseSchema . Tables . Lock , "id" , false , new LockDto { Id = Constants . Locks . Servers , Name = "Servers" } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . Lock , "id" , false , new LockDto { Id = Constants . Locks . ContentTypes , Name = "ContentTypes" } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . Lock , "id" , false , new LockDto { Id = Constants . Locks . ContentTree , Name = "ContentTree" } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . Lock , "id" , false , new LockDto { Id = Constants . Locks . MediaTypes , Name = "MediaTypes" } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . Lock , "id" , false , new LockDto { Id = Constants . Locks . MediaTree , Name = "MediaTree" } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . Lock , "id" , false , new LockDto { Id = Constants . Locks . MemberTypes , Name = "MemberTypes" } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . Lock , "id" , false , new LockDto { Id = Constants . Locks . MemberTree , Name = "MemberTree" } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . Lock , "id" , false , new LockDto { Id = Constants . Locks . Domains , Name = "Domains" } ) ;
2018-10-17 13:58:18 +02:00
_database . Insert ( Constants . DatabaseSchema . Tables . Lock , "id" , false , new LockDto { Id = Constants . Locks . KeyValues , Name = "KeyValues" } ) ;
2018-09-17 12:36:45 +02:00
_database . Insert ( Constants . DatabaseSchema . Tables . Lock , "id" , false , new LockDto { Id = Constants . Locks . Languages , Name = "Languages" } ) ;
2017-12-18 18:26:32 +01:00
}
private void CreateContentTypeData ( )
{
2019-06-07 17:02:55 +01:00
_database . Insert ( Constants . DatabaseSchema . Tables . ContentType , "pk" , false , new ContentTypeDto { PrimaryKey = 532 , NodeId = 1031 , Alias = Constants . Conventions . MediaTypes . Folder , Icon = Constants . Icons . MediaFolder , Thumbnail = Constants . Icons . MediaFolder , IsContainer = false , AllowAtRoot = true , Variations = ( byte ) ContentVariation . Nothing } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . ContentType , "pk" , false , new ContentTypeDto { PrimaryKey = 533 , NodeId = 1032 , Alias = Constants . Conventions . MediaTypes . Image , Icon = Constants . Icons . MediaImage , Thumbnail = Constants . Icons . MediaImage , AllowAtRoot = true , Variations = ( byte ) ContentVariation . Nothing } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . ContentType , "pk" , false , new ContentTypeDto { PrimaryKey = 534 , NodeId = 1033 , Alias = Constants . Conventions . MediaTypes . File , Icon = Constants . Icons . MediaFile , Thumbnail = Constants . Icons . MediaFile , AllowAtRoot = true , Variations = ( byte ) ContentVariation . Nothing } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . ContentType , "pk" , false , new ContentTypeDto { PrimaryKey = 531 , NodeId = 1044 , Alias = Constants . Conventions . MemberTypes . DefaultAlias , Icon = Constants . Icons . Member , Thumbnail = Constants . Icons . Member , Variations = ( byte ) ContentVariation . Nothing } ) ;
2017-12-18 18:26:32 +01:00
}
private void CreateUserData ( )
{
2018-05-31 23:05:35 +10:00
_database . Insert ( Constants . DatabaseSchema . Tables . User , "id" , false , new UserDto { Id = Constants . Security . SuperUserId , Disabled = false , NoConsole = false , UserName = "Administrator" , Login = "admin" , Password = "default" , Email = "" , UserLanguage = "en-US" , CreateDate = DateTime . Now , UpdateDate = DateTime . Now } ) ;
2017-12-18 18:26:32 +01:00
}
private void CreateUserGroupData ( )
{
_database . Insert ( Constants . DatabaseSchema . Tables . UserGroup , "id" , false , new UserGroupDto { Id = 1 , StartMediaId = - 1 , StartContentId = - 1 , Alias = Constants . Security . AdminGroupAlias , Name = "Administrators" , DefaultPermissions = "CADMOSKTPIURZ:5F7ï" , CreateDate = DateTime . Now , UpdateDate = DateTime . Now , Icon = "icon-medal" } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . UserGroup , "id" , false , new UserGroupDto { Id = 2 , StartMediaId = - 1 , StartContentId = - 1 , Alias = "writer" , Name = "Writers" , DefaultPermissions = "CAH:F" , CreateDate = DateTime . Now , UpdateDate = DateTime . Now , Icon = "icon-edit" } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . UserGroup , "id" , false , new UserGroupDto { Id = 3 , StartMediaId = - 1 , StartContentId = - 1 , Alias = "editor" , Name = "Editors" , DefaultPermissions = "CADMOSKTPUZ:5Fï" , CreateDate = DateTime . Now , UpdateDate = DateTime . Now , Icon = "icon-tools" } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . UserGroup , "id" , false , new UserGroupDto { Id = 4 , StartMediaId = - 1 , StartContentId = - 1 , Alias = Constants . Security . TranslatorGroupAlias , Name = "Translators" , DefaultPermissions = "AF" , CreateDate = DateTime . Now , UpdateDate = DateTime . Now , Icon = "icon-globe" } ) ;
2018-03-21 14:40:59 +01:00
_database . Insert ( Constants . DatabaseSchema . Tables . UserGroup , "id" , false , new UserGroupDto { Id = 5 , StartMediaId = - 1 , StartContentId = - 1 , Alias = Constants . Security . SensitiveDataGroupAlias , Name = "Sensitive data" , DefaultPermissions = "" , CreateDate = DateTime . Now , UpdateDate = DateTime . Now , Icon = "icon-lock" } ) ;
2017-12-18 18:26:32 +01:00
}
private void CreateUser2UserGroupData ( )
{
2018-05-31 23:05:35 +10:00
_database . Insert ( new User2UserGroupDto { UserGroupId = 1 , UserId = Constants . Security . SuperUserId } ) ; // add super to admins
_database . Insert ( new User2UserGroupDto { UserGroupId = 5 , UserId = Constants . Security . SuperUserId } ) ; // add super to sensitive data
2017-12-18 18:26:32 +01:00
}
private void CreateUserGroup2AppData ( )
{
_database . Insert ( new UserGroup2AppDto { UserGroupId = 1 , AppAlias = Constants . Applications . Content } ) ;
2018-10-05 11:09:33 +02:00
_database . Insert ( new UserGroup2AppDto { UserGroupId = 1 , AppAlias = Constants . Applications . Packages } ) ;
2017-12-18 18:26:32 +01:00
_database . Insert ( new UserGroup2AppDto { UserGroupId = 1 , AppAlias = Constants . Applications . Media } ) ;
_database . Insert ( new UserGroup2AppDto { UserGroupId = 1 , AppAlias = Constants . Applications . Members } ) ;
_database . Insert ( new UserGroup2AppDto { UserGroupId = 1 , AppAlias = Constants . Applications . Settings } ) ;
_database . Insert ( new UserGroup2AppDto { UserGroupId = 1 , AppAlias = Constants . Applications . Users } ) ;
_database . Insert ( new UserGroup2AppDto { UserGroupId = 1 , AppAlias = Constants . Applications . Forms } ) ;
_database . Insert ( new UserGroup2AppDto { UserGroupId = 2 , AppAlias = Constants . Applications . Content } ) ;
_database . Insert ( new UserGroup2AppDto { UserGroupId = 3 , AppAlias = Constants . Applications . Content } ) ;
_database . Insert ( new UserGroup2AppDto { UserGroupId = 3 , AppAlias = Constants . Applications . Media } ) ;
_database . Insert ( new UserGroup2AppDto { UserGroupId = 3 , AppAlias = Constants . Applications . Forms } ) ;
_database . Insert ( new UserGroup2AppDto { UserGroupId = 4 , AppAlias = Constants . Applications . Translation } ) ;
}
private void CreatePropertyTypeGroupData ( )
{
_database . Insert ( Constants . DatabaseSchema . Tables . PropertyTypeGroup , "id" , false , new PropertyTypeGroupDto { Id = 3 , ContentTypeNodeId = 1032 , Text = "Image" , SortOrder = 1 , UniqueId = new Guid ( Constants . PropertyTypeGroups . Image ) } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . PropertyTypeGroup , "id" , false , new PropertyTypeGroupDto { Id = 4 , ContentTypeNodeId = 1033 , Text = "File" , SortOrder = 1 , UniqueId = new Guid ( Constants . PropertyTypeGroups . File ) } ) ;
//membership property group
_database . Insert ( Constants . DatabaseSchema . Tables . PropertyTypeGroup , "id" , false , new PropertyTypeGroupDto { Id = 11 , ContentTypeNodeId = 1044 , Text = "Membership" , SortOrder = 1 , UniqueId = new Guid ( Constants . PropertyTypeGroups . Membership ) } ) ;
}
private void CreatePropertyTypeData ( )
{
2019-06-27 21:33:19 +01:00
_database . Insert ( Constants . DatabaseSchema . Tables . PropertyType , "id" , false , new PropertyTypeDto { Id = 6 , UniqueId = 6. ToGuid ( ) , DataTypeId = Constants . DataTypes . ImageCropper , ContentTypeId = 1032 , PropertyTypeGroupId = 3 , Alias = Constants . Conventions . Media . File , Name = "Upload image" , SortOrder = 0 , Mandatory = true , ValidationRegExp = null , Description = null , Variations = ( byte ) ContentVariation . Nothing } ) ;
2019-02-01 14:32:17 +01:00
_database . Insert ( Constants . DatabaseSchema . Tables . PropertyType , "id" , false , new PropertyTypeDto { Id = 7 , UniqueId = 7. ToGuid ( ) , DataTypeId = Constants . DataTypes . LabelInt , ContentTypeId = 1032 , PropertyTypeGroupId = 3 , Alias = Constants . Conventions . Media . Width , Name = "Width" , SortOrder = 0 , Mandatory = false , ValidationRegExp = null , Description = "in pixels" , Variations = ( byte ) ContentVariation . Nothing } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . PropertyType , "id" , false , new PropertyTypeDto { Id = 8 , UniqueId = 8. ToGuid ( ) , DataTypeId = Constants . DataTypes . LabelInt , ContentTypeId = 1032 , PropertyTypeGroupId = 3 , Alias = Constants . Conventions . Media . Height , Name = "Height" , SortOrder = 0 , Mandatory = false , ValidationRegExp = null , Description = "in pixels" , Variations = ( byte ) ContentVariation . Nothing } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . PropertyType , "id" , false , new PropertyTypeDto { Id = 9 , UniqueId = 9. ToGuid ( ) , DataTypeId = Constants . DataTypes . LabelBigint , ContentTypeId = 1032 , PropertyTypeGroupId = 3 , Alias = Constants . Conventions . Media . Bytes , Name = "Size" , SortOrder = 0 , Mandatory = false , ValidationRegExp = null , Description = "in bytes" , Variations = ( byte ) ContentVariation . Nothing } ) ;
2018-06-20 14:18:57 +02:00
_database . Insert ( Constants . DatabaseSchema . Tables . PropertyType , "id" , false , new PropertyTypeDto { Id = 10 , UniqueId = 10. ToGuid ( ) , DataTypeId = - 92 , ContentTypeId = 1032 , PropertyTypeGroupId = 3 , Alias = Constants . Conventions . Media . Extension , Name = "Type" , SortOrder = 0 , Mandatory = false , ValidationRegExp = null , Description = null , Variations = ( byte ) ContentVariation . Nothing } ) ;
2019-06-27 21:33:19 +01:00
_database . Insert ( Constants . DatabaseSchema . Tables . PropertyType , "id" , false , new PropertyTypeDto { Id = 24 , UniqueId = 24. ToGuid ( ) , DataTypeId = Constants . DataTypes . Upload , ContentTypeId = 1033 , PropertyTypeGroupId = 4 , Alias = Constants . Conventions . Media . File , Name = "Upload file" , SortOrder = 0 , Mandatory = true , ValidationRegExp = null , Description = null , Variations = ( byte ) ContentVariation . Nothing } ) ;
2018-06-20 14:18:57 +02:00
_database . Insert ( Constants . DatabaseSchema . Tables . PropertyType , "id" , false , new PropertyTypeDto { Id = 25 , UniqueId = 25. ToGuid ( ) , DataTypeId = - 92 , ContentTypeId = 1033 , PropertyTypeGroupId = 4 , Alias = Constants . Conventions . Media . Extension , Name = "Type" , SortOrder = 0 , Mandatory = false , ValidationRegExp = null , Description = null , Variations = ( byte ) ContentVariation . Nothing } ) ;
2019-02-01 14:32:17 +01:00
_database . Insert ( Constants . DatabaseSchema . Tables . PropertyType , "id" , false , new PropertyTypeDto { Id = 26 , UniqueId = 26. ToGuid ( ) , DataTypeId = Constants . DataTypes . LabelBigint , ContentTypeId = 1033 , PropertyTypeGroupId = 4 , Alias = Constants . Conventions . Media . Bytes , Name = "Size" , SortOrder = 0 , Mandatory = false , ValidationRegExp = null , Description = "in bytes" , Variations = ( byte ) ContentVariation . Nothing } ) ;
2017-12-18 18:26:32 +01:00
//membership property types
2019-06-27 21:33:19 +01:00
_database . Insert ( Constants . DatabaseSchema . Tables . PropertyType , "id" , false , new PropertyTypeDto { Id = 28 , UniqueId = 28. ToGuid ( ) , DataTypeId = Constants . DataTypes . Textarea , ContentTypeId = 1044 , PropertyTypeGroupId = 11 , Alias = Constants . Conventions . Member . Comments , Name = Constants . Conventions . Member . CommentsLabel , SortOrder = 0 , Mandatory = false , ValidationRegExp = null , Description = null , Variations = ( byte ) ContentVariation . Nothing } ) ;
2018-06-20 14:18:57 +02:00
_database . Insert ( Constants . DatabaseSchema . Tables . PropertyType , "id" , false , new PropertyTypeDto { Id = 29 , UniqueId = 29. ToGuid ( ) , DataTypeId = Constants . DataTypes . LabelInt , ContentTypeId = 1044 , PropertyTypeGroupId = 11 , Alias = Constants . Conventions . Member . FailedPasswordAttempts , Name = Constants . Conventions . Member . FailedPasswordAttemptsLabel , SortOrder = 1 , Mandatory = false , ValidationRegExp = null , Description = null , Variations = ( byte ) ContentVariation . Nothing } ) ;
2019-06-27 21:33:19 +01:00
_database . Insert ( Constants . DatabaseSchema . Tables . PropertyType , "id" , false , new PropertyTypeDto { Id = 30 , UniqueId = 30. ToGuid ( ) , DataTypeId = Constants . DataTypes . Boolean , ContentTypeId = 1044 , PropertyTypeGroupId = 11 , Alias = Constants . Conventions . Member . IsApproved , Name = Constants . Conventions . Member . IsApprovedLabel , SortOrder = 2 , Mandatory = false , ValidationRegExp = null , Description = null , Variations = ( byte ) ContentVariation . Nothing } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . PropertyType , "id" , false , new PropertyTypeDto { Id = 31 , UniqueId = 31. ToGuid ( ) , DataTypeId = Constants . DataTypes . Boolean , ContentTypeId = 1044 , PropertyTypeGroupId = 11 , Alias = Constants . Conventions . Member . IsLockedOut , Name = Constants . Conventions . Member . IsLockedOutLabel , SortOrder = 3 , Mandatory = false , ValidationRegExp = null , Description = null , Variations = ( byte ) ContentVariation . Nothing } ) ;
2018-06-20 14:18:57 +02:00
_database . Insert ( Constants . DatabaseSchema . Tables . PropertyType , "id" , false , new PropertyTypeDto { Id = 32 , UniqueId = 32. ToGuid ( ) , DataTypeId = Constants . DataTypes . LabelDateTime , ContentTypeId = 1044 , PropertyTypeGroupId = 11 , Alias = Constants . Conventions . Member . LastLockoutDate , Name = Constants . Conventions . Member . LastLockoutDateLabel , SortOrder = 4 , Mandatory = false , ValidationRegExp = null , Description = null , Variations = ( byte ) ContentVariation . Nothing } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . PropertyType , "id" , false , new PropertyTypeDto { Id = 33 , UniqueId = 33. ToGuid ( ) , DataTypeId = Constants . DataTypes . LabelDateTime , ContentTypeId = 1044 , PropertyTypeGroupId = 11 , Alias = Constants . Conventions . Member . LastLoginDate , Name = Constants . Conventions . Member . LastLoginDateLabel , SortOrder = 5 , Mandatory = false , ValidationRegExp = null , Description = null , Variations = ( byte ) ContentVariation . Nothing } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . PropertyType , "id" , false , new PropertyTypeDto { Id = 34 , UniqueId = 34. ToGuid ( ) , DataTypeId = Constants . DataTypes . LabelDateTime , ContentTypeId = 1044 , PropertyTypeGroupId = 11 , Alias = Constants . Conventions . Member . LastPasswordChangeDate , Name = Constants . Conventions . Member . LastPasswordChangeDateLabel , SortOrder = 6 , Mandatory = false , ValidationRegExp = null , Description = null , Variations = ( byte ) ContentVariation . Nothing } ) ;
2019-04-17 16:42:17 +10:00
_database . Insert ( Constants . DatabaseSchema . Tables . PropertyType , "id" , false , new PropertyTypeDto { Id = 35 , UniqueId = 35. ToGuid ( ) , DataTypeId = Constants . DataTypes . LabelDateTime , ContentTypeId = 1044 , PropertyTypeGroupId = null , Alias = Constants . Conventions . Member . PasswordQuestion , Name = Constants . Conventions . Member . PasswordQuestionLabel , SortOrder = 7 , Mandatory = false , ValidationRegExp = null , Description = null , Variations = ( byte ) ContentVariation . Nothing } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . PropertyType , "id" , false , new PropertyTypeDto { Id = 36 , UniqueId = 36. ToGuid ( ) , DataTypeId = Constants . DataTypes . LabelDateTime , ContentTypeId = 1044 , PropertyTypeGroupId = null , Alias = Constants . Conventions . Member . PasswordAnswer , Name = Constants . Conventions . Member . PasswordAnswerLabel , SortOrder = 8 , Mandatory = false , ValidationRegExp = null , Description = null , Variations = ( byte ) ContentVariation . Nothing } ) ;
2017-12-18 18:26:32 +01:00
}
private void CreateLanguageData ( )
{
2018-09-13 14:59:45 +02:00
_database . Insert ( Constants . DatabaseSchema . Tables . Language , "id" , false , new LanguageDto { Id = 1 , IsoCode = "en-US" , CultureName = "English (United States)" , IsDefault = true } ) ;
2017-12-18 18:26:32 +01:00
}
private void CreateContentChildTypeData ( )
{
_database . Insert ( Constants . DatabaseSchema . Tables . ContentChildType , "Id" , false , new ContentTypeAllowedContentTypeDto { Id = 1031 , AllowedId = 1031 } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . ContentChildType , "Id" , false , new ContentTypeAllowedContentTypeDto { Id = 1031 , AllowedId = 1032 } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . ContentChildType , "Id" , false , new ContentTypeAllowedContentTypeDto { Id = 1031 , AllowedId = 1033 } ) ;
}
private void CreateDataTypeData ( )
{
2018-10-23 22:10:27 +11:00
void InsertDataTypeDto ( int id , string editorAlias , string dbType , string configuration = null )
2018-06-03 13:30:50 +02:00
{
var dataTypeDto = new DataTypeDto
{
NodeId = id ,
2018-10-22 17:04:58 +11:00
EditorAlias = editorAlias ,
2018-06-03 13:30:50 +02:00
DbType = dbType
} ;
if ( configuration ! = null )
dataTypeDto . Configuration = configuration ;
_database . Insert ( Constants . DatabaseSchema . Tables . DataType , "pk" , false , dataTypeDto ) ;
}
2018-01-15 17:32:45 +01:00
//layouts for the list view
const string cardLayout = "{\"name\": \"Grid\",\"path\": \"views/propertyeditors/listview/layouts/grid/grid.html\", \"icon\": \"icon-thumbnails-small\", \"isSystem\": 1, \"selected\": true}" ;
const string listLayout = "{\"name\": \"List\",\"path\": \"views/propertyeditors/listview/layouts/list/list.html\",\"icon\": \"icon-list\", \"isSystem\": 1,\"selected\": true}" ;
const string layouts = "[" + cardLayout + "," + listLayout + "]" ;
2019-01-27 01:17:32 -05:00
// TODO: Check which of the DataTypeIds below doesn't exist in umbracoNode, which results in a foreign key constraint errors.
2019-06-27 21:33:19 +01:00
_database . Insert ( Constants . DatabaseSchema . Tables . DataType , "pk" , false , new DataTypeDto { NodeId = Constants . DataTypes . Boolean , EditorAlias = Constants . PropertyEditors . Aliases . Boolean , DbType = "Integer" } ) ;
2018-01-20 12:09:15 +01:00
_database . Insert ( Constants . DatabaseSchema . Tables . DataType , "pk" , false , new DataTypeDto { NodeId = - 51 , EditorAlias = Constants . PropertyEditors . Aliases . Integer , DbType = "Integer" } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . DataType , "pk" , false , new DataTypeDto { NodeId = - 87 , EditorAlias = Constants . PropertyEditors . Aliases . TinyMce , DbType = "Ntext" ,
2018-01-15 17:32:45 +01:00
Configuration = "{\"value\":\",code,undo,redo,cut,copy,mcepasteword,stylepicker,bold,italic,bullist,numlist,outdent,indent,mcelink,unlink,mceinsertanchor,mceimage,umbracomacro,mceinserttable,umbracoembed,mcecharmap,|1|1,2,3,|0|500,400|1049,|true|\"}" } ) ;
2019-07-02 11:07:59 +10:00
_database . Insert ( Constants . DatabaseSchema . Tables . DataType , "pk" , false , new DataTypeDto { NodeId = Constants . DataTypes . Textbox , EditorAlias = Constants . PropertyEditors . Aliases . TextBox , DbType = "Nvarchar" } ) ;
2019-06-27 21:33:19 +01:00
_database . Insert ( Constants . DatabaseSchema . Tables . DataType , "pk" , false , new DataTypeDto { NodeId = Constants . DataTypes . Textarea , EditorAlias = Constants . PropertyEditors . Aliases . TextArea , DbType = "Ntext" } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . DataType , "pk" , false , new DataTypeDto { NodeId = Constants . DataTypes . Upload , EditorAlias = Constants . PropertyEditors . Aliases . UploadField , DbType = "Nvarchar" } ) ;
2019-02-15 11:42:29 +01:00
InsertDataTypeDto ( Constants . DataTypes . LabelString , Constants . PropertyEditors . Aliases . Label , "Nvarchar" , "{\"umbracoDataValueType\":\"STRING\"}" ) ;
InsertDataTypeDto ( Constants . DataTypes . LabelInt , Constants . PropertyEditors . Aliases . Label , "Integer" , "{\"umbracoDataValueType\":\"INT\"}" ) ;
InsertDataTypeDto ( Constants . DataTypes . LabelBigint , Constants . PropertyEditors . Aliases . Label , "Nvarchar" , "{\"umbracoDataValueType\":\"BIGINT\"}" ) ;
InsertDataTypeDto ( Constants . DataTypes . LabelDateTime , Constants . PropertyEditors . Aliases . Label , "Date" , "{\"umbracoDataValueType\":\"DATETIME\"}" ) ;
InsertDataTypeDto ( Constants . DataTypes . LabelDecimal , Constants . PropertyEditors . Aliases . Label , "Decimal" , "{\"umbracoDataValueType\":\"DECIMAL\"}" ) ;
InsertDataTypeDto ( Constants . DataTypes . LabelTime , Constants . PropertyEditors . Aliases . Label , "Date" , "{\"umbracoDataValueType\":\"TIME\"}" ) ;
2019-06-27 21:33:19 +01:00
_database . Insert ( Constants . DatabaseSchema . Tables . DataType , "pk" , false , new DataTypeDto { NodeId = Constants . DataTypes . DateTime , EditorAlias = Constants . PropertyEditors . Aliases . DateTime , DbType = "Date" } ) ;
2018-01-20 12:09:15 +01:00
_database . Insert ( Constants . DatabaseSchema . Tables . DataType , "pk" , false , new DataTypeDto { NodeId = - 37 , EditorAlias = Constants . PropertyEditors . Aliases . ColorPicker , DbType = "Nvarchar" } ) ;
2018-10-22 17:04:58 +11:00
InsertDataTypeDto ( Constants . DataTypes . DropDownSingle , Constants . PropertyEditors . Aliases . DropDownListFlexible , "Nvarchar" , "{\"multiple\":false}" ) ;
2018-01-20 12:09:15 +01:00
_database . Insert ( Constants . DatabaseSchema . Tables . DataType , "pk" , false , new DataTypeDto { NodeId = - 40 , EditorAlias = Constants . PropertyEditors . Aliases . RadioButtonList , DbType = "Nvarchar" } ) ;
2019-02-18 16:06:32 +01:00
_database . Insert ( Constants . DatabaseSchema . Tables . DataType , "pk" , false , new DataTypeDto { NodeId = - 41 , EditorAlias = "Umbraco.DateTime" , DbType = "Date" , Configuration = "{\"format\":\"YYYY-MM-DD\"}" } ) ;
2018-10-22 17:04:58 +11:00
InsertDataTypeDto ( Constants . DataTypes . DropDownMultiple , Constants . PropertyEditors . Aliases . DropDownListFlexible , "Nvarchar" , "{\"multiple\":true}" ) ;
2018-01-20 12:09:15 +01:00
_database . Insert ( Constants . DatabaseSchema . Tables . DataType , "pk" , false , new DataTypeDto { NodeId = - 43 , EditorAlias = Constants . PropertyEditors . Aliases . CheckBoxList , DbType = "Nvarchar" } ) ;
2019-06-27 21:33:19 +01:00
_database . Insert ( Constants . DatabaseSchema . Tables . DataType , "pk" , false , new DataTypeDto { NodeId = Constants . DataTypes . Tags , EditorAlias = Constants . PropertyEditors . Aliases . Tags , DbType = "Ntext" ,
2018-07-30 23:23:01 +10:00
Configuration = "{\"group\":\"default\", \"storageType\":\"Json\"}"
} ) ;
2019-06-27 21:33:19 +01:00
_database . Insert ( Constants . DatabaseSchema . Tables . DataType , "pk" , false , new DataTypeDto { NodeId = Constants . DataTypes . ImageCropper , EditorAlias = Constants . PropertyEditors . Aliases . ImageCropper , DbType = "Ntext" } ) ;
2018-04-04 13:11:12 +10:00
_database . Insert ( Constants . DatabaseSchema . Tables . DataType , "pk" , false , new DataTypeDto { NodeId = Constants . DataTypes . DefaultContentListView , EditorAlias = Constants . PropertyEditors . Aliases . ListView , DbType = "Nvarchar" ,
Configuration = "{\"pageSize\":100, \"orderBy\":\"updateDate\", \"orderDirection\":\"desc\", \"layouts\":" + layouts + ", \"includeProperties\":[{\"alias\":\"updateDate\",\"header\":\"Last edited\",\"isSystem\":1},{\"alias\":\"owner\",\"header\":\"Updated by\",\"isSystem\":1}]}" } ) ;
2018-01-20 12:09:15 +01:00
_database . Insert ( Constants . DatabaseSchema . Tables . DataType , "pk" , false , new DataTypeDto { NodeId = Constants . DataTypes . DefaultMediaListView , EditorAlias = Constants . PropertyEditors . Aliases . ListView , DbType = "Nvarchar" ,
2018-01-15 17:32:45 +01:00
Configuration = "{\"pageSize\":100, \"orderBy\":\"updateDate\", \"orderDirection\":\"desc\", \"layouts\":" + layouts + ", \"includeProperties\":[{\"alias\":\"updateDate\",\"header\":\"Last edited\",\"isSystem\":1},{\"alias\":\"owner\",\"header\":\"Updated by\",\"isSystem\":1}]}" } ) ;
2018-01-20 12:09:15 +01:00
_database . Insert ( Constants . DatabaseSchema . Tables . DataType , "pk" , false , new DataTypeDto { NodeId = Constants . DataTypes . DefaultMembersListView , EditorAlias = Constants . PropertyEditors . Aliases . ListView , DbType = "Nvarchar" ,
2018-01-15 17:32:45 +01:00
Configuration = "{\"pageSize\":10, \"orderBy\":\"username\", \"orderDirection\":\"asc\", \"includeProperties\":[{\"alias\":\"username\",\"isSystem\":1},{\"alias\":\"email\",\"isSystem\":1},{\"alias\":\"updateDate\",\"header\":\"Last edited\",\"isSystem\":1}]}" } ) ;
2017-12-18 18:26:32 +01:00
//New UDI pickers with newer Ids
2018-03-19 18:39:34 +01:00
_database . Insert ( Constants . DatabaseSchema . Tables . DataType , "pk" , false , new DataTypeDto { NodeId = 1046 , EditorAlias = Constants . PropertyEditors . Aliases . ContentPicker , DbType = "Nvarchar" } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . DataType , "pk" , false , new DataTypeDto { NodeId = 1047 , EditorAlias = Constants . PropertyEditors . Aliases . MemberPicker , DbType = "Nvarchar" } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . DataType , "pk" , false , new DataTypeDto { NodeId = 1048 , EditorAlias = Constants . PropertyEditors . Aliases . MediaPicker , DbType = "Ntext" } ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . DataType , "pk" , false , new DataTypeDto { NodeId = 1049 , EditorAlias = Constants . PropertyEditors . Aliases . MediaPicker , DbType = "Ntext" ,
2018-01-15 17:32:45 +01:00
Configuration = "{\"multiPicker\":1}" } ) ;
2019-01-23 08:56:20 +01:00
_database . Insert ( Constants . DatabaseSchema . Tables . DataType , "pk" , false , new DataTypeDto { NodeId = 1050 , EditorAlias = Constants . PropertyEditors . Aliases . MultiUrlPicker , DbType = "Ntext" } ) ;
2017-12-18 18:26:32 +01:00
}
private void CreateRelationTypeData ( )
{
var relationType = new RelationTypeDto { Id = 1 , Alias = Constants . Conventions . RelationTypes . RelateDocumentOnCopyAlias , ChildObjectType = Constants . ObjectTypes . Document , ParentObjectType = Constants . ObjectTypes . Document , Dual = true , Name = Constants . Conventions . RelationTypes . RelateDocumentOnCopyName } ;
relationType . UniqueId = ( relationType . Alias + "____" + relationType . Name ) . ToGuid ( ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . RelationType , "id" , false , relationType ) ;
relationType = new RelationTypeDto { Id = 2 , Alias = Constants . Conventions . RelationTypes . RelateParentDocumentOnDeleteAlias , ChildObjectType = Constants . ObjectTypes . Document , ParentObjectType = Constants . ObjectTypes . Document , Dual = false , Name = Constants . Conventions . RelationTypes . RelateParentDocumentOnDeleteName } ;
relationType . UniqueId = ( relationType . Alias + "____" + relationType . Name ) . ToGuid ( ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . RelationType , "id" , false , relationType ) ;
2018-07-30 21:31:35 +10:00
relationType = new RelationTypeDto { Id = 3 , Alias = Constants . Conventions . RelationTypes . RelateParentMediaFolderOnDeleteAlias , ChildObjectType = Constants . ObjectTypes . Media , ParentObjectType = Constants . ObjectTypes . Media , Dual = false , Name = Constants . Conventions . RelationTypes . RelateParentMediaFolderOnDeleteName } ;
relationType . UniqueId = ( relationType . Alias + "____" + relationType . Name ) . ToGuid ( ) ;
_database . Insert ( Constants . DatabaseSchema . Tables . RelationType , "id" , false , relationType ) ;
2017-12-18 18:26:32 +01:00
}
2018-03-21 11:32:07 +01:00
private void CreateKeyValueData ( )
{
// on install, initialize the umbraco migration plan with the final state
2019-02-13 09:53:17 +01:00
var upgrader = new Upgrader ( new UmbracoPlan ( ) ) ;
2018-07-04 15:07:09 +02:00
var stateValueKey = upgrader . StateValueKey ;
var finalState = upgrader . Plan . FinalState ;
2018-03-21 11:32:07 +01:00
_database . Insert ( Constants . DatabaseSchema . Tables . KeyValue , "key" , false , new KeyValueDto { Key = stateValueKey , Value = finalState , Updated = DateTime . Now } ) ;
}
2017-12-18 18:26:32 +01:00
}
}