diff --git a/backend/commons/pom.xml b/backend/commons/pom.xml index f1ed917f1c..c101bd184a 100644 --- a/backend/commons/pom.xml +++ b/backend/commons/pom.xml @@ -105,6 +105,54 @@ + + org.flywaydb + flyway-maven-plugin + + + generate-sources + + migrate + + + + + jdbc:h2:${project.build.directory}/db/for-schema-generation.db + user + + filesystem:src/main/resources/db/migration/ + + + + + org.jooq + jooq-codegen-maven + + + generate-sources + + generate + + + + + + org.h2.Driver + jdbc:h2:${project.build.directory}/db/for-schema-generation.db + user + + + + org.jooq.meta.h2.H2Database + PUBLIC + + + org.sonarsource.sonarlint.core.commons.storage.model + ${project.build.directory}/generated-sources/jooq + + + + org.apache.maven.plugins maven-jar-plugin diff --git a/backend/commons/src/main/java/org/sonarsource/sonarlint/core/commons/storage/SonarLintDatabase.java b/backend/commons/src/main/java/org/sonarsource/sonarlint/core/commons/storage/SonarLintDatabase.java index dde50573a3..e479f9c344 100644 --- a/backend/commons/src/main/java/org/sonarsource/sonarlint/core/commons/storage/SonarLintDatabase.java +++ b/backend/commons/src/main/java/org/sonarsource/sonarlint/core/commons/storage/SonarLintDatabase.java @@ -32,7 +32,7 @@ import org.jooq.impl.DSL; import org.sonarsource.sonarlint.core.commons.log.SonarLintLogger; -import static org.sonarsource.sonarlint.core.commons.storage.generated.Tables.AI_CODEFIX_SETTINGS; +import static org.sonarsource.sonarlint.core.commons.storage.model.Tables.AI_CODEFIX_SETTINGS; public final class SonarLintDatabase { private static final SonarLintLogger LOG = SonarLintLogger.get(); diff --git a/backend/commons/src/main/java/org/sonarsource/sonarlint/core/commons/storage/generated/Tables.java b/backend/commons/src/main/java/org/sonarsource/sonarlint/core/commons/storage/generated/Tables.java deleted file mode 100644 index 7a612ac1ad..0000000000 --- a/backend/commons/src/main/java/org/sonarsource/sonarlint/core/commons/storage/generated/Tables.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * SonarLint Core - Commons - * Copyright (C) 2016-2025 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program 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. - */ -/* - * Minimal stub of jOOQ generated Tables to allow compilation in environments - * where the jOOQ code generation step is not executed by the build runner. - * - * This file should be replaced by actual generated sources during a normal - * Maven build where the jOOQ codegen plugin runs. - */ -package org.sonarsource.sonarlint.core.commons.storage.generated; - -import org.sonarsource.sonarlint.core.commons.storage.generated.tables.AiCodeFixSettingsTable; - -public final class Tables { - private Tables() {} - - public static final AiCodeFixSettingsTable AI_CODEFIX_SETTINGS = AiCodeFixSettingsTable.AI_CODEFIX_SETTINGS; -} diff --git a/backend/commons/src/main/java/org/sonarsource/sonarlint/core/commons/storage/generated/tables/AiCodeFixSettingsTable.java b/backend/commons/src/main/java/org/sonarsource/sonarlint/core/commons/storage/generated/tables/AiCodeFixSettingsTable.java deleted file mode 100644 index 6069fd1897..0000000000 --- a/backend/commons/src/main/java/org/sonarsource/sonarlint/core/commons/storage/generated/tables/AiCodeFixSettingsTable.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * SonarLint Core - Commons - * Copyright (C) 2016-2025 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program 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. - * - * This program 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. - */ -/* - * Minimal stub of a jOOQ generated Table for AI_CODEFIX_SETTINGS. - * This is only to make the project compile in environments where the jOOQ - * code generation step is not executed. A normal Maven build should generate - * a richer version of this class. - */ -package org.sonarsource.sonarlint.core.commons.storage.generated.tables; - -import org.jooq.Record; -import org.jooq.TableField; -import org.jooq.impl.DSL; -import org.jooq.impl.SQLDataType; -import org.jooq.impl.TableImpl; - -public final class AiCodeFixSettingsTable extends TableImpl { - private static final long serialVersionUID = 1L; - - public static final AiCodeFixSettingsTable AI_CODEFIX_SETTINGS = new AiCodeFixSettingsTable(); - - public final TableField CONNECTION_ID = createField(DSL.name("CONNECTION_ID"), SQLDataType.VARCHAR.length(255), this, ""); - public final TableField SUPPORTED_RULES = createField(DSL.name("SUPPORTED_RULES"), SQLDataType.VARCHAR(64).getArrayDataType(), this, ""); - public final TableField ORGANIZATION_ELIGIBLE = createField(DSL.name("ORGANIZATION_ELIGIBLE"), SQLDataType.BOOLEAN, this, ""); - public final TableField ENABLEMENT = createField(DSL.name("ENABLEMENT"), SQLDataType.VARCHAR.length(64), this, ""); - public final TableField ENABLED_PROJECT_KEYS = createField(DSL.name("ENABLED_PROJECT_KEYS"), SQLDataType.VARCHAR(400).getArrayDataType(), this, ""); - - private AiCodeFixSettingsTable() { - super(DSL.name("AI_CODEFIX_SETTINGS")); - } -} diff --git a/backend/commons/src/main/java/org/sonarsource/sonarlint/core/commons/storage/repository/AiCodeFixRepository.java b/backend/commons/src/main/java/org/sonarsource/sonarlint/core/commons/storage/repository/AiCodeFixRepository.java index 6557aa4de7..e9a246fed8 100644 --- a/backend/commons/src/main/java/org/sonarsource/sonarlint/core/commons/storage/repository/AiCodeFixRepository.java +++ b/backend/commons/src/main/java/org/sonarsource/sonarlint/core/commons/storage/repository/AiCodeFixRepository.java @@ -24,7 +24,7 @@ import org.sonarsource.sonarlint.core.commons.storage.SonarLintDatabase; import org.sonarsource.sonarlint.core.commons.storage.model.AiCodeFix; -import static org.sonarsource.sonarlint.core.commons.storage.generated.Tables.AI_CODEFIX_SETTINGS; +import static org.sonarsource.sonarlint.core.commons.storage.model.Tables.AI_CODEFIX_SETTINGS; /** * Repository for persisting and retrieving AiCodeFix entity using the local H2 database. diff --git a/pom.xml b/pom.xml index 82afeae04a..d3cb410644 100644 --- a/pom.xml +++ b/pom.xml @@ -49,7 +49,7 @@ GNU LGPL v3 - + 3.19.15 11.14.0 @@ -336,6 +337,16 @@ download-maven-plugin 1.13.0 + + org.jooq + jooq-codegen-maven + ${jooq.version} + + + org.flywaydb + flyway-maven-plugin + ${flyway.version} +