public void CreateTables(string featureName) {
            var stringInterpreter = new StringCommandInterpreter(Context.Output);
            try {
                var commands = _schemaCommandGenerator.GetCreateFeatureCommands(featureName, Drop).ToList();
                if ( commands.Any() ) {
                    foreach (var command in commands) {
                        stringInterpreter.Visit(command);
                        _dataMigrationInterpreter.Visit(command);
                    }
                }
                else {
                    Context.Output.WriteLine(T("There are no tables to create for feature {0}.", featureName));
                    return;
                }
            }
            catch ( Exception ex ) {
                throw new OrchardException(T("An error occured while creating the tables."), ex);
            }

            Context.Output.WriteLine(T("Tables created"));
        }
Ejemplo n.º 2
0
        public string CreateTables(string featureName) {
            var stringInterpreter = new StringCommandInterpreter(Context.Output);
            try {
                var commands = _schemaCommandGenerator.GetCreateFeatureCommands(featureName, Drop).ToList();
                if ( commands.Any() ) {

                    foreach (var command in commands) {
                        stringInterpreter.Visit(command);
                        _dataMigrationInterpreter.Visit(command);
                    }
                }
                else {
                    return "There are no tables to create for this feature.";
                }
            }
            catch ( Exception ex ) {
                Context.Output.WriteLine(T("An error occured while creating the tables: " + ex.Message));
                return "Tables creation terminated.";
            }

            return "Tables created";
        }