Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLite database init fails with 'An Error Occurred Creating Site. An error occurred while saving the entity changes. See the inner exception for details.' #2584

Closed
markdav-is opened this issue Feb 7, 2023 · 3 comments

Comments

@markdav-is
Copy link
Contributor

markdav-is commented Feb 7, 2023

When pulling master for v3.3.1 and running the startup screen in the SQLite configuration it stops after a few moments with the error "An Error Occurred Creating Site. An error occurred while saving the entity changes. See the inner exception for details." no additional details are captured in the logs.

image

@sbwalker
Copy link
Member

sbwalker commented Feb 7, 2023

Thank you for reporting this issue... it turns out that this is a bit tricky. In version 3.2.2 migrations were introduced to remove the DeletedBy, DeletedOn, and IsDeleted columns from the Folder and File tables (as these columns were never used). However SQLite does not support the ability to drop columns - so the migration executes fine but does not remove the columns from the tables in the database. And then the system tries to create some folder records during install and it fails because the IsDeleted column has a NOT NULL constraint. I am going to have to investigate if there is a way to remove the constraint so that this works on SQLite. Multi-database support is a real challenge based on the fact that not all database engines support the same basic operations.

@sbwalker
Copy link
Member

sbwalker commented Feb 7, 2023

There is no ability to alter a column in SQLite either... so no ability to change the constraint. Which basically only allows for 2 options:

  1. Add the IsDeleted properties back to the Folder and File entities and identify them as deprecated. The IsDeleted property will still need to be explicitly set to avoid the SQLite error during insert - even though the property is meaningless to the rest of the framework.
  2. Remove the deprecated properties from the EntityBuilders. This will ensure they are never added on a new install. However this will not resolve the issue for users that are already running on SQLite and want to upgrade to a later version of Oqtane.

Option 1 is the better approach so that Oqtane can meet its upgradeability philosophy. In the future this essentially means that properties should never be physically removed from database entities if they are not nullable.

sbwalker added a commit that referenced this issue Feb 8, 2023
fix #2584 - added IsDeleted columns back to Folder and File tables to preserve compatibility for SQLite
@markdav-is
Copy link
Contributor Author

thanks for addressing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants