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

Database updates #144

Merged
merged 14 commits into from
Aug 20, 2021
Merged

Database updates #144

merged 14 commits into from
Aug 20, 2021

Conversation

tsmethurst
Copy link
Contributor

This PR reworks a lot of the database functionality and interface to make it more modular and more consistent, and to reduce code duplication.

It also updates a lot of the Postgres implementation of the DB interface to make better use of the ORM being used, and to implement caching of results for quicker serving of things like accounts, statuses etc. Using an in-memory cache reduces network usage, CPU usage (when ssl is enabled on postgres), and improves speed of object retrieval--when cached--by several orders of magnitude.

These changes will certainly impact on #122, since they change the database interface around a bunch. In the long run however the changes should make SQLite implementation a bit easier overall, since it can be implemented sub-interface by sub-interface.

Migration considerations

What to look out for when updating to this version from previous gts prerelease versions.

Non-breaking changes

In order to make all of the updates work, two new database tables were introduced: status_to_tag and status_to_emoji.

These will be automatically created when GtS is restarted with this new update, so no need to worry about them.

Breaking Changes!!!!

Due to an inconsistency in the way the tags table was previously implemented (now fixed), some manual postgres jiggery-pokery is required when updating.

To migrate to this version from a previous version, first stop gotosocial, then run the following PSQL queries against your gotosocial postgres database:

ALTER TABLE tags DROP CONSTRAINT tags_pkey;
ALTER TABLE tags ADD PRIMARY KEY (id);

Then start the new version of gotosocial :)

@tsmethurst tsmethurst merged commit 4920229 into main Aug 20, 2021
@tsmethurst tsmethurst deleted the database_updates branch August 20, 2021 10:27
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

Successfully merging this pull request may close these issues.

1 participant