public override string ToScript(ScriptingContext?context)
        {
            var builder = new StringBuilder();

            builder.Append(".alter ");
            builder.Append(EntityType == EntityType.Table ? "table" : "database");
            builder.Append(" ");
            if (EntityType == EntityType.Database && context?.CurrentDatabaseName != null)
            {
                builder.Append(context.CurrentDatabaseName.ToScript());
            }
            else
            {
                builder.Append(EntityName.ToScript());
            }
            builder.Append(" policy caching ");
            if (HotData.Equals(HotIndex))
            {
                builder.Append("hot = ");
                builder.Append(HotData);
            }
            else
            {
                builder.Append("hotdata = ");
                builder.Append(HotData);
                builder.Append(" hotindex = ");
                builder.Append(HotIndex);
            }

            return(builder.ToString());
        }
        private void TestUpdatePolicy(string tableName, params UpdatePolicy[] policies)
        {
            var table        = new EntityName(tableName);
            var policiesText = JsonSerializer.Serialize(policies);
            var commandText  = $".alter table {table.ToScript()} policy update @'{policiesText}'";
            var command      = ParseOneCommand(commandText);

            Assert.IsType <AlterUpdatePolicyCommand>(command);
        }
Exemplo n.º 3
0
        public override string ToScript(ScriptingContext?context)
        {
            var builder = new StringBuilder();

            builder.Append(".delete ");
            builder.Append(EntityType == EntityType.Table ? "table" : "database");
            builder.Append(" ");
            if (EntityType == EntityType.Database && context?.CurrentDatabaseName != null)
            {
                builder.Append(context.CurrentDatabaseName.ToScript());
            }
            else
            {
                builder.Append(EntityName.ToScript());
            }
            builder.Append(" policy caching");

            return(builder.ToString());
        }
        public override string ToScript(ScriptingContext?context)
        {
            var builder = new StringBuilder();

            builder.Append(".alter ");
            builder.Append(EntityType == EntityType.Table ? "table" : "database");
            builder.Append(" ");
            if (EntityType == EntityType.Database && context?.CurrentDatabaseName != null)
            {
                builder.Append(context.CurrentDatabaseName.ToScript());
            }
            else
            {
                builder.Append(EntityName.ToScript());
            }
            builder.Append(" policy retention");
            builder.AppendLine();
            builder.Append("```");
            builder.Append(SerializePolicy());
            builder.AppendLine();
            builder.Append("```");

            return(builder.ToString());
        }