public class SchemaMigration {
public final static int VERSION_UNKNOWN = -1;
- public static final int LAST_VERSION = 152;
+ public static final int LAST_VERSION = 160;
public final static String TABLE_NAME = "schema_migrations";
tp
end
+
+ def change_column_null(table_name, column_name, null, default = nil)
+ column = column_for(table_name, column_name)
+
+ unless null || default.nil?
+ execute("UPDATE #{quote_table_name(table_name)} SET #{quote_column_name(column_name)}=#{quote(default)} WHERE #{quote_column_name(column_name)} IS NULL")
+ end
+
+ change_column table_name, column_name, column.sql_type, :null => null
+ end
end
# wrong column types on oracle 10g timestamp and datetimes
def quote_table_name(name) #:nodoc:
quote_column_name(name).gsub('.', '`.`')
end
+
+
+ # see http://jira.codehaus.org/browse/JRUBY-4719
+ def change_column_null(table_name, column_name, null, default = nil)
+ unless null || default.nil?
+ execute("UPDATE #{quote_table_name(table_name)} SET #{quote_column_name(column_name)}=#{quote(default)} WHERE #{quote_column_name(column_name)} IS NULL")
+ end
+ execute("ALTER TABLE #{quote_table_name(table_name)} ALTER COLUMN #{quote_column_name(column_name)} #{'NOT ' unless null}NULL")
+ end
end
module PostgreSQL
end
@connection.columns_internal(table_name, name, schema_name)
end
+
+
+ # see http://jira.codehaus.org/browse/JRUBY-3608
+ def change_column_null(table_name, column_name, null, default = nil)
+ unless null || default.nil?
+ execute("UPDATE #{quote_table_name(table_name)} SET #{quote_column_name(column_name)}=#{quote(default)} WHERE #{quote_column_name(column_name)} IS NULL")
+ end
+ execute("ALTER TABLE #{quote_table_name(table_name)} ALTER #{quote_column_name(column_name)} #{null ? 'DROP' : 'SET'} NOT NULL")
+ end
end
end
--- /dev/null
+#
+# Sonar, open source software quality management tool.
+# Copyright (C) 2009 SonarSource SA
+# mailto:contact AT sonarsource DOT com
+#
+# Sonar is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 3 of the License, or (at your option) any later version.
+#
+# Sonar is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with Sonar; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+#
+class NullableRuleParameterDescription < ActiveRecord::Migration
+
+ def self.up
+ change_column_null(:rules_parameters, :description, true)
+ end
+end
\ No newline at end of file
import itests.page.GwtSamplePage;\r
import itests.page.RubyApiTestsPage;\r
import itests.resourcetab.SampleResourceTab;\r
+import itests.rules.SampleRules;\r
import itests.ws.RubyWebService;\r
import org.sonar.api.Plugin;\r
\r
extensions.add(SampleSensor.class);\r
extensions.add(LanguageWithoutRulesEngine.class);\r
extensions.add(ServerSideExtensionUsingExternalDependency.class);\r
-\r
+ extensions.add(SampleRules.class);\r
\r
// web\r
extensions.add(SampleResourceTab.class);\r
--- /dev/null
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2009 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * Sonar is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * Sonar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Sonar; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+ */
+package itests.rules;
+
+import org.sonar.check.IsoCategory;
+import org.sonar.check.Rule;
+
+@Rule(key="no_description", name="No description", isoCategory = IsoCategory.Maintainability)
+public class RuleWithoutDefinition {
+}
--- /dev/null
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2009 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * Sonar is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * Sonar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Sonar; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+ */
+package itests.rules;
+
+import org.sonar.api.resources.Java;
+import org.sonar.api.rules.AnnotationRuleParser;
+import org.sonar.api.rules.Rule;
+import org.sonar.api.rules.RuleRepository;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class SampleRules extends RuleRepository {
+
+ private AnnotationRuleParser ruleParser;
+
+ public SampleRules(AnnotationRuleParser ruleParser) {
+ super("it", Java.KEY);
+ setName("Integration tests");
+ this.ruleParser = ruleParser;
+ }
+
+ @Override
+ public List<Rule> createRules() {
+ return ruleParser.parse("it", Arrays.<Class>asList(RuleWithoutDefinition.class));
+ }
+}