Ejemplo n.º 1
0
        // This code can be removed in a later version.
        public int UpdateFrom1()
        {
            SchemaBuilder.AlterIndexTable <UserPickerFieldIndex>(table => table
                                                                 .CreateIndex("IDX_UserPickerFieldIndex_DocumentId",
                                                                              "DocumentId",
                                                                              "ContentItemId",
                                                                              "ContentItemVersionId",
                                                                              "Published",
                                                                              "Latest")
                                                                 );

            SchemaBuilder.AlterIndexTable <UserPickerFieldIndex>(table => table
                                                                 .CreateIndex("IDX_UserPickerFieldIndex_DocumentId_ContentType",
                                                                              "DocumentId",
                                                                              "ContentType",
                                                                              "ContentPart",
                                                                              "ContentField",
                                                                              "Published",
                                                                              "Latest")
                                                                 );

            SchemaBuilder.AlterIndexTable <UserPickerFieldIndex>(table => table
                                                                 .CreateIndex("IDX_UserPickerFieldIndex_DocumentId_SelectedUserId",
                                                                              "DocumentId",
                                                                              "SelectedUserId",
                                                                              "Published",
                                                                              "Latest")
                                                                 );

            return(2);
        }
Ejemplo n.º 2
0
        // This code can be removed in a later version.
        public int UpdateFrom3()
        {
            SchemaBuilder.AlterIndexTable <UserIndex>(table => table
                                                      .AddColumn <bool>(nameof(UserIndex.IsEnabled), c => c.NotNull().WithDefault(true)));

            return(4);
        }
Ejemplo n.º 3
0
        public int Create()
        {
            SchemaBuilder.CreateMapIndexTable <ContentItemIndex>(table => table
                                                                 .Column <string>("ContentItemId", c => c.WithLength(26))
                                                                 .Column <string>("ContentItemVersionId", c => c.WithLength(26))
                                                                 .Column <bool>("Latest")
                                                                 .Column <bool>("Published")
                                                                 .Column <string>("ContentType", column => column.WithLength(ContentItemIndex.MaxContentTypeSize))
                                                                 .Column <DateTime>("ModifiedUtc", column => column.Nullable())
                                                                 .Column <DateTime>("PublishedUtc", column => column.Nullable())
                                                                 .Column <DateTime>("CreatedUtc", column => column.Nullable())
                                                                 .Column <string>("Owner", column => column.Nullable().WithLength(ContentItemIndex.MaxOwnerSize))
                                                                 .Column <string>("Author", column => column.Nullable().WithLength(ContentItemIndex.MaxAuthorSize))
                                                                 .Column <string>("DisplayText", column => column.Nullable().WithLength(ContentItemIndex.MaxDisplayTextSize))
                                                                 );

            SchemaBuilder.AlterIndexTable <ContentItemIndex>(table => table
                                                             .CreateIndex("IDX_ContentItemIndex_ContentItemId", "ContentItemId", "Latest", "Published", "CreatedUtc")
                                                             );

            SchemaBuilder.AlterIndexTable <ContentItemIndex>(table => table
                                                             .CreateIndex("IDX_ContentItemIndex_ContentItemVersionId", "ContentItemVersionId")
                                                             );

            SchemaBuilder.AlterIndexTable <ContentItemIndex>(table => table
                                                             .CreateIndex("IDX_ContentItemIndex_DisplayText", "DisplayText")
                                                             );

            return(3);
        }
Ejemplo n.º 4
0
        // This code can be removed in a later version.
        public int UpdateFrom3()
        {
            // This step has been updated to also add these new columns.
            SchemaBuilder.AlterIndexTable <TaxonomyIndex>(table => table
                                                          .AddColumn <bool>("Published", c => c.WithDefault(true))
                                                          );

            SchemaBuilder.AlterIndexTable <TaxonomyIndex>(table => table
                                                          .AddColumn <bool>("Latest", c => c.WithDefault(false))
                                                          );

            // So that the new indexes can be fully created.
            SchemaBuilder.AlterIndexTable <TaxonomyIndex>(table => table
                                                          .CreateIndex("IDX_TaxonomyIndex_DocumentId",
                                                                       "DocumentId",
                                                                       "TaxonomyContentItemId",
                                                                       "ContentItemId",
                                                                       "TermContentItemId",
                                                                       "Published",
                                                                       "Latest")
                                                          );

            SchemaBuilder.AlterIndexTable <TaxonomyIndex>(table => table
                                                          .CreateIndex("IDX_TaxonomyIndex_DocumentId_ContentType",
                                                                       "DocumentId",
                                                                       "ContentType",
                                                                       "ContentPart",
                                                                       "ContentField",
                                                                       "Published",
                                                                       "Latest")
                                                          );

            // We then shortcut the next migration step.
            return(5);
        }
Ejemplo n.º 5
0
        // This is a sequenced migration. On a new schemas this is complete after UpdateFrom2.
        public int Create()
        {
            SchemaBuilder.CreateMapIndexTable <UserIndex>(table => table
                                                          .Column <string>("NormalizedUserName") // TODO These should have defaults. on SQL Server they will fall at 255. Exceptions are currently thrown if you go over that.
                                                          .Column <string>("NormalizedEmail")
                                                          .Column <bool>("IsEnabled", c => c.NotNull().WithDefault(true))
                                                          .Column <string>("UserId")
                                                          );

            SchemaBuilder.AlterIndexTable <UserIndex>(table => table
                                                      .CreateIndex("IDX_UserIndex_IsEnabled", "DocumentId", "IsEnabled")
                                                      );

            SchemaBuilder.AlterIndexTable <UserIndex>(table => table
                                                      .CreateIndex("IDX_UserIndex_UserId", "DocumentId", "UserId")
                                                      );

            SchemaBuilder.AlterIndexTable <UserIndex>(table => table
                                                      // This index will be used for lookups when logging in.
                                                      .CreateIndex("IDX_UserIndex_UserName", "DocumentId", "NormalizedUserName")
                                                      );

            SchemaBuilder.AlterIndexTable <UserIndex>(table => table
                                                      .CreateIndex("IDX_UserIndex_Email", "DocumentId", "NormalizedEmail")
                                                      );

            SchemaBuilder.CreateReduceIndexTable <UserByRoleNameIndex>(table => table
                                                                       .Column <string>("RoleName")
                                                                       .Column <int>("Count")
                                                                       );

            return(UpdateFrom1());
        }
Ejemplo n.º 6
0
        // This code can be removed in a later version.
        public int UpdateFrom1()
        {
            SchemaBuilder.AlterIndexTable <LocalizedContentItemIndex>(table => table
                                                                      .AddColumn <bool>(nameof(LocalizedContentItemIndex.Published)));

            return(2);
        }
Ejemplo n.º 7
0
        // UserId database migration.
        // This code can be removed in a later version.
        public int UpdateFrom4()
        {
            SchemaBuilder.AlterIndexTable <UserIndex>(table => table
                                                      .AddColumn <string>("UserId"));

            return(5);
        }
Ejemplo n.º 8
0
        // This code can be removed in a later version.
        public int UpdateFrom1()
        {
            SchemaBuilder.AlterIndexTable <OpenIdTokenIndex>(table => table
                                                             .AddColumn <string>(nameof(OpenIdTokenIndex.Type)));

            return(2);
        }
Ejemplo n.º 9
0
        public int Create()
        {
            _contentDefinitionManager.AlterPartDefinition(nameof(LocalizationPart), builder => builder
                                                          .Attachable()
                                                          .WithDescription("Provides a way to create localized version of content."));

            SchemaBuilder.CreateMapIndexTable <LocalizedContentItemIndex>(table => table
                                                                          .Column <string>("LocalizationSet", col => col.WithLength(26))
                                                                          .Column <string>("Culture", col => col.WithLength(16))
                                                                          .Column <string>("ContentItemId", c => c.WithLength(26))
                                                                          .Column <bool>("Published")
                                                                          .Column <bool>("Latest")
                                                                          );

            SchemaBuilder.AlterIndexTable <LocalizedContentItemIndex>(table => table
                                                                      .CreateIndex("IDX_LocalizationPartIndex_DocumentId",
                                                                                   "DocumentId",
                                                                                   "LocalizationSet",
                                                                                   "Culture",
                                                                                   "ContentItemId",
                                                                                   "Published",
                                                                                   "Latest")
                                                                      );

            // Shortcut other migration steps on new content definition schemas.
            return(3);
        }
Ejemplo n.º 10
0
        // This code can be removed in a later version.
        public int UpdateFrom8()
        {
            SchemaBuilder.AlterIndexTable <UserIndex>(table => table
                                                      .CreateIndex("IDX_UserIndex_DocumentId",
                                                                   "DocumentId",
                                                                   "UserId",
                                                                   "NormalizedUserName",
                                                                   "NormalizedEmail",
                                                                   "IsEnabled")
                                                      );

            SchemaBuilder.AlterIndexTable <UserByLoginInfoIndex>(table => table
                                                                 .CreateIndex("IDX_UserByLoginInfoIndex_DocumentId",
                                                                              "DocumentId",
                                                                              "LoginProvider",
                                                                              "ProviderKey")
                                                                 );

            SchemaBuilder.AlterIndexTable <UserByClaimIndex>(table => table
                                                             .CreateIndex("IDX_UserByClaimIndex_DocumentId",
                                                                          "DocumentId",
                                                                          nameof(UserByClaimIndex.ClaimType),
                                                                          nameof(UserByClaimIndex.ClaimValue))
                                                             );

            return(9);
        }
Ejemplo n.º 11
0
        public int Create()
        {
            SchemaBuilder.CreateMapIndexTable <AuditTrailEventIndex>(table => table
                                                                     .Column <string>(nameof(AuditTrailEventIndex.EventId), column => column.WithLength(26))
                                                                     .Column <string>(nameof(AuditTrailEventIndex.Category), column => column.WithLength(64))
                                                                     .Column <string>(nameof(AuditTrailEventIndex.Name), column => column.WithLength(64))
                                                                     .Column <string>(nameof(AuditTrailEventIndex.CorrelationId), column => column.WithLength(26))
                                                                     .Column <string>(nameof(AuditTrailEventIndex.UserId), column => column.WithLength(26))
                                                                     .Column <string>(nameof(AuditTrailEventIndex.NormalizedUserName), column => column.Nullable().WithLength(255))
                                                                     .Column <DateTime>(nameof(AuditTrailEventIndex.CreatedUtc), column => column.Nullable()),
                                                                     collection: AuditTrailEvent.Collection);

            SchemaBuilder.AlterIndexTable <AuditTrailEventIndex>(table => table
                                                                 .CreateIndex("IDX_AuditTrailEventIndex_DocumentId",
                                                                              "DocumentId",
                                                                              nameof(AuditTrailEventIndex.EventId),
                                                                              nameof(AuditTrailEventIndex.Category),
                                                                              nameof(AuditTrailEventIndex.Name),
                                                                              nameof(AuditTrailEventIndex.CorrelationId),
                                                                              nameof(AuditTrailEventIndex.UserId),
                                                                              nameof(AuditTrailEventIndex.NormalizedUserName),
                                                                              nameof(AuditTrailEventIndex.CreatedUtc)
                                                                              ),
                                                                 collection: AuditTrailEvent.Collection
                                                                 );

            return(1);
        }
Ejemplo n.º 12
0
        public int Create()
        {
            _contentDefinitionManager.AlterPartDefinition(nameof(AliasPart), builder => builder
                                                          .Attachable()
                                                          .WithDescription("Provides a way to define custom aliases for content items."));

            // NOTE: The Alias Length has been upgraded from 64 characters to 767.
            // For existing SQL databases update the AliasPartIndex tables Alias column length manually.
            // INFO: The Alias Length is now of 740 chars, but this is only used on a new installation.
            SchemaBuilder.CreateMapIndexTable <AliasPartIndex>(table => table
                                                               .Column <string>("Alias", col => col.WithLength(AliasPart.MaxAliasLength))
                                                               .Column <string>("ContentItemId", c => c.WithLength(26))
                                                               .Column <bool>("Latest", c => c.WithDefault(false))
                                                               .Column <bool>("Published", c => c.WithDefault(true))
                                                               );

            SchemaBuilder.AlterIndexTable <AliasPartIndex>(table => table
                                                           .CreateIndex("IDX_AliasPartIndex_DocumentId",
                                                                        "DocumentId",
                                                                        "Alias",
                                                                        "ContentItemId",
                                                                        "Published",
                                                                        "Latest")
                                                           );

            // Shortcut other migration steps on new content definition schemas.
            return(4);
        }
Ejemplo n.º 13
0
        // This code can be removed in a later version.
        public int UpdateFrom4()
        {
            SchemaBuilder.AlterIndexTable <OpenIdApplicationIndex>(table => table
                                                                   .CreateIndex("IDX_OpenIdApplicationIndex_DocumentId",
                                                                                "DocumentId",
                                                                                nameof(OpenIdApplicationIndex.ApplicationId),
                                                                                nameof(OpenIdApplicationIndex.ClientId))
                                                                   );

            SchemaBuilder.AlterIndexTable <OpenIdAuthorizationIndex>(table => table
                                                                     .CreateIndex("IDX_OpenIdAuthorizationIndex_DocumentId_ApplicationId",
                                                                                  "DocumentId",
                                                                                  nameof(OpenIdAuthorizationIndex.ApplicationId),
                                                                                  nameof(OpenIdAuthorizationIndex.Status),
                                                                                  nameof(OpenIdAuthorizationIndex.Subject))
                                                                     );

            SchemaBuilder.AlterIndexTable <OpenIdAuthorizationIndex>(table => table
                                                                     .CreateIndex("IDX_OpenIdAuthorizationIndex_DocumentId_AuthorizationId",
                                                                                  "DocumentId",
                                                                                  nameof(OpenIdAuthorizationIndex.AuthorizationId),
                                                                                  nameof(OpenIdAuthorizationIndex.Status),
                                                                                  nameof(OpenIdAuthorizationIndex.Type),
                                                                                  nameof(OpenIdAuthorizationIndex.CreationDate))
                                                                     );

            SchemaBuilder.AlterIndexTable <OpenIdScopeIndex>(table => table
                                                             .CreateIndex("IDX_OpenIdScopeIndex_DocumentId",
                                                                          "DocumentId",
                                                                          nameof(OpenIdScopeIndex.Name),
                                                                          nameof(OpenIdScopeIndex.ScopeId))
                                                             );

            SchemaBuilder.AlterIndexTable <OpenIdTokenIndex>(table => table
                                                             .CreateIndex("IDX_OpenIdTokenIndex_DocumentId_ApplicationId",
                                                                          "DocumentId",
                                                                          nameof(OpenIdTokenIndex.ApplicationId),
                                                                          nameof(OpenIdTokenIndex.Status),
                                                                          nameof(OpenIdTokenIndex.Subject))
                                                             );

            SchemaBuilder.AlterIndexTable <OpenIdTokenIndex>(table => table
                                                             .CreateIndex("IDX_OpenIdTokenIndex_DocumentId_AuthorizationId",
                                                                          "DocumentId",
                                                                          nameof(OpenIdTokenIndex.AuthorizationId),
                                                                          nameof(OpenIdTokenIndex.Status),
                                                                          nameof(OpenIdTokenIndex.Type),
                                                                          nameof(OpenIdTokenIndex.CreationDate),
                                                                          nameof(OpenIdTokenIndex.ExpirationDate))
                                                             );

            SchemaBuilder.AlterIndexTable <OpenIdTokenIndex>(table => table
                                                             .CreateIndex("IDX_OpenIdTokenIndex_DocumentId_TokenId",
                                                                          "DocumentId",
                                                                          nameof(OpenIdTokenIndex.TokenId),
                                                                          nameof(OpenIdTokenIndex.ReferenceId))
                                                             );

            return(5);
        }
Ejemplo n.º 14
0
        public int UpdateFrom1()
        {
            SchemaBuilder.AlterIndexTable <ContentItemIndex>(table => table
                                                             .AddColumn <string>("ContentItemVersionId", c => c.WithLength(26))
                                                             );

            return(2);
        }
Ejemplo n.º 15
0
        // This code can be removed in a later version.
        public int UpdateFrom2()
        {
            SchemaBuilder.AlterIndexTable <ContainedPartIndex>(table => table
                                                               .CreateIndex("IDX_ContainedPartIndex_DocumentId", "DocumentId", "ListContentItemId", "Order")
                                                               );

            return(3);
        }
Ejemplo n.º 16
0
        public int UpdateFrom1()
        {
            SchemaBuilder.AlterIndexTable <WorkflowInstanceIndex>(
                table => table.AddColumn <string>(nameof(WorkflowInstanceIndex.DefinitionVersionId)),
                CollectionNames.WorkflowInstances);

            return(2);
        }
Ejemplo n.º 17
0
        // This code can be removed in a later version.
        public int UpdateFrom4()
        {
            SchemaBuilder.AlterIndexTable <AutoroutePartIndex>(table => table
                                                               .CreateIndex("IDX_AutoroutePartIndex_DocumentId", "DocumentId")
                                                               );

            return(5);
        }
Ejemplo n.º 18
0
        public int UpdateFrom2()
        {
            SchemaBuilder.AlterIndexTable <ContentItemIndex>(table => table
                                                             .AddColumn <string>("DisplayText", column => column.Nullable().WithLength(ContentItemIndex.MaxDisplayTextSize))
                                                             );

            return(3);
        }
Ejemplo n.º 19
0
        // This code can be removed in a later version.
        public int UpdateFrom1()
        {
            SchemaBuilder.AlterIndexTable <LayerMetadataIndex>(table => table
                                                               .CreateIndex("IDX_LayerMetadataIndex_DocumentId", "DocumentId", "Zone")
                                                               );

            return(2);
        }
Ejemplo n.º 20
0
        public int Create()
        {
            _contentDefinitionManager.AlterTypeDefinition("Taxonomy", taxonomy => taxonomy
                                                          .Draftable()
                                                          .Versionable()
                                                          .Creatable()
                                                          .Listable()
                                                          .WithPart("TitlePart", part => part.WithPosition("1"))
                                                          .WithPart("AliasPart", part => part
                                                                    .WithPosition("2")
                                                                    .WithSettings(new AliasPartSettings
            {
                Pattern = "{{ Model.ContentItem | display_text | slugify }}"
            }))
                                                          .WithPart("AutoroutePart", part => part
                                                                    .WithPosition("3")
                                                                    .WithSettings(new AutoroutePartSettings
            {
                Pattern = "{{ Model.ContentItem | display_text | slugify }}",
                AllowRouteContainedItems = true
            }))
                                                          .WithPart("TaxonomyPart", part => part.WithPosition("4"))
                                                          );

            SchemaBuilder.CreateMapIndexTable <TaxonomyIndex>(table => table
                                                              .Column <string>("TaxonomyContentItemId", c => c.WithLength(26))
                                                              .Column <string>("ContentItemId", c => c.WithLength(26))
                                                              .Column <string>("ContentType", column => column.WithLength(ContentItemIndex.MaxContentTypeSize))
                                                              .Column <string>("ContentPart", column => column.WithLength(ContentItemIndex.MaxContentPartSize))
                                                              .Column <string>("ContentField", column => column.WithLength(ContentItemIndex.MaxContentFieldSize))
                                                              .Column <string>("TermContentItemId", column => column.WithLength(26))
                                                              .Column <bool>("Published", c => c.WithDefault(true))
                                                              .Column <bool>("Latest", c => c.WithDefault(false))
                                                              );

            SchemaBuilder.AlterIndexTable <TaxonomyIndex>(table => table
                                                          .CreateIndex("IDX_TaxonomyIndex_DocumentId",
                                                                       "DocumentId",
                                                                       "TaxonomyContentItemId",
                                                                       "ContentItemId",
                                                                       "TermContentItemId",
                                                                       "Published",
                                                                       "Latest")
                                                          );

            SchemaBuilder.AlterIndexTable <TaxonomyIndex>(table => table
                                                          .CreateIndex("IDX_TaxonomyIndex_DocumentId_ContentType",
                                                                       "DocumentId",
                                                                       "ContentType",
                                                                       "ContentPart",
                                                                       "ContentField",
                                                                       "Published",
                                                                       "Latest")
                                                          );

            // Shortcut other migration steps on new content definition schemas.
            return(5);
        }
Ejemplo n.º 21
0
        // This code can be removed in a later version.
        public int UpdateFrom9()
        {
            SchemaBuilder.AlterIndexTable <UserByRoleNameIndex>(table => table
                                                                .CreateIndex("IDX_UserByRoleNameIndex_RoleName",
                                                                             "RoleName")
                                                                );

            return(10);
        }
Ejemplo n.º 22
0
        public int UpdateFrom1()
        {
            SchemaBuilder.AlterIndexTable <WorkflowIndex>(table =>
            {
                table.AddColumn <string>("WorkflowStatus");
            });

            return(2);
        }
Ejemplo n.º 23
0
        public int UpdateFrom3()
        {
            SchemaBuilder.AlterIndexTable <WorkflowDefinitionIndex>(
                table => table
                .AddColumn <string?>(nameof(WorkflowDefinitionIndex.Name)),
                CollectionNames.WorkflowDefinitions);

            return(4);
        }
Ejemplo n.º 24
0
        // This code can be removed in a later version.
        public int UpdateFrom3()
        {
            SchemaBuilder.AlterIndexTable <OpenIdAuthorizationIndex>(table => table
                                                                     .AddColumn <DateTime>(nameof(OpenIdAuthorizationIndex.CreationDate)));

            SchemaBuilder.AlterIndexTable <OpenIdTokenIndex>(table => table
                                                             .AddColumn <DateTime>(nameof(OpenIdTokenIndex.CreationDate)));

            return(4);
        }
Ejemplo n.º 25
0
        public int UpdateFrom1()
        {
            SchemaBuilder.AlterIndexTable <LinkFieldIndex>(table => table
                                                           .AddColumn <string>("BigUrl", column => column.Nullable().Unlimited()));

            SchemaBuilder.AlterIndexTable <LinkFieldIndex>(table => table
                                                           .AddColumn <string>("BigText", column => column.Nullable().Unlimited()));

            return(2);
        }
Ejemplo n.º 26
0
        // This code can be removed in a later version.
        public int UpdateFrom2()
        {
            SchemaBuilder.AlterIndexTable <DashboardPartIndex>(table => table
                                                               .CreateIndex("IDX_DashboardPart_DocumentId",
                                                                            "DocumentId",
                                                                            nameof(DashboardPartIndex.Position))
                                                               );

            return(3);
        }
Ejemplo n.º 27
0
        // This code can be removed in a later version.
        public int UpdateFrom2()
        {
            SchemaBuilder.AlterIndexTable <LocalizedContentItemIndex>(table => table
                                                                      .AddColumn <bool>(nameof(LocalizedContentItemIndex.Latest))
                                                                      );

            SchemaBuilder.AlterIndexTable <LocalizedContentItemIndex>(table => table
                                                                      .CreateIndex("IDX_LocalizationPartIndex_DocumentId", "DocumentId", "LocalizationSet", "Culture", "ContentItemId", "Published", "Latest")
                                                                      );

            return(3);
        }
Ejemplo n.º 28
0
        // This code can be removed in a later version as Latest and Published are alterations.
        public int UpdateFrom1()
        {
            SchemaBuilder.AlterIndexTable <AliasPartIndex>(table => table
                                                           .AddColumn <bool>("Latest", c => c.WithDefault(false))
                                                           );

            SchemaBuilder.AlterIndexTable <AliasPartIndex>(table => table
                                                           .AddColumn <bool>("Published", c => c.WithDefault(true))
                                                           );

            return(2);
        }
Ejemplo n.º 29
0
        public int UpdateFrom10()
        {
            SchemaBuilder.AlterIndexTable <UserIndex>(table => table
                                                      .AddColumn <bool>(nameof(UserIndex.IsLockoutEnabled), c => c.NotNull().WithDefault(false)));

            SchemaBuilder.AlterIndexTable <UserIndex>(table => table
                                                      .AddColumn <DateTime?>(nameof(UserIndex.LockoutEndUtc), c => c.Nullable()));

            SchemaBuilder.AlterIndexTable <UserIndex>(table => table
                                                      .AddColumn <int>(nameof(UserIndex.AccessFailedCount), c => c.NotNull().WithDefault(0)));

            return(11);
        }
Ejemplo n.º 30
0
        public int UpdateFrom11()
        {
            SchemaBuilder.AlterIndexTable <UserIndex>(table => table
                                                      .CreateIndex("IDX_UserIndex_Lockout",
                                                                   "DocumentId",
                                                                   "IsLockoutEnabled",
                                                                   "LockoutEndUtc",
                                                                   "AccessFailedCount"
                                                                   )
                                                      );

            return(12);
        }