The Unified and Autonomous Development Platform
feat: Remove SQL server support (OD-2189)
Robin Shen853c144f57a3
diff --git a/server-core/src/main/java/io/onedev/server/data/migration/DataMigrator.java b/server-core/src/main/java/io/onedev/server/data/migration/DataMigrator.javaindex bfd124be42..291d699eeb 100644--- a/server-core/src/main/java/io/onedev/server/data/migration/DataMigrator.java+++ b/server-core/src/main/java/io/onedev/server/data/migration/DataMigrator.java@@ -3739,7 +3739,7 @@ public class DataMigrator {VersionedXmlDoc dom = VersionedXmlDoc.fromFile(file);for (Element element : dom.getRootElement().elements()) {if (element.element("serviceDeskName") == null)- element.addElement("serviceDeskName").setText(Project.NULL_SERVICE_DESK_PREFIX + UUID.randomUUID().toString());+ element.addElement("serviceDeskName").setText("<$NullServiceDesk$>" + UUID.randomUUID().toString());}dom.writeToFile(file, false);}@@ -6374,7 +6374,7 @@ public class DataMigrator {} else if (file.getName().startsWith("Projects.xml")) {VersionedXmlDoc dom = VersionedXmlDoc.fromFile(file);for (Element element : dom.getRootElement().elements()) {- element.addElement("key").setText(Project.NULL_KEY_PREFIX + UUID.randomUUID());+ element.addElement("key").setText("<$NullKey$>" + UUID.randomUUID());}dom.writeToFile(file, false);} else if (file.getName().startsWith("Dashboards.xml")) {@@ -7206,6 +7206,12 @@ public class DataMigrator {migrate182_reviewRequirement(fileProtectionElement.element("reviewRequirement"));}}+ var serviceDeskNameElement = element.element("serviceDeskName");+ if (serviceDeskNameElement.getText().trim().startsWith("<$NullServiceDesk$>"))+ serviceDeskNameElement.detach();+ var keyElement = element.element("key");+ if (keyElement.getText().trim().startsWith("<$NullKey$>"))+ keyElement.detach();}dom.writeToFile(file, false);} else if (file.getName().startsWith("PullRequests.xml")) {diff --git a/server-core/src/main/java/io/onedev/server/model/Project.java b/server-core/src/main/java/io/onedev/server/model/Project.javaindex 72c059563b..32d569801f 100644--- a/server-core/src/main/java/io/onedev/server/model/Project.java+++ b/server-core/src/main/java/io/onedev/server/model/Project.java@@ -158,10 +158,6 @@ public class Project extends AbstractEntity implements LabelSupport<ProjectLabelpublic static final String PROP_SERVICE_DESK_NAME = "serviceDeskName";public static final String PROP_PENDING_DELETE = "pendingDelete";-- public static final String NULL_KEY_PREFIX = "<$NullKey$>";-- public static final String NULL_SERVICE_DESK_PREFIX = "<$NullServiceDesk$>";private static final String FAKED_GITHUB_REPO_PATH_SEPARATOR = "-path.separator.of.onedev.project-";@@ -231,8 +227,8 @@ public class Project extends AbstractEntity implements LabelSupport<ProjectLabel// SQL Server does not allow duplicate null values for unique column. So we use// special prefix to indicate null@JsonIgnore- @Column(unique=true, nullable=false)- private String key = NULL_KEY_PREFIX + UUID.randomUUID();+ @Column(unique=true)+ private String key;@Column(length=MAX_DESCRIPTION_LEN)@Api(description = "May be null")@@ -359,8 +355,8 @@ public class Project extends AbstractEntity implements LabelSupport<ProjectLabel// SQL Server does not allow duplicate null values for unique column. So we use// special prefix to indicate null- @Column(unique=true, nullable=false)- private String serviceDeskName = NULL_SERVICE_DESK_PREFIX + UUID.randomUUID();+ @Column(unique=true)+ private String serviceDeskName;@JsonIgnore@Lob@@ -447,17 +443,11 @@ public class Project extends AbstractEntity implements LabelSupport<ProjectLabel@ProjectKey@Nullablepublic String getKey() {- if (key.startsWith(NULL_KEY_PREFIX))- return null;- else- return key;+ return key;}public void setKey(@Nullable String key) {- if (key != null)- this.key = key;- else if (!this.key.startsWith(NULL_KEY_PREFIX))- this.key = NULL_KEY_PREFIX + UUID.randomUUID();+ this.key = key;}public String getPath() {@@ -1054,17 +1044,11 @@ public class Project extends AbstractEntity implements LabelSupport<ProjectLabel@Nullable@JsonPropertypublic String getServiceDeskName() {- if (serviceDeskName.startsWith(NULL_SERVICE_DESK_PREFIX))- return null;- else- return serviceDeskName;+ return serviceDeskName;}public void setServiceDeskName(@Nullable String serviceDeskName) {- if (serviceDeskName != null)- this.serviceDeskName = serviceDeskName;- else if (!this.serviceDeskName.startsWith(NULL_SERVICE_DESK_PREFIX))- this.serviceDeskName = NULL_SERVICE_DESK_PREFIX + UUID.randomUUID();+ this.serviceDeskName = serviceDeskName;}public GitPackConfig getGitPackConfig() {diff --git a/server-core/src/main/java/io/onedev/server/search/entity/project/KeyCriteria.java b/server-core/src/main/java/io/onedev/server/search/entity/project/KeyCriteria.javaindex 0602d65e83..8928671eaf 100644--- a/server-core/src/main/java/io/onedev/server/search/entity/project/KeyCriteria.java+++ b/server-core/src/main/java/io/onedev/server/search/entity/project/KeyCriteria.java@@ -22,9 +22,7 @@ public class KeyCriteria extends Criteria<Project> {@Overridepublic Predicate getPredicate(CriteriaQuery<?> query, From<Project, Project> from, CriteriaBuilder builder) {Path<String> attribute = from.get(Project.PROP_KEY);- var predicate = builder.and(- builder.like(attribute, value.replace("*", "%")),- builder.not(builder.like(attribute, Project.NULL_KEY_PREFIX + "%")));+ var predicate = builder.like(attribute, value.replace("*", "%"));if (operator == ProjectQueryLexer.IsNot)predicate = builder.not(predicate);return predicate;diff --git a/server-core/src/main/java/io/onedev/server/search/entity/project/ServiceDeskNameCriteria.java b/server-core/src/main/java/io/onedev/server/search/entity/project/ServiceDeskNameCriteria.javaindex bdaa62d34c..b6480a4849 100644--- a/server-core/src/main/java/io/onedev/server/search/entity/project/ServiceDeskNameCriteria.java+++ b/server-core/src/main/java/io/onedev/server/search/entity/project/ServiceDeskNameCriteria.java@@ -1,14 +1,10 @@package io.onedev.server.search.entity.project;-import javax.persistence.criteria.CriteriaBuilder;-import javax.persistence.criteria.CriteriaQuery;-import javax.persistence.criteria.From;-import javax.persistence.criteria.Path;-import javax.persistence.criteria.Predicate;-+import io.onedev.commons.utils.match.WildcardUtils;import io.onedev.server.model.Project;import io.onedev.server.util.criteria.Criteria;-import io.onedev.commons.utils.match.WildcardUtils;++import javax.persistence.criteria.*;public class ServiceDeskNameCriteria extends Criteria<Project> {@@ -26,9 +22,7 @@ public class ServiceDeskNameCriteria extends Criteria<Project> {@Overridepublic Predicate getPredicate(CriteriaQuery<?> query, From<Project, Project> from, CriteriaBuilder builder) {Path<String> attribute = from.get(Project.PROP_SERVICE_DESK_NAME);- var predicate = builder.and(- builder.like(builder.lower(attribute), value.toLowerCase().replace("*", "%")),- builder.not(builder.like(attribute, Project.NULL_SERVICE_DESK_PREFIX + "%")));+ var predicate = builder.like(builder.lower(attribute), value.toLowerCase().replace("*", "%"));if (operator == ProjectQueryLexer.IsNot)predicate = builder.not(predicate);return predicate;diff --git a/server-product/system/3rdparty-licenses/sqljdbc-license.txt b/server-product/system/3rdparty-licenses/sqljdbc-license.txtdeleted file mode 100644index 0520348a65..0000000000--- a/server-product/system/3rdparty-licenses/sqljdbc-license.txt+++ /dev/null@@ -1,169 +0,0 @@-MICROSOFT SOFTWARE LICENSE TERMS--MICROSOFT JDBC DRIVER 6.0 FOR SQL SERVER--These license terms are an agreement between Microsoft Corporation (or based on where you-live, one of its affiliates) and you. Please read them. They apply to the software-named above, which includes the media on which you received it, if any. The terms also apply to-any Microsoft--? updates,-? supplements,-? Internet-based services, and-? support services--for this software, unless other terms accompany those items. If so, those terms apply.--BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT-ACCEPT THEM, DO NOT USE THE SOFTWARE.--If you comply with these license terms, you have the rights below.--1. INSTALLATION AND USE RIGHTS.--a. Installation and Use.--i. You may install and use any number of copies of the software on your devices.--b. Third Party Programs. The software may include third party programs that Microsoft,-not the third party, licenses to you under this agreement. Notices, if any, for the third-party program are included for your information only.--2. ADDITIONAL LICENSING REQUIREMENTS AND/OR USE RIGHTS.--a. Distributable Code.--i. Right to Use and Distribute. You are permitted to distribute the software in programs you-develop if you comply with the terms below:--* You may copy and distribute the object code form of the software (�Distributable Code?) in-programs you develop. You may not modify the software.-* You may permit distributors of your programs to copy and distribute the Distributable Code-as part of those programs.-ii. Distribution Requirements. For any Distributable Code you distribute, you must-* add significant primary functionality to it in your programs;-* require distributors and external end users to agree to terms that protect it at least as-much as this agreement;-* display your valid copyright notice on your programs; and-* indemnify, defend, and hold harmless Microsoft from any claims, including attorneys? fees,-related to the distribution or use of your programs.-iii. Distribution Restrictions. You may not-* alter any copyright, trademark or patent notice in the Distributable Code;-* use Microsoft�s trademarks in your programs? names or in a way that suggests your programs-come from or are endorsed by Microsoft;-* include Distributable Code in malicious, deceptive or unlawful programs; or-* modify or distribute the source code of any Distributable Code so that any part of it-becomes subject to an Excluded License. An Excluded License is one that requires, as a-condition of use, modification or distribution, that-* the code be disclosed or distributed in source code form; or-* others have the right to modify it.---3. SCOPE OF LICENSE. The software is licensed, not sold. This agreement only gives you-some rights to use the software. Microsoft reserves all other rights. Unless applicable law-gives you more rights despite this limitation, you may use the software only as expressly-permitted in this agreement. In doing so, you must comply with any technical limitations in-the software that only allow you to use it in certain ways. You may not--? work around any technical limitations in the software;-? reverse engineer, decompile or disassemble the software, except and only to the extent-that applicable law expressly permits, despite this limitation;-? make more copies of the software than specified in this agreement or allowed by-applicable law, despite this limitation;-? publish the software for others to copy;-? rent, lease or lend the software;-? transfer the software or this agreement to any third party; or-? use the software for commercial software hosting services.--4. EXPORT RESTRICTIONS. The software is subject to United States export laws and-regulations. You must comply with all domestic and international export laws and-regulations that apply to the software. These laws include restrictions on destinations, end-users and end use. For additional information, see www.microsoft.com/exporting.--5. SUPPORT SERVICES. Because this software is �as is,? we may not provide support-services for it.--6. ENTIRE AGREEMENT. This agreement, and the terms for supplements, updates, Internet--based services and support services that you use, are the entire agreement for the software-and support services.--7. APPLICABLE LAW.--a. United States. If you acquired the software in the United States, Washington state law-governs the interpretation of this agreement and applies to claims for breach of it,-regardless of conflict of laws principles. The laws of the state where you live govern all-other claims, including claims under state consumer protection laws, unfair competition-laws, and in tort.--b. Outside the United States. If you acquired the software in any other country, the laws of-that country apply.--8. LEGAL EFFECT. This agreement describes certain legal rights. You may have other rights-under the laws of your country. You may also have rights with respect to the party from-whom you acquired the software. This agreement does not change your rights under the laws-of your country if the laws of your country do not permit it to do so.--9. DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED �AS-IS.? YOU-BEAR THE RISK OF USING IT. MICROSOFT GIVES NO EXPRESS-WARRANTIES, GUARANTEES OR CONDITIONS. YOU MAY HAVE-ADDITIONAL CONSUMER RIGHTS UNDER YOUR LOCAL LAWS WHICH THIS-AGREEMENT CANNOT CHANGE. TO THE EXTENT PERMITTED UNDER-YOUR LOCAL LAWS, MICROSOFT EXCLUDES THE IMPLIED WARRANTIES-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON--INFRINGEMENT.--10. LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. YOU CAN-RECOVER FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP-TO U.S. $5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING-CONSEQUENTIAL, LOST PROFITS, SPECIAL, INDIRECT OR INCIDENTAL-DAMAGES.--This limitation applies to--? anything related to the software, services, content (including code) on third party Internet-sites, or third party programs, and-? claims for breach of contract, breach of warranty, guarantee or condition, strict liability,-negligence, or other tort to the extent permitted by applicable law.--It also applies even if Microsoft knew or should have known about the possibility of the-damages. The above limitation or exclusion may not apply to you because your country may-not allow the exclusion or limitation of incidental, consequential or other damages.--Please note: As this software is distributed in Quebec, Canada, some of the clauses in this-agreement are provided below in French.--Remarque : Ce logiciel �tant distribu? au Qu�bec, Canada, certaines des clauses dans ce-contrat sont fournies ci-dessous en fran�ais.--EXON�RATION DE GARANTIE. Le logiciel vis? par une licence est offert ? tel quel ?.-Toute utilisation de ce logiciel est ? votre seule risque et p�ril. Microsoft n�accorde aucune-autre garantie expresse. Vous pouvez b�n�ficier de droits additionnels en vertu du droit local-sur la protection des consommateurs, que ce contrat ne peut modifier. La ou elles sont-permises par le droit locale, les garanties implicites de qualit? marchande, d�ad�quation ? un-usage particulier et d�absence de contrefa�on sont exclues.--LIMITATION DES DOMMAGES-INT�R�TS ET EXCLUSION DE-RESPONSABILIT? POUR LES DOMMAGES. Vous pouvez obtenir de Microsoft et de-ses fournisseurs une indemnisation en cas de dommages directs uniquement ? hauteur de 5,00-$ US. Vous ne pouvez pr�tendre ? aucune indemnisation pour les autres dommages, y-compris les dommages sp�ciaux, indirects ou accessoires et pertes de b�n�fices.--Cette limitation concerne :-? tout ce qui est reli? au logiciel, aux services ou au contenu (y compris le code) figurant-sur des sites Internet tiers ou dans des programmes tiers ; et-? les r�clamations au titre de violation de contrat ou de garantie, ou au titre de-responsabilit? stricte, de n�gligence ou d�une autre faute dans la limite autoris�e par la loi-en vigueur.--Elle s�applique �galement, m�me si Microsoft connaissait ou devrait conna�tre l��ventualit?-d�un tel dommage. Si votre pays n�autorise pas l�exclusion ou la limitation de responsabilit?-pour les dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la-limitation ou l�exclusion ci-dessus ne s�appliquera pas ? votre �gard.--EFFET JURIDIQUE. Le pr�sent contrat d�crit certains droits juridiques. Vous pourriez avoir-d�autres droits pr�vus par les lois de votre pays. Le pr�sent contrat ne modifie pas les droits-que vous conf�rent les lois de votre pays si celles-ci ne le permettent pas.----diff --git a/server-product/system/incompatibilities/incompatibilities.md b/server-product/system/incompatibilities/incompatibilities.mdindex 967c975abb..82cd8aef8c 100644--- a/server-product/system/incompatibilities/incompatibilities.md+++ b/server-product/system/incompatibilities/incompatibilities.md@@ -1,3 +1,8 @@+# 11.6.0++SQL Server support is removed due to added complexity and inability to test with full version.+If you are using SQL Server, please [switch to use MySQL/PostgreSQL/MariaDB](https://docs.onedev.io/administration-guide/switch-database)+# 11.5.0Guest concept is removed as administrator can create read-only roles achieving same purpose.diff --git a/server-product/system/site/lib/mssql-jdbc-7.4.1.jre8.jar b/server-product/system/site/lib/mssql-jdbc-7.4.1.jre8.jardeleted file mode 100644index 20ed6cb86c..0000000000Binary files a/server-product/system/site/lib/mssql-jdbc-7.4.1.jre8.jar and /dev/null differ