--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2013 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube 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.
+ *
+ * SonarQube 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 this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package org.sonar.core.issue.db;
+
+import org.apache.ibatis.session.SqlSession;
+import org.sonar.api.BatchComponent;
+import org.sonar.api.ServerComponent;
+import org.sonar.core.persistence.MyBatis;
+
+import javax.annotation.CheckForNull;
+
+import java.util.List;
+
+/**
+ * @since 3.6
+ */
+public class IssueFilterDao implements BatchComponent, ServerComponent {
+
+ private final MyBatis mybatis;
+
+ public IssueFilterDao(MyBatis mybatis) {
+ this.mybatis = mybatis;
+ }
+
+ @CheckForNull
+ public IssueFilterDto selectById(Integer id) {
+ SqlSession session = mybatis.openSession();
+ try {
+ session.getMapper(IssueFilterMapper.class);
+ return getMapper(session).selectById(id);
+ } finally {
+ MyBatis.closeQuietly(session);
+ }
+ }
+
+ public List<IssueFilterDto> selectByUser(Integer userId) {
+ SqlSession session = mybatis.openSession();
+ try {
+ session.getMapper(IssueFilterMapper.class);
+ return getMapper(session).selectByUser(userId);
+ } finally {
+ MyBatis.closeQuietly(session);
+ }
+ }
+
+ public void insert(IssueFilterDto filter) {
+ SqlSession session = mybatis.openSession();
+ try {
+ getMapper(session).insert(filter);
+ session.commit();
+ } finally {
+ MyBatis.closeQuietly(session);
+ }
+ }
+
+ public void update(IssueFilterDto filter) {
+ SqlSession session = mybatis.openSession();
+ try {
+ getMapper(session).update(filter);
+ session.commit();
+ } finally {
+ MyBatis.closeQuietly(session);
+ }
+ }
+
+ public void delete(Integer id) {
+ SqlSession session = mybatis.openSession();
+ try {
+ getMapper(session).delete(id);
+ session.commit();
+ } finally {
+ MyBatis.closeQuietly(session);
+ }
+ }
+
+ private IssueFilterMapper getMapper(SqlSession session) {
+ return session.getMapper(IssueFilterMapper.class);
+ }
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2013 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube 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.
+ *
+ * SonarQube 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 this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.core.issue.db;
+
+import javax.annotation.Nullable;
+
+import java.util.Date;
+
+/**
+ * @since 3.6
+ */
+public class IssueFilterDto {
+
+ private Long id;
+ private String name;
+ private Long userId;
+ private Boolean shared;
+ private String description;
+ private String data;
+ private Date createdAt;
+ private Date updatedAt;
+
+ public Long getId() {
+ return id;
+ }
+
+ public IssueFilterDto setId(Long id) {
+ this.id = id;
+ return this;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public IssueFilterDto setName(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public Long getUserId() {
+ return userId;
+ }
+
+ public IssueFilterDto setUserId(@Nullable Long userId) {
+ this.userId = userId;
+ return this;
+ }
+
+ public Boolean isShared() {
+ return shared;
+ }
+
+ public IssueFilterDto setShared(@Nullable Boolean shared) {
+ this.shared = shared;
+ return this;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public IssueFilterDto setDescription(@Nullable String description) {
+ this.description = description;
+ return this;
+ }
+
+ public String getData() {
+ return data;
+ }
+
+ public IssueFilterDto setData(String data) {
+ this.data = data;
+ return this;
+ }
+
+ public Date getCreatedAt() {
+ return createdAt;
+ }
+
+ public IssueFilterDto setCreatedAt(Date createdAt) {
+ this.createdAt = createdAt;
+ return this;
+ }
+
+ public Date getUpdatedAt() {
+ return updatedAt;
+ }
+
+ public IssueFilterDto setUpdatedAt(Date updatedAt) {
+ this.updatedAt = updatedAt;
+ return this;
+ }
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2013 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube 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.
+ *
+ * SonarQube 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 this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.core.issue.db;
+
+import javax.annotation.CheckForNull;
+
+import java.util.List;
+
+/**
+ * @since 3.6
+ */
+public interface IssueFilterMapper {
+
+ @CheckForNull
+ IssueFilterDto selectById(Integer id);
+
+ List<IssueFilterDto> selectByUser(Integer userId);
+
+ void insert(IssueFilterDto filter);
+
+ void update(IssueFilterDto filter);
+
+ void delete(Integer id);
+}
IssueDao.class,
IssueStatsDao.class,
IssueChangeDao.class,
+ IssueFilterDao.class,
LoadedTemplateDao.class,
MeasureFilterDao.class,
PropertiesDao.class,
"group_roles",
"issues",
"issue_changes",
+ "issue_filters",
+ "issue_filter_favourites",
"loaded_templates",
"manual_measures",
"measure_data",
*/
public class DatabaseVersion implements BatchComponent, ServerComponent {
- public static final int LAST_VERSION = 403;
+ public static final int LAST_VERSION = 411;
public static enum Status {
UP_TO_DATE, REQUIRES_UPGRADE, REQUIRES_DOWNGRADE, FRESH_INSTALL
loadAlias(conf, "MeasureData", MeasureData.class);
loadAlias(conf, "Issue", IssueDto.class);
loadAlias(conf, "IssueChange", IssueChangeDto.class);
+ loadAlias(conf, "IssueFilter", IssueFilterDto.class);
loadAlias(conf, "SnapshotData", SnapshotDataDto.class);
loadAlias(conf, "ActionPlanIssue", ActionPlanDto.class);
loadAlias(conf, "ActionPlanStats", ActionPlanStatsDto.class);
+ // AuthorizationMapper has to be loaded before IssueMapper because this last one used it
+ loadMapper(conf, "org.sonar.core.user.AuthorizationMapper");
+ // ResourceMapper has to be loaded before IssueMapper because this last one used it
+ loadMapper(conf, ResourceMapper.class);
+
Class<?>[] mappers = {ActiveDashboardMapper.class, AuthorMapper.class, DashboardMapper.class,
DependencyMapper.class, DuplicationMapper.class, GraphDtoMapper.class,
- IssueMapper.class, IssueStatsMapper.class, IssueChangeMapper.class,
+ IssueMapper.class, IssueStatsMapper.class, IssueChangeMapper.class, IssueFilterMapper.class,
LoadedTemplateMapper.class, MeasureFilterMapper.class, PropertiesMapper.class, PurgeMapper.class, ResourceKeyUpdaterMapper.class, ResourceIndexerMapper.class,
ResourceSnapshotMapper.class, RoleMapper.class, RuleMapper.class, SchemaMigrationMapper.class,
SemaphoreMapper.class, UserMapper.class, WidgetMapper.class, WidgetPropertyMapper.class, MeasureMapper.class, SnapshotDataMapper.class,
SnapshotSourceMapper.class, ActionPlanMapper.class, ActionPlanStatsMapper.class
};
- // AuthorizationMapper has to be loaded before IssueMapper because this last one used it
- loadMapper(conf, "org.sonar.core.user.AuthorizationMapper");
- // ResourceMapper has to be loaded before IssueMapper because this last one used it
- loadMapper(conf, ResourceMapper.class);
loadMappers(conf, mappers);
configureLogback(mappers);
<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- ~ SonarQube, open source software quality management tool.
- ~ Copyright (C) 2008-2013 SonarSource
- ~ mailto:contact AT sonarsource DOT com
- ~
- ~ SonarQube 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.
- ~
- ~ SonarQube 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 this program; if not, write to the Free Software Foundation,
- ~ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- -->
-
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mappei.dtd">
<mapper namespace="org.sonar.core.issue.db.IssueChangeMapper">
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="org.sonar.core.issue.db.IssueFilterMapper">
+
+ <sql id="issueFilterColumns">
+ if.id,
+ if.name as name,
+ if.user_id as userId,
+ if.shared as shared,
+ if.description as description,
+ if.data as data,
+ if.created_at as createdAt,
+ if.updated_at as updatedAt
+ </sql>
+
+ <select id="selectById" parameterType="int" resultType="IssueFilter">
+ select <include refid="issueFilterColumns"/>
+ from issue_filters if WHERE id=#{id}
+ </select>
+
+ <select id="selectByUser" parameterType="int" resultType="IssueFilter">
+ select <include refid="issueFilterColumns"/>
+ from issue_filters if WHERE user_id=#{userId}
+ </select>
+
+ <insert id="insert" parameterType="IssueFilter" useGeneratedKeys="true" keyProperty="id">
+ INSERT INTO issue_filters (name, user_id, shared, description, data, created_at, updated_at)
+ VALUES (#{name}, #{userId}, #{shared}, #{description}, #{data}, #{createdAt}, #{updatedAt})
+ </insert>
+
+ <!-- Oracle -->
+ <insert id="insert" databaseId="oracle" parameterType="IssueFilter" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
+ <selectKey order="BEFORE" resultType="Long" keyProperty="id">
+ select issue_filters_seq.NEXTVAL from DUAL
+ </selectKey>
+ INSERT INTO issue_filters (id, name, user_id, shared, description, data, created_at, updated_at)
+ VALUES (#{id}, #{name}, #{userId}, #{shared}, #{description}, #{data}, #{createdAt}, #{updatedAt})
+ </insert>
+
+ <update id="update" parameterType="IssueFilter">
+ update issue_filters set
+ name=#{name},
+ user_id=#{userId},
+ shared=#{shared},
+ description=#{description},
+ data=#{data},
+ updated_at=current_timestamp
+ where id=#{id}
+ </update>
+
+ <delete id="delete" parameterType="int">
+ delete from issue_filters where id=#{id}
+ </delete>
+
+</mapper>
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('401');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('402');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('403');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('410');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('411');
INSERT INTO USERS(ID, LOGIN, NAME, EMAIL, CRYPTED_PASSWORD, SALT, CREATED_AT, UPDATED_AT, REMEMBER_TOKEN, REMEMBER_TOKEN_EXPIRES_AT) VALUES (1, 'admin', 'Administrator', '', 'a373a0e667abb2604c1fd571eb4ad47fe8cc0878', '48bc4b0d93179b5103fd3885ea9119498e9d161b', '2011-09-26 22:27:48.0', '2011-09-26 22:27:48.0', null, null);
ALTER TABLE USERS ALTER COLUMN ID RESTART WITH 2;
"UPDATED_AT" TIMESTAMP,
);
+CREATE TABLE "ISSUE_FILTERS" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "NAME" VARCHAR(100) NOT NULL,
+ "SHARED" BOOLEAN NOT NULL DEFAULT FALSE,
+ "USER_ID" INTEGER,
+ "DESCRIPTION" VARCHAR(4000),
+ "DATA" CLOB(2147483647),
+ "CREATED_AT" TIMESTAMP,
+ "UPDATED_AT" TIMESTAMP
+);
+
+CREATE TABLE "ISSUE_FILTER_FAVOURITES" (
+ "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ "USER_ID" INTEGER NOT NULL,
+ "ISSUE_FILTER_ID" INTEGER NOT NULL,
+ "CREATED_AT" TIMESTAMP
+);
+
CREATE TABLE "SNAPSHOT_DATA" (
"ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
"SNAPSHOT_ID" INTEGER,
CREATE INDEX "ISSUE_CHANGES_ISSUE_KEY" ON "ISSUE_CHANGES" ("ISSUE_KEY");
+CREATE INDEX "ISSUE_FILTERS_NAME" ON "ISSUE_FILTERS" ("NAME");
+
+CREATE INDEX "ISSUE_FILTER_FAVS_USERID" ON "ISSUE_FILTER_FAVOURITES" ("USER_ID");
+
CREATE UNIQUE INDEX "USERS_LOGIN" ON "USERS" ("LOGIN");
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2013 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube 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.
+ *
+ * SonarQube 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 this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package org.sonar.core.issue.db;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.sonar.core.persistence.AbstractDaoTestCase;
+
+import java.util.List;
+
+import static org.fest.assertions.Assertions.assertThat;
+
+public class IssueFilterDaoTest extends AbstractDaoTestCase {
+
+ IssueFilterDao dao;
+
+ @Before
+ public void createDao() {
+ dao = new IssueFilterDao(getMyBatis());
+ }
+
+ @Test
+ public void should_select_by_id() {
+ setupData("shared");
+
+ IssueFilterDto filter = dao.selectById(1);
+
+ assertThat(filter.getId()).isEqualTo(1L);
+ assertThat(filter.getName()).isEqualTo("Sonar Issues");
+ assertThat(filter.isShared()).isTrue();
+
+ assertThat(dao.selectById(123)).isNull();
+ }
+
+ @Test
+ public void should_select_by_user() {
+ setupData("should_select_by_user");
+
+ List<IssueFilterDto> results = dao.selectByUser(2);
+
+ assertThat(results).hasSize(2);
+ }
+
+ @Test
+ public void should_insert() {
+ setupData("shared");
+
+ IssueFilterDto filterDto = new IssueFilterDto();
+ filterDto.setName("Sonar Open issues");
+ filterDto.setUserId(2L);
+ filterDto.setShared(true);
+ filterDto.setDescription("All open issues on Sonar");
+ filterDto.setData("statuses=OPEN|componentRoots=org.codehaus.sonar");
+
+ dao.insert(filterDto);
+
+ checkTables("should_insert", new String[]{"created_at", "updated_at"}, "issue_filters");
+ }
+
+ @Test
+ public void should_update() {
+ setupData("shared");
+
+ IssueFilterDto filterDto = new IssueFilterDto();
+ filterDto.setId(2L);
+ filterDto.setName("Closed issues");
+ filterDto.setUserId(3L);
+ filterDto.setShared(false);
+ filterDto.setDescription("All closed issues");
+ filterDto.setData("statuses=CLOSED");
+
+ dao.update(filterDto);
+
+ checkTables("should_update", new String[]{"created_at", "updated_at"}, "issue_filters");
+ }
+
+ @Test
+ public void should_delete() {
+ setupData("shared");
+
+ dao.delete(1);
+
+ checkTables("should_delete", new String[]{"created_at", "updated_at"}, "issue_filters");
+ }
+}
assertThat(filter.getName()).isEqualTo("Projects");
}
-
@Test
public void should_not_find_filter() {
setupData("shared");
--- /dev/null
+<dataset>
+
+ <issue_filters
+ id="1"
+ name="Sonar Issues"
+ user_id="1"
+ shared="[true]"
+ description="All issues of Sonar"
+ data="componentRoots=org.codehaus.sonar"
+ created_at="2013-06-10"
+ updated_at="2013-06-10" />
+
+ <issue_filters
+ id="2"
+ name="Open issues"
+ user_id="2"
+ shared="[false]"
+ description="All open issues"
+ data="statuses=OPEN"
+ created_at="2013-06-10"
+ updated_at="2013-06-10" />
+
+</dataset>
--- /dev/null
+<dataset>
+
+ <issue_filters
+ id="2"
+ name="Open issues"
+ user_id="2"
+ shared="[false]"
+ description="All open issues"
+ data="statuses=OPEN"
+ created_at="2013-06-10"
+ updated_at="2013-06-10" />
+
+</dataset>
--- /dev/null
+<dataset>
+
+ <issue_filters
+ id="1"
+ name="Sonar Issues"
+ user_id="1"
+ shared="[true]"
+ description="All issues of Sonar"
+ data="componentRoots=org.codehaus.sonar"
+ created_at="2013-06-10"
+ updated_at="2013-06-10" />
+
+ <issue_filters
+ id="2"
+ name="Open issues"
+ user_id="2"
+ shared="[false]"
+ description="All open issues"
+ data="statuses=OPEN"
+ created_at="2013-06-10"
+ updated_at="2013-06-10" />
+
+
+ <issue_filters
+ id="3"
+ name="Sonar Open issues"
+ user_id="2"
+ shared="[true]"
+ description="All open issues on Sonar"
+ data="statuses=OPEN|componentRoots=org.codehaus.sonar"
+ created_at="2013-06-10"
+ updated_at="2013-06-10" />
+
+</dataset>
--- /dev/null
+<dataset>
+
+ <issue_filters
+ id="1"
+ name="Sonar Issues"
+ user_id="1"
+ shared="[true]"
+ description="All issues of Sonar"
+ data="componentRoots=org.codehaus.sonar"
+ created_at="2013-06-10"
+ updated_at="2013-06-10" />
+
+ <issue_filters
+ id="2"
+ name="Open issues"
+ user_id="2"
+ shared="[false]"
+ description="All open issues"
+ data="statuses=OPEN"
+ created_at="2013-06-10"
+ updated_at="2013-06-10" />
+
+ <issue_filters
+ id="3"
+ name="Sonar Open issues"
+ user_id="2"
+ shared="[true]"
+ description="All open issues on Sonar"
+ data="statuses=OPEN|componentRoots=org.codehaus.sonar"
+ created_at="2013-06-10"
+ updated_at="2013-06-10" />
+
+</dataset>
--- /dev/null
+<dataset>
+
+ <issue_filters
+ id="1"
+ name="Sonar Issues"
+ user_id="1"
+ shared="[true]"
+ description="All issues of Sonar"
+ data="componentRoots=org.codehaus.sonar"
+ created_at="2013-06-10"
+ updated_at="2013-06-10" />
+
+ <issue_filters
+ id="2"
+ name="Closed issues"
+ user_id="3"
+ shared="[false]"
+ description="All closed issues"
+ data="statuses=CLOSED"
+ created_at="2013-06-10"
+ updated_at="2013-06-11" />
+
+</dataset>
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2013 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube 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.
+ *
+ * SonarQube 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 this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package org.sonar.server.issue;
+
+import org.sonar.api.ServerComponent;
+import org.sonar.core.issue.db.IssueFilterDao;
+
+public class IssueFilterService implements ServerComponent {
+
+ private IssueFilterDao issueFilterDao;
+
+ public IssueFilterService(IssueFilterDao issueFilterDao) {
+ this.issueFilterDao = issueFilterDao;
+ }
+}
servicesContainer.addSingleton(IssueNotifications.class);
servicesContainer.addSingleton(ActionService.class);
servicesContainer.addSingleton(Actions.class);
+ servicesContainer.addSingleton(IssueFilterService.class);
// rules
servicesContainer.addSingleton(RubyRuleService.class);
--- /dev/null
+#
+# Sonar, entreprise quality control tool.
+# Copyright (C) 2008-2013 SonarSource
+# mailto:contact AT sonarsource DOT com
+#
+# SonarQube 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.
+#
+# SonarQube 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 this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+#
+# Sonar 3.6
+# See SONAR-4383
+#
+class CreateIssueFilters < ActiveRecord::Migration
+
+ def self.up
+ create_table 'issue_filters' do |t|
+ t.column 'name', :string, :null => false, :limit => 100
+ t.column 'user_id', :integer, :null => true
+ t.column 'shared', :boolean, :default => false, :null => false
+ t.column 'description', :string, :null => true, :limit => 4000
+ t.column 'data', :text, :null => true
+ t.timestamps
+ end
+ add_index 'issue_filters', 'name', :name => 'issue_filters_name'
+ end
+
+end
\ No newline at end of file
--- /dev/null
+#
+# Sonar, entreprise quality control tool.
+# Copyright (C) 2008-2013 SonarSource
+# mailto:contact AT sonarsource DOT com
+#
+# SonarQube 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.
+#
+# SonarQube 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 this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+
+#
+# Sonar 3.6
+# See SONAR-4383
+#
+class CreateIssueFilterFavourites < ActiveRecord::Migration
+
+ def self.up
+ create_table 'issue_filter_favourites' do |t|
+ t.column 'user_id', :integer, :null => false
+ t.column 'issue_filter_id', :integer, :null => false
+ t.column 'created_at', :datetime
+ end
+ add_index 'issue_filter_favourites', 'user_id', :name => 'issue_filter_favs_userid'
+ end
+
+end
+