Console commands
Part-DB provides some console commands to display various information or perform some tasks. The commands are invoked from the main directory of Part-DB with the command php bin/console [command] in the context of the web server user (so usually the webserver user), so you may have to use sudo or su to execute the commands:
sudo -u www-data php bin/console [command]
You can get help for every command with the parameter --help. See php bin/console for a list of all available commands.
If you are running Part-DB in a Docker container, you must either execute the commands from a shell inside the container, or use the docker exec command to execute the command directly inside the container. For example, if your Docker container is named partdb, you can execute the command php bin/console cache:clear with the following command:
docker exec --user=www-data partdb php bin/console cache:clear
If you run a root console inside the docker container, and wanna execute commands on the webserver behalf, be sure to use
sudo -Ecommand (with the-Eflag) to preserve env variables from the current shell. Otherwise Part-DB console might use the wrong configuration to execute commands.
Troubleshooting
User management commands
php bin/console partdb:users:list: List all users of this Part-DB instancephp bin/console partdb:users:set-password [username]: Set/Changes the password of the user with the given username. This allows administrators to reset a password of a user, if he forgot it.php bin/console partdb:users:enable [username]: Enable/Disable the user with the given username (use--disableto disable the user, which prevents login)php bin/console partdb:users:permissions: View/Change the permissions of the user with the given usernamephp bin/console partdb:users:upgrade-permissions-schema: Upgrade the permissions schema of users to the latest version (this is normally automatically done when the user visits a page)php bin/console partdb:logs:show: Show the most recent entries of the Part-DB event log / recent activityphp bin/console partdb:user:convert-to-saml-user: Convert a local user to a SAML/SSO user. This is needed, if you want to use SAML/SSO authentication for a user, which was created before you enabled SAML/SSO authentication.
Currency commands
php bin/console partdb:currencies:update-exchange-rates: Update the exchange rates of all currencies from the internet
Update Manager commands
The Update Manager is an experimental feature. See the Update Manager documentation for details.
php bin/console partdb:update: Check for and perform updates to Part-DB. Use--checkto only check for updates without installing.php bin/console partdb:maintenance-mode: Enable, disable, or check the status of maintenance mode. Use--enable,--disable, or--status.
Installation/Maintenance commands
php bin/console partdb:backup: Backup the database and the attachmentsphp bin/console partdb:version: Display the current version of Part-DB and the used PHP versionphp bin/console partdb:check-requirements: Check if the requirements for Part-DB are met (PHP version, PHP extensions, etc.) and make suggestions what could be improvedpartdb:migrations:convert-bbcode: Migrate the old BBCode markup codes used in legacy Part-DB versions (< 1.0.0) to the new Markdown syntaxpartdb:attachments:clean-unused: Remove all attachments which are not used by any database entry (e.g. orphaned attachments)partdb:cache:clear: Clears all caches, so the next page load will be slower, but the cache will be rebuilt. This can maybe fix some issues when the cache was corrupted. This command is also needed after changing things in theparameters.yamlfile or upgrading Part-DB.partdb:migrations:import-partkeepr: Imports a mysqldump XML dump of a PartKeepr database into Part-DB. This is only needed for users, which want to migrate from PartKeepr to Part-DB. All existing data in the Part-DB database is deleted!settings:migrate-env-to-settings: Migrate configuration from environment variables to the settings interface. The value of the environment variable is copied to the settings database, so the environment variable can be removed afterwards without losing the configuration.partdb:migrations:convert-db-platform: Convert the database platform (e.g. from SQLite to MySQL/MariaDB or PostgreSQL, or vice versa).
Database commands
php bin/console doctrine:migrations:migrate: Migrate the database to the latest versionphp bin/console doctrine:migrations:up-to-date: Check if the database is up-to-datephp bin/console partdb:database:check-sqlite-foreign-keys: For SQLite databases only: check for rows that already violate a foreign key constraint (e.g. reference a deleted parent row), using SQLite’sPRAGMA foreign_key_check. SQLite does not enforce foreign keys unlessDATABASE_SQLITE_ENFORCE_FOREIGN_KEYSis enabled (see the configuration documentation), so such inconsistent rows can otherwise accumulate silently. Run this command before enabling that setting on an existing installation, to find out whether doing so would immediately start rejecting operations on data that is already inconsistent. The command exits with a non-zero status code if any violations were found, so it can be used in scripts. Use the--fixoption to try to automatically resolve the found violations: rows referenced by a foreign key declaredON DELETE CASCADEare deleted (retroactively applying the cascade that would have happened had enforcement been on when the now-missing parent row was deleted), other rows with a nullable foreign key column have that column set toNULL. Rows that are neither (aNOT NULLforeign key column withoutON DELETE CASCADE) cannot be fixed automatically and are reported separately for manual handling. The command shows exactly what it is about to change and asks for confirmation before applying anything. Make sure you have a backup of your database before using--fix.
Attachment commands
php bin/console partdb:attachments:download: Download all attachments that are not already downloaded to the local filesystem. This is useful to create local backups of the attachments, no matter what happens on the remote, and also makes picture thumbnails available for the frontend for them.
EDA integration commands
php bin/console partdb:kicad:populate: Populate KiCad footprint paths and symbol paths for footprints and categories based on their names. Use--dry-runto preview changes without applying them, and--listto list current values. See the EDA integration documentation for more details.