Remove database table packages_composer_cache_files

What does this MR do and why?

This is the second MR that finalizes the cleanup of composer cache files and removes the database table packages_composer_cache_files. The first MR !166344 (merged) removed the application code.

  • Remove foreign key in packages_composer_cache_files table.
  • Remove packages_composer_cache_files table.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Database migration output

Migration 🔼

➜  gitlab git:(461786-delete-dat...) ✗ rails db:migrate:main
main: == [advisory_lock_connection] object_id: 129940, pg_backend_pid: 62232
main: == 20241021184923 RemovingForeignKeyPackagesComposerCacheFiles: migrating =====
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- remove_foreign_key(:packages_composer_cache_files, :namespaces, {:name=>:fk_rails_b82cea43a0})
main:    -> 0.0058s
main: == 20241021184923 RemovingForeignKeyPackagesComposerCacheFiles: migrated (0.1112s) 

main: == 20241021185053 DropPackagesComposerCacheFilesTable: migrating ==============
main: -- drop_table(:packages_composer_cache_files)
main:    -> 0.0033s
main: == 20241021185053 DropPackagesComposerCacheFilesTable: migrated (0.0071s) =====

main: == [advisory_lock_connection] object_id: 129940, pg_backend_pid: 62232

Migration 🔽

$ rails db:migrate:down:main VERSION=20241021185053
main: == [advisory_lock_connection] object_id: 129660, pg_backend_pid: 24935
main: == 20241021185053 DropPackagesComposerCacheFilesTable: reverting ==============
main: -- create_table(:packages_composer_cache_files)
main: -- quote_column_name(:file)
main:    -> 0.0000s
main:    -> 0.0225s
main: == 20241021185053 DropPackagesComposerCacheFilesTable: reverted (0.0520s) =====

main: == [advisory_lock_connection] object_id: 129660, pg_backend_pid: 24935

$ rails db:migrate:down:main VERSION=20241021184923
main: == [advisory_lock_connection] object_id: 129660, pg_backend_pid: 78590
main: == 20241021184923 RemovingForeignKeyPackagesComposerCacheFiles: reverting =====
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- execute("ALTER TABLE packages_composer_cache_files ADD CONSTRAINT fk_rails_b82cea43a0 FOREIGN KEY (namespace_id) REFERENCES namespaces (id) ON DELETE SET NULL NOT VALID;")
main:    -> 0.0053s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0007s
main: -- execute("ALTER TABLE packages_composer_cache_files VALIDATE CONSTRAINT fk_rails_b82cea43a0;")
main:    -> 0.0199s
main: -- execute("RESET statement_timeout")
main:    -> 0.0005s
main: == 20241021184923 RemovingForeignKeyPackagesComposerCacheFiles: reverted (0.1143s) 

main: == [advisory_lock_connection] object_id: 129660, pg_backend_pid: 78590

Screenshots or screen recordings

Screenshot_2024-10-22_at_09.01.14

How to set up and validate locally

  1. Execute the migrations: $ rails db:migrate:main

  2. Start psql: $ gdk psql

  3. Verify that the table packages_composer_cache_files doesn't exist anymore: \d packages_composer_cache_files;

Related to #461786 (closed)

Edited by Dzmitry (Dima) Meshcharakou

Merge request reports

Loading