artiframe db:export
The artiframe db:export command reads the connection credentials from your project's .env file and directly exports the database to a .sql file.
It operates via pure PHP/PDO natively within the ArtiFrame CLI, eliminating the need for external tools like mysqldump.
Usage
$ artiframe db:export [mode]
Modes
| Mode | What is Exported? |
|---|---|
within |
Exports table structures (CREATE TABLE) and all records (INSERT INTO). Used for taking full backups. |
without |
Exports only the table structures (schema). Contains no data. Ideal for environment setup (empty database schema). |
Example: Full Backup (Structure + Data)
$ artiframe db:export within
🔄 Exporting database: my_db (Structure + Data)...
✅ Success! Database exported.
📂 File: /var/www/my-project/export_within_my_db_20260917_152301.sql
Example: Schema Only (Structure)
$ artiframe db:export without
🔄 Exporting database: my_db (Structure Only)...
✅ Success! Database exported.
📂 File: /var/www/my-project/export_without_my_db_20260917_152318.sql
Technical Notes
- The output file is saved to the project root directory in the format
export_[mode]_[db_name]_[datetime].sql. - For large tables, data is grouped (chunked) into 100-row
INSERTblocks; this prevents memory exhaustion issues during import. FOREIGN KEYconstraints are temporarily disabled (SET FOREIGN_KEY_CHECKS=0) in the SQL dump and re-enabled at the end of the script.- It is recommended to add export files to your
.gitignoreas they may contain sensitive data.