Commit graph

8 commits

Author SHA1 Message Date
dce6c6bbf0
Move aggregates to replaceable_schema, fix error (fixes #5186) (#5190)
* Move aggregates to replaceable_schema, fix error (fixes #5186)

* fmt

* r prefix
2024-11-12 12:03:30 -05:00
dullbananas
2e8687e203
Combine action tables (#4459)
* Update comment_report_view.rs

* Update comment_report_view.rs

* Update post_view.rs

* Update utils.rs

* Update schema.rs

* stuff

* stuff

* fix actions

* PostLike

* fmt

* more post stuff (partial)

* remove uplete

* returning

* rename read_comments field

* PersonPostAggregates

* a

* fix usage of read_comments_amount

* comment

* community

* community_block

* instance_block

* LocalUser::export_backup

* person_block

* person

* stuff (partial)

* update cargo.lock

* fix lemmy_db_schema

* post_view

* comment_report_view

* comment_view

* post_report_view

* find and replace some selected values

* private_message_view

* vote_view

* comment_reply_view

* some action views

* action_query, find_action

* community_view

* block views

* person_mention_view

* remove struct update

* refactor actions function

* actions_alias

* clean up return types and trait bounds

* fix all rust code

* fmt

* clippy fix

* Migrate tables

* migrate indexes and contraints, and add statistics

* fix what appears to be a messed up merge

* commented thing

* Create uplete.rs

* Update uplete.rs

* Update uplete.rs

* Update up.sql

* Update comment.rs

* Update Cargo.toml

* Update comment.rs

* Update post.rs

* Update comment_view.rs

* Update post_view.rs

* Update comment_reply_view.rs

* Update person_mention_view.rs

* Update Cargo.toml

* Update utils.rs

* Update comment.rs

* Update utils.rs

* Update uplete.rs

* Update uplete.rs

* Update uplete.rs

* Update comment.rs

* Update uplete.rs

* Update uplete.rs

* Update uplete.rs

* Update uplete.rs

* Update uplete.rs

* Update uplete.rs

* Update comment_view.rs

* Update post_view.rs

* Update triggers.sql

* Update triggers.sql

* Update triggers.sql

* Update comment_reply_view.rs

* Update person_mention_view.rs

* Update person_mention_view.rs

* Update comment_reply_view.rs

* Update uplete.rs

* start removing post_id column

* Update down.sql

* Update schema.rs

* Update comment.rs

* Update comment.rs

* Update comment.rs

* Update schema.rs

* Update comment.rs

* Update like.rs

* Update comment.rs

* Update up.sql

* Update down.sql

* Update down.sql

* Update up.sql

* Update up.sql

* Update down.sql

* Update comment.rs

* Update vote_view.rs

* Update vote_view.rs

* Update comment_aggregates.rs

* Update person_aggregates.rs

* Update comment_view.rs

* Update vote_view.rs

* Update mod.rs

* Update create.rs

* Update comment.rs

* Update community.rs

* Update community.rs

* Update up.sql

* Update uplete.rs

* Update uplete.rs

* revert to UpleteCount

* Update comment.rs

* Update traits.rs

* Update comment.rs

* Update community.rs

* Update community_block.rs

* Update community.rs

* Update instance_block.rs

* Update instance.rs

* Update community_block.rs

* Update person.rs

* Update person_block.rs

* Update person.rs

* Update person_block.rs

* Update person.rs

* Update instance.rs

* Update instance_block.rs

* Update instance.rs

* Update person.rs

* Update post.rs

* Update comment.rs

* Update community.rs

* Update person.rs

* Update post_view.rs

* Update comment.rs

* reduce diff

* revert some changes in views

* Update post_view.rs

* Update comment.rs

* Update post.rs

* fix missing cfg_attr

* rewrite uplete

* Update Cargo.toml

* Update Cargo.toml

* Update uplete.rs

* add `pub` to structs that appear in trait bounds

* optional = true

* Update uplete.rs

* Update community.rs

* Update comment.rs

* Update uplete.rs

* Update uplete.rs

* Update uplete.rs

* Update uplete.rs

* something is wrong with me

* use new uplete function everywhere

* fmt

* fmt

* Keep post_id when comment_actions::liked is not null

* Update up.sql

* Update up.sql

* clean up up.sql

* clean up down.sql

* fix

* Update person_aggregates.rs

* fmt

* Update uplete.rs

* fmt

* Update uplete.rs

* Update community.rs

* Update uplete.rs

* Update local_user.rs

* fmt

* fix

* fix

* fmt

* improve uplete api

* Update uplete.rs

* fix

* fix

* Update uplete.rs

* Update uplete.rs

* Update uplete.rs

* Update uplete.rs

* fix

* fix test

* fix db_views_actor imports

* fix uplete import in post_view test

* rerun ci

* fix AllNull syntax error

* fix DynColumn

* Fix rust syntax

* fmt

* fix iter

* pain

* Update community_moderators.rs

* Update community_moderator_view.rs

* Update uplete.rs

* Fix mistake found by chatgpt

* revert debugging stuff, change migration date, refactor constraint

* Update down.sql

* Update down.sql

* fmt

* make things added to db_schema::utils more understandable

* update rust version for woodpecker

* finish merge

* Fix index that checked read_comments twice instead of also checking read_comments_amount

* fix

* uplete: test_count, test_generated_sql_setting_one_column_null, test_count_methods

* refactor uplete sql test

* test setting both columns to null in uplete

* make AllNull generic

* test AllNull

* Merge remote-tracking branch 'upstream/main' into smoosh-tables-together

---------

Co-authored-by: phiresky <phireskyde+git@gmail.com>
2024-11-11 11:34:10 +01:00
dullbananas
78702b59fd
Use trigger to generate apub URL in insert instead of update, and fix query planner options not being set when TLS is disabled (#4797)
* Update create.rs

* Update utils.rs

* Update utils.sql

* Update triggers.sql

* Update utils.sql

* Update create.rs

* Update create.rs

* Update create.rs

* Update create.rs

* Update create.rs

* Update create.rs

* Update create.rs

* Update create.rs

* Create up.sql

* Update up.sql

* Update triggers.sql

* Update utils.rs

* stuff

* stuff

* revert some changed files

* Revert "revert some changed files"

This reverts commit 028eabb4bd.

* revert the correct files

* partial reverts

* migration, tests, fix establish_connection

* lint

* pg_format
2024-07-02 11:23:21 -04:00
dullbananas
fd58b4f809
Exponential controversy rank (#4872)
* Update utils.sql

* add migration
2024-07-02 09:40:18 -04:00
dullbananas
42a6d8ab0f
Fix not-equals check in post aggregates update trigger (#4837)
* Fix not-equals check in post aggregates update trigger

Should fix #4836

* Create up.sql

* Create down.sql

* Update down.sql
2024-06-17 15:25:54 -04:00
dullbananas
1e11faf741
Improve comment in triggers.sql (#4789)
* Clarified existing info
* Added prohibition of inconsistent update order
2024-06-07 07:42:34 -04:00
dullbananas
c4fc3a8ede
Optimize stuff in attempt to fix high amount of locks, and fix comment_aggregates.child_count (#4696)
* separate triggers

* auto_explain.log_triggers=on

* Revert "auto_explain.log_triggers=on"

This reverts commit 078b2dbb9b.

* Revert "separate triggers"

This reverts commit 95600da4af.

* bring back migration

* re-order statements

* add comment about statement ordering

* no redundant updates

* optimize post_aggregates update in comment trigger

* set comment path in trigger

* update comment_aggregates.child_count using trigger

* move `LEFT JOIN post` to inner query

* clean up newest_comment_time_necro

* add down.sql
2024-05-09 08:18:55 -04:00
dullbananas
4ba6221e04
Move SQL triggers from migrations into reusable sql file (#4333)
* stuff

* stuff including batch_upsert function

* stuff

* do things

* stuff

* different timestamps

* stuff

* Revert changes to comment.rs

* Update comment.rs

* Update comment.rs

* Update post_view.rs

* Update utils.rs

* Update up.sql

* Update up.sql

* Update down.sql

* Update up.sql

* Update main.rs

* use anyhow macro

* Create down.sql

* Create up.sql

* Create replaceable_schema.sql

* Update replaceable_schema.sql

* Update replaceable_schema.sql

* Update replaceable_schema.sql

* Update utils.rs

* Update .woodpecker.yml

* Update sql_format_check.sh

* Update replaceable_schema.sql

* Update replaceable_schema.sql

* Update replaceable_schema.sql

* Update replaceable_schema.sql

* Update replaceable_schema.sql

* Update replaceable_schema.sql

* Update replaceable_schema.sql

* Create dump_schema.sh

* Update start_dev_db.sh

* Update replaceable_schema.sql

* Update replaceable_schema.sql

* Update replaceable_schema.sql

* Update replaceable_schema.sql

* Update replaceable_schema.sql

* Update replaceable_schema.sql

* Update replaceable_schema.sql

* Update replaceable_schema.sql

* Update replaceable_schema.sql

* Update replaceable_schema.sql

* Update replaceable_schema.sql

* stuff

* Update replaceable_schema.sql

* Update .pg_format

* fmt

* stuff

* stuff (#21)

* Update replaceable_schema.sql

* Update up.sql

* Update replaceable_schema.sql

* fmt

* update cargo.lock

* stuff

* Update replaceable_schema.sql

* Remove truncate trigger because truncate is already restricted by foreign keys

* Update replaceable_schema.sql

* fix some things

* Update replaceable_schema.sql

* Update replaceable_schema.sql

* Update .woodpecker.yml

* stuff

* fix TG_OP

* Psql env vars

* try to fix combine_transition_tables parse error

* Revert "try to fix combine_transition_tables parse error"

This reverts commit 75d00a4626.

* refactor combine_transition_tables

* try to fix create_triggers

* fix some things

* try to fix combined_transition_tables

* fix sql errors

* update comment count in post trigger

* fmt

* Revert "fmt"

This reverts commit a5bcd0834b.

* Revert "update comment count in post trigger"

This reverts commit 0066a4b42b.

* fix everything

* Update replaceable_schema.sql

* actually fix everything

* refactor create_triggers

* fix

* add semicolons

* add is_counted function and fix incorrect bool operator in update_comment_count_from_post

* refactor comment trigger

* refactor post trigger

* fix

* Delete crates/db_schema/src/utils/series.rs

* subscribers_local

* edit migrations

* move migrations

* remove utils::series module declaration

* fix everything

* stuff

* Move sql to schema_setup dir

* utils.sql

* delete .pg_format

* Update .woodpecker.yml

* Update sql_format_check.sh

* Update .woodpecker.yml

* Merge remote-tracking branch 'upstream/main' into bliss

* fmt

* Create main.rs

* Update lib.rs

* Update main.rs

* Update .woodpecker.yml

* Update main.rs

* Update Cargo.toml

* Update .woodpecker.yml

* Update .woodpecker.yml

* Update triggers.sql

* YAY

* Update mod.rs

* Update Cargo.toml

* a

* Update Cargo.toml

* Update Cargo.toml

* Delete crates/db_schema/src/main.rs

* Update Cargo.toml

* Update .woodpecker.yml

* Update .woodpecker.yml

* Update .woodpecker.yml

* Update .woodpecker.yml

* Update .woodpecker.yml

* Update .woodpecker.yml

* Update .woodpecker.yml

* Update utils.sql

* Update utils.sql

* Update .woodpecker.yml

* Update .woodpecker.yml

* Update .woodpecker.yml

* Update .woodpecker.yml

* Update .woodpecker.yml

* Update down.sql

* Update up.sql

* Update triggers.sql

* Update .woodpecker.yml

* Update .woodpecker.yml

* Update triggers.sql

* Update down.sql

* Update .woodpecker.yml

* Update Cargo.toml

* Update .woodpecker.yml

* Update Cargo.toml

* Update .woodpecker.yml

* Update .woodpecker.yml

* Update .woodpecker.yml

* Update .woodpecker.yml

* Update .woodpecker.yml

* Update .woodpecker.yml

* Update .woodpecker.yml

* Update .woodpecker.yml

* Update .woodpecker.yml

* Update .woodpecker.yml

* Update .woodpecker.yml

* Update .woodpecker.yml

* Update .woodpecker.yml

* Update .woodpecker.yml

* Update .woodpecker.yml

* Update mod.rs

* Update Cargo.toml

* Update mod.rs

* make dump_schema.sh executable

* fix dump_schema.sh

* defer

* diff dumps

* fmt

* Update utils.sql

* Update .woodpecker.yml

* use correct version for pg_dump

* Update .woodpecker.yml

* Update .woodpecker.yml

* change migration date

* atomic site_aggregates insert

* temporarily repeat tests in CI

* drop r schema in CI migration check

* show ReceivedActivity::create error

* move check_diesel_migration CI step

* Update .woodpecker.yml

* Update scheduled_tasks.rs

* Update scheduled_tasks.rs

* update cargo.lock

* move sql files

* move rank functions

* filter post_aggregates update

* fmt

* cargo fmt

* replace post_id with id

* update cargo.lock

* avoid locking rows that need no change in up.sql

* only run replaceable_schema if migrations were run

* debug ci test failure

* make replaceable_schema work in CI

* Update .woodpecker.yml

* remove println

* Use migration revert and git checkout

* Update schema_setup.rs

* Fix

* Update schema_setup.rs

* Update schema_setup.rs

* Update .woodpecker.yml

---------

Co-authored-by: Nutomic <me@nutomic.com>
Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
2024-04-17 20:58:44 -04:00