Commit graph

32 commits

Author SHA1 Message Date
Leonidas Spyropoulos
a54b6935a1
housekeep: reformat files with pre-hooks
Signed-off-by: Leonidas Spyropoulos <artafinde@archlinux.org>
2024-08-03 08:15:56 +01:00
Levente Polyak
4d5909256f
fix: add missing indicies on PackageBase ordered columns
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2024-08-03 04:45:31 +02:00
moson
c6a530f24f
chore(deps): bump pre-commit tools/libs
Prep for python 3.12
Reformat files with latest pre-commit tools

Signed-off-by: moson <moson@archlinux.org>
2024-04-25 07:25:39 +02:00
moson
d2d47254b4
housekeep: TU rename - Table/Column names, scripts
TU_VoteInfo -> VoteInfo
TU_Votes -> Votes
TU_VoteInfo.ActiveTUs -> VoteInfo.ActiveUsers

script: tuvotereminder -> votereminder
Signed-off-by: moson <moson@archlinux.org>
2023-09-30 16:45:05 +02:00
moson
1702075875
housekeep: TU rename - code changes
Renaming of symbols. Functions, variables, values, DB values, etc.
Basically everything that is not user-facing.

This only covers "Trusted User" things:
tests, comments, etc. will covered in a following commit.
2023-09-30 16:45:04 +02:00
moson-mo
7c8b9ba6bc
perf: add index to tweak our default search query
Adds an index on PackageBases.Popularity and PackageBases.Name to
improve performance of our default search query sorted by "Popularity"

Signed-off-by: moson-mo <mo-son@mailbox.org>
2023-07-02 13:55:21 +02:00
Leonidas Spyropoulos
6ede837b4f
feat: allow users to hide deleted comments
Closes: #435

Signed-off-by: Leonidas Spyropoulos <artafinde@archlinux.org>
2023-04-24 09:13:38 +01:00
Leonidas Spyropoulos
f10c1a0505
perf: add PackageKeywords.PackageBaseID index
This is used on the export for package-meta.v1.gz generation

Signed-off-by: Leonidas Spyropoulos <artafinde@archlinux.org>
2022-11-01 17:24:13 +00:00
Kevin Morris
30e72d2db5 feat: archive git repository (experimental)
See doc/git-archive.md for general Git archive specifications
See doc/repos/metadata-repo.md for info and direction related to the new Git metadata archive
2022-09-24 16:51:25 +00:00
Kevin Morris
b3853e01b8
fix(pre-commit): include migrations in fixes/checks
We want all python files related to the project to be checked, really.
Some of which are still included, but migrations are a core part of
FastAPI aurweb and should be included.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2022-09-11 18:07:54 -07:00
Joakim Saario
9c6c13b78a
style: Run pre-commit 2022-08-22 22:40:45 +02:00
Kevin Morris
6f7ac33166
Revert "feat(db): add an index for SSHPubKeys.PubKey (#2)"
This reverts commit 6c7e274968.

Once again, this does actually cause issues with foreign keys.
Removing it for now and will revisit this.
2022-08-13 23:28:31 -07:00
Kevin Morris
6c7e274968
feat(db): add an index for SSHPubKeys.PubKey (#2)
Speeds up SSHPubKeys.PubKey searches in a larger database.

Fixed form of the original commit which was reverted,
1a7f6e1fa9

Signed-off-by: Kevin Morris <kevr@0cost.org>
2022-08-13 19:52:50 -07:00
Kevin Morris
5abd5db313
Revert "feat(db): add an index for SSHPubKeys.PubKey"
This reverts commit 1a7f6e1fa9.

This commit broke account creation in some way. We'd still like to
do this, but we need to ensure it does not intrude on other facets.

Extra: We should really work out how this even passed tests; it
should not have.
2022-08-13 19:23:19 -07:00
Kevin Morris
1a7f6e1fa9
feat(db): add an index for SSHPubKeys.PubKey
Speeds up SSHPubKeys.PubKey searches in a larger database.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2022-08-12 22:26:26 -07:00
Kevin Morris
8387f325f6
fix: resolve null VoteTS columns via migration
Somehow, many aur.al records of PackageVotes do not have a valid VoteTS
value. This migration fixes that issue by setting all null VoteTS
columns to the epoch timestamp.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2022-02-18 16:16:07 -08:00
Kevin Morris
b5ff8581f3
feat(migrations): add upgrade_voteinfo_integers ref
This migration modifies the Yes, No, Abstain and ActiveTUs columns
of the TUVoteInfo table from unsigned TINYINT to unsigned INTEGER.

TINYINT supports a total of 1 byte (up to 255 trusted users). This
is quite limited and we don't spend too much more by storing a
standard 4-byte INTEGER.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2022-01-06 20:27:23 -08:00
Kevin Morris
fa43f6bc3e
change(aurweb): add parallel tests and improve aurweb.db
This change utilizes pytest-xdist to perform a multiproc test
run and reworks aurweb.db's code. We no longer use a global
engine, session or Session, but we now use a memo of engines
and sessions as they are requested, based on the PYTEST_CURRENT_TEST
environment variable, which is available during testing.

Additionally, this change strips several SQLite components
out of the Python code-base.

SQLite is still compatible with PHP and sharness tests, but
not with our FastAPI implementation.

More changes:
------------
- Remove use of aurweb.db.session global in other code.
- Use new aurweb.db.name() dynamic db name function in env.py.
- Added 'addopts' to pytest.ini which utilizes multiprocessing.
    - Highly recommended to leave this be or modify `-n auto` to
      `-n {cpu_threads}` where cpu_threads is at least 2.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-17 01:34:59 -08:00
Kevin Morris
ff3519ae11 [alembic] Log db name being used in a migration
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-06-25 22:33:30 -07:00
Kevin Morris
25937d9543 Merge branch 'master' into pu 2021-06-06 17:21:57 -07:00
Kevin Morris
f9f41dc99b restore TU_VoteInfo -> utf8mb4_general_ci
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-06-06 16:30:16 -07:00
Kevin Morris
5ceeb88bee remove unused imports, rectify isort violations
Files got into the branch that violate both PEP-8 guidelines
and isorts. This fixes them.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-06-05 21:27:39 -07:00
Kevin Morris
66189c4460 alembic: restore logging, fix pytest conflicts
In this case, when running pytests, we do not allow alembic to
configure loggers.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-06-05 19:52:56 -07:00
Kevin Morris
7c65604dad move off env.py's active code to __name__ == "__main__"
* Moved migrations/env.py's logging initialization and migration execution
  into a `__name__ == "__main__"` stanza so it doesn't immediately happen
  when imported by another module.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-06-05 19:50:51 -07:00
Kevin Morris
bac38edd48 [db] fix schema and migration for case insensitivity
Some of the columns that were changed still want to be
case insensitive. Good thing our tables have nice
separation.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-06-05 15:08:18 -07:00
Leonidas Spyropoulos
b1121dc6ca Adds Alembic migration for DB/Tables conversion to utf8mb4
MySql defaults to `utf8` and case insensitive collation so migrate these to case sensitive and `utf8mb4`

Closes #21

Signed-off-by: Leonidas Spyropoulos <artafinde@gmail.com>
2021-05-18 05:42:36 -07:00
Leonidas Spyropoulos
0d68b914bf Conditionally apply SSOAccountId migration to support misaligned databases
Closes: #34

Signed-off-by: Leonidas Spyropoulos <artafinde@gmail.com>
2021-05-18 05:42:36 -07:00
Kevin Morris
82f6d2ce75 alembic: fix ef39fcd6e1cd downgrade
op.drop_constraint requires a valid field to drop the constraint on.
Without this, downgrade cannot occur.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-05-18 05:42:36 -07:00
Frédéric Mangano-Tarumi
a5554c19a9 Add SSO account ID in table Users
This column holds a user ID issed by the single sign-on provider. For
Keycloak, it is an UUID. For more flexibility, we will be using a
standardly-sized VARCHAR field.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20 11:24:30 -05:00
Filipe Laíns
8d1be7ea8a Refactor code to comply with flake8 and isort
Signed-off-by: Filipe Laíns <lains@archlinux.org>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2021-02-20 11:24:30 -05:00
Frédéric Mangano-Tarumi
e4cbe264cf Create an initial Alembic migration
This way the database will get stamped, and Git will create the
`versions` directory without which Alembic won’t work.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-27 16:44:36 +01:00
Frédéric Mangano-Tarumi
a8a1f74a92 Set up Alembic for database migrations
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2020-02-27 16:44:36 +01:00