Exemplo n.º 1
0
        public void UpdateDatabase()
        {
            UpdateDataSets();

            // We have up-to-date datasets (version 2)
            // DataSet Properties DBVersion is not used from this point

            UpdateVersion(0, 3, () =>
            {
                logger.LogInformation("Adding Service Alias field");
                MapModelElastic <ServiceElastic>(Elastic.Constants.SlambyServicesIndex);
            });

            UpdateVersion(3, () =>
            {
                logger.LogInformation($"Service Alias mapping to Not Analyzed with recreating {Elastic.Constants.SlambyServicesIndex}...");
                serviceQuery.ReCreateIndex();
            });

            UpdateVersion(4, () =>
            {
                logger.LogInformation("Adding Compress Settings field");
                MapModelElastic <ClassifierSettingsElastic>(Elastic.Constants.SlambyServicesIndex);
                MapModelElastic <PrcSettingsElastic>(Elastic.Constants.SlambyServicesIndex);
            });

            UpdateVersion(5, () =>
            {
                MapModelElastic <PrcSettingsElastic>(Elastic.Constants.SlambyServicesIndex);
            });

            UpdateVersion(6, () =>
            {
                serviceManager.UpdateDataSetNameToIndex <PrcSettingsElastic>(ServiceTypeEnum.Prc);
                serviceManager.UpdateDataSetNameToIndex <ClassifierSettingsElastic>(ServiceTypeEnum.Classifier);
            });

            UpdateVersion(7, () =>
            {
                logger.LogInformation("Adding DestinationDataSetName field to PrcSettingsElastic");
                MapModelElastic <PrcSettingsElastic>(Elastic.Constants.SlambyServicesIndex);
                serviceManager.FillUpDestinationDataSetName();
            });
        }