-
-
Notifications
You must be signed in to change notification settings - Fork 296
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 support #45
Merged
Merged
SQLite support #45
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This keeps queries similar to schema.sql, and ensures log statements are correct when running --init-db
Part of T529
A quick test with ApacheBench revealed that SQLite really can't handle multiple concurrent requests with the default settings, due to a locked database. This fixes that by following the suggestions here: https://github.com/mattn/go-sqlite3#faq Testing with ab -n 100 -c 5 http://localhost:8080/blog/post shows that this fixes the issue. But we could improve performance by reducing writes, like what's mentioned in T545. Part of T529
The formatted string was invalid before, causing date parsing to fail. This fixes that. Ref T529
We store times in UTC in all other places, but the post.Created logic when creating a post meant that dates were being stored in a user's local timezone. This fixes that. Ref T529
This extracts the LEFT/SUBSTR logic into its own datastore.clip() method that also works correctly with SQLite. Ref T529
Ref T529
The field is currently unused in the app, and it was causing problems in SQLite. Ref T529
Running consistently over the weekend and haven't found any other issues. Still considering this "beta" functionality until it's more widely tested, but I think it's good enough to merge now. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds support for data storage in SQLite, instead of MySQL. [Phabricator discussion here]
[database] type
config value:sqlite3
[database] filename
- determines the name of the SQLite database file (default:writefreely.db
)database.go
for handling differences between MySQL and SQLitesqlite.sql
file with SQLite-specific queries, bundled with all distributionsThese changes also lay the groundwork for future support of other datastores, like PostgreSQL.
Everything worked well in my testing, but I'd like to get more people trying it out and seeing if anything breaks. Also, special thanks to @BenOvermyer for all the up-front work on this!