base on Database DB Auditor provide leverage to audit your MySql database standards and also provide options to add constraints in table <p align="center"><img src="art/laravel-db-auditor-hr.svg" width="50%" alt="Logo Laravel DB Auditor"></p>
![Packagist License](https://img.shields.io/packagist/l/vcian/laravel-db-auditor?style=for-the-badge)
[![Total Downloads](https://img.shields.io/packagist/dt/vcian/laravel-db-auditor?style=for-the-badge)](https://packagist.org/packages/vcian/laravel-db-auditor)
## Introduction
- This package provides to audit process of reviewing and evaluating a mysql, sqlite and postgresql database system.
- DB Auditor scan your mysql/sqlite/postgresql database and give insights of standards, constraints and provide option to add the constraints through CLI.
- The result of audit process shows list of tables & columns which doesn't have proper standards.
## Installation & Usage
> **Requires [PHP 8.0+](https://php.net/releases/) | [Laravel 8.0+](https://laravel.com/docs/8.x)**
Require Laravel DB Auditor using [Composer](https://getcomposer.org):
```bash
composer require --dev vcian/laravel-db-auditor
```
## Usage:
You can access DB Auditor using below artisan commands.
> #### **php artisan db:audit**
>
> This command give you options to select feature like check the database standards or check the constraint.
>
> Now, you can skip tables which you don't want to check. Add skip table name in the .db-auditor.php file.
>
**Note:**
If you want to check standalone feature then you can execute below artisan command one by one.
> #### **php artisan db:constraint**
>
> This command gives you result with list of tables with primary,foreign,unique,index constraint.
>
>
> You can add more constraint to the table by seeing existing constraint with table.
>
> Below example give insights about the how to see constraints in table and how to add.
>
> Note :-
> - SQLite does not allow to define PRIMARY KEY or FOREIGN KEY into a existing table.
> - Add constraint option is not support for PostgreSQL. Will release soon.
<p align="center"><img src="art/db-constraint-select-table.png" width="100%" alt="Logo Laravel DB Auditor"></p>
<p align="center"><img src="art/db-constraint-display-table-details.png" width="100%" alt="Logo Laravel DB Auditor"></p>
<p align="center"><img src="art/db-constraint-add.png" width="100%" alt="Logo Laravel DB Auditor"></p>
<p align="center"><img src="art/db-constraint-result.png" width="100%" alt="Logo Laravel DB Auditor"></p>
---
> #### **php artisan db:standard**
>
> This command give you result with list of table with standard follow indication.
>
>
> You can also see table specific column name which doesn't have standard followed.
>
> Below example give insights of database standards reports and suggestions.
>
>
<p align="center"><img src="art/db-standard-cmd-1.png" width="100%" alt="Logo Laravel DB Auditor"></p>
<p align="center"><img src="art/db-standard-table-report-1.png" width="100%" alt="Logo Laravel DB Auditor"></p>
<p align="center"><img src="art/db-standard-table-report-2.png" width="100%" alt="Logo Laravel DB Auditor"></p>
---
> #### **php artisan db:track**
>
> This command give you the track of the database files. Like when it's created with how many field in which table or whom created. this type of information show in the result.
>
>
> You can also filter with --table=, --action=, --status=.
> Note: "created by" return the github username and if it's not git repo than it shows system username.
>
<img src="art/track-default.png" width="100%" alt="Track Default"></p>
<img src="art/track-table.png" width="100%" alt="Track Default"></p>
<img src="art/track-st-pending.png" width="100%" alt="Track Default"></p>
<img src="art/track-ac-create.png" width="100%" alt="Track Default"></p>
**Note:**
You have to set your database name with _DB_DATABASE_ parameter in you laravel .env file to use this feature.
## ACCESS WEB PAGE
You can also access this feature through WEB UI. To access web UI, kindly execute below command.
php artisan vendor:publish --tag=public
select "db-auditor"
Route - To access the web UI "/laravel-db-auditor"
<p align="center"><img src="art/db-standard-ui.png" width="100%" alt="Laravel DB Auditor UI"></p>
<p align="center"><img src="art/db-standard-details-ui.png" width="100%" alt="Laravel DB Auditor UI"></p>
<p align="center"><img src="art/db-constraint-ui.png" width="100%" alt="Laravel DB Auditor UI"></p>
## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
We believe in
👇
ACT NOW
PERFECT IT LATER
CORRECT IT ON THE WAY.
## Security
If you discover any security-related issues, please email
[email protected] instead of using the issue tracker.
## Credits
- [All Contributors](../../contributors)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
", Assign "at most 3 tags" to the expected json: {"id":"10604","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"