core icon indicating copy to clipboard operation
core copied to clipboard

[core] : Table constraints added via Upgrade Task not present in MS SQL startup script

Open jcastro-dotcms opened this issue 9 years ago • 2 comments

Database constraints being added through the Upgrade Task called `Task03605FixMSSQLMissingConstraints are not present in the mssql.sql` script file.

NOTE: Based on the Upgrade Task's name, we're assuming this change is required by SQL Server DBs only. However, please check with R&D if these constraints are required in other DB's as well, such as MySQL.

Expected Behavior

SQL queries that are executed through an Upgrade Task must be present in the startup SQL Server script so that a new dotCMS install will have them.

Current Behavior

The constraints are not present in a clean dotCMS install.

Possible Solution

Modify the `mssql.sql` file and include the missing constraints. Make sure that the other queries in the Upgrade Task are also present in the script.

Known Workarounds

Provide the queries to customers when required.

Steps to Reproduce

Just make sure that the constraints and other queries in the Upgrade Task are also present in the SQL Server script. This means that a new dotCMS DB should be the same as an upgraded DB.

Context

This issue was found when working on an issue reported by a customer: https://my.dotcms.com/tickets/detail.dot?id=e8aae051-ee20-45c1-8b5c-04d778a54161

This can cause problems to customers in the future as the constraints were ONLY created when upgrading from a previous dotCMS version. Customers with a brand new dotCMS instance starting version 3.7.1 will not have these constraints. Such constraints are meant to improve content handling process when using workflows.

Your Environment

  • dotCMS version used: 3.7.1 and up
  • Browser Name and version: Not relevant.
  • Operating System and version: Not relevant.
  • Application Server and version: Not relevant.
  • Java Brand and version: Not relevant.
  • Database and version: MS SQL Server
  • Application module (if apply): dotCMS Startup Process (running Upgrade Tasks).

jcastro-dotcms avatar Jul 31 '17 16:07 jcastro-dotcms

PR: https://github.com/dotCMS/core/pull/12404

erickgonzalez avatar Aug 23 '17 18:08 erickgonzalez

Passed QA. Verified that Upgrade Task Task03605FixMSSQLMissingConstraints is present on SQL Server script after fresh dotcms startup and after upgrade with client DB (dotcms 3.5.1). Running a sql query over db_version table (select * from db_version) confirms that task 3605 is executed and present. As of now the last task listed is 4115. Win7 Pro SP1 / SQLServer 2012 / Chrome v54.0.2840.98 / Tomcat 8 / Java 8

shaydotcms avatar Sep 06 '17 17:09 shaydotcms