Skip to content

Commit d6bba13

Browse files
committed
Init commit (find-invalid-values and find-risky-columns commands)
0 parents  commit d6bba13

17 files changed

+710
-0
lines changed

.editorconfig

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
max_line_length = 120
11+
tab_width = 4
12+
13+
[*.{yml,yaml}]
14+
indent_size = 2

.gitattributes

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Path-based git attributes
2+
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
3+
4+
# Ignore all test and documentation with "export-ignore".
5+
/.github export-ignore
6+
/.gitattributes export-ignore
7+
/.gitignore export-ignore
8+
/phpunit.xml.dist export-ignore
9+
/art export-ignore
10+
/docs export-ignore
11+
/tests export-ignore
12+
/.editorconfig export-ignore
13+
/.php_cs.dist.php export-ignore
14+
/phpstan* export-ignore
15+
/psalm* export-ignore
16+
/CHANGELOG.md export-ignore
17+
/CONTRIBUTING.md export-ignore
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
name: "Bug report"
3+
about: "Report something that's broken."
4+
---
5+
6+
<!-- DO NOT THROW THIS AWAY -->
7+
<!-- Fill out the FULL versions with patch versions -->
8+
9+
- Package Version: #.#.#
10+
- Laravel Version: #.#.#
11+
- PHP Version: #.#.#
12+
13+
### Description:
14+
15+
16+
### Steps To Reproduce:
17+
18+
<!-- If possible, please provide a code snippet to demonstrate your issue -->

.github/ISSUE_TEMPLATE/config.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Support Questions & Other
4+
url: https://github.com/InteractionDesignFoundation/laravel-db-toolkit/discussions
5+
about: 'If you have a question or need help using the library, click:'

.github/dependabot.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: composer
4+
directory: "/"
5+
schedule:
6+
interval: monthly
7+
open-pull-requests-limit: 50
8+
labels:
9+
- "dependencies"
10+
assignees:
11+
- ixdf-bot

.github/workflows/run-tests.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: run-tests
2+
3+
on: [ push, pull_request ]
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
fail-fast: true
10+
matrix:
11+
php: [ 8.1, 8.2, 8.3 ]
12+
laravel: [ 10.* ]
13+
testbench: [ 8.* ]
14+
dependency-version: [ prefer-stable ]
15+
16+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Setup PHP
23+
uses: shivammathur/setup-php@v2
24+
with:
25+
php-version: ${{ matrix.php }}
26+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
27+
coverage: none
28+
29+
- name: Setup problem matchers
30+
run: |
31+
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
32+
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
33+
34+
- name: Install dependencies
35+
run: |
36+
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
37+
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
38+
env:
39+
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
40+
41+
- name: Execute tests
42+
run: composer test

.gitignore

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/node_modules
2+
yarn.lock
3+
package-lock.json
4+
5+
/vendor
6+
composer.phar
7+
composer.lock
8+
auth.json
9+
10+
phpunit.xml
11+
.phpunit.result.cache
12+
.phpunit.cache

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 The Interaction Design Foundation
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Laravel Database Toolkit
2+
3+
![logo with ants-engineers repairing a database](./art/logo-sm.jpg)
4+
5+
[![Latest Stable Version](https://poser.pugx.org/interaction-design-foundation/laravel-db-toolkit/v)](https://packagist.org/packages/interaction-design-foundation/laravel-db-toolkit)
6+
[![Total Downloads](https://poser.pugx.org/interaction-design-foundation/laravel-db-toolkit/downloads)](https://packagist.org/packages/interaction-design-foundation/laravel-db-toolkit)
7+
[![License](https://poser.pugx.org/interaction-design-foundation/laravel-db-toolkit/license)](https://packagist.org/packages/interaction-design-foundation/laravel-db-toolkit)
8+
9+
The package contains few Laravel console commands that validate database schema and data and report about potential issues.
10+
11+
12+
## Installation
13+
14+
You can install the package in to your Laravel app via composer:
15+
16+
```bash
17+
composer require interaction-design-foundation/laravel-db-toolkit
18+
```
19+
20+
21+
## Usage
22+
23+
```shell
24+
# Find invalid data created in non-strict SQL mode.
25+
php artisan database:find-invalid-values
26+
27+
# Find risky auto-incremental columns on databases which values are close to max possible values.
28+
php artisan database:find-risky-columns
29+
```
30+
31+
32+
### Changelog
33+
34+
Please see [Releases](https://github.com/InteractionDesignFoundation/laravel-db-toolkit/releases) for more information on what has changed recently.
35+
36+
37+
## Contributing
38+
39+
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
40+
41+
42+
## License
43+
44+
The MIT License (MIT). Please see [License File](LICENSE) for more information.

art/logo-sm.jpg

62.8 KB
Loading

art/logo.png

967 KB
Loading

composer.json

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"name": "interaction-design-foundation/laravel-db-toolkit",
3+
"description": "A set of console commands for SQL databases",
4+
"license": "MIT",
5+
"type": "library",
6+
"keywords": [
7+
"laravel",
8+
"database",
9+
"console commands"
10+
],
11+
"require": {
12+
"php": "^8.1",
13+
"doctrine/dbal": "^3.7 || ^4.0",
14+
"laravel/framework": "^10.2"
15+
},
16+
"require-dev": {
17+
"interaction-design-foundation/coding-standard": "^0.3",
18+
"phpunit/phpunit": "^10.1"
19+
},
20+
"minimum-stability": "dev",
21+
"prefer-stable": true,
22+
"autoload": {
23+
"psr-4": {
24+
"InteractionDesignFoundation\\LaravelDatabaseToolkit\\": "src/"
25+
}
26+
},
27+
"autoload-dev": {
28+
"psr-4": {
29+
"InteractionDesignFoundation\\LaravelDatabaseToolkit\\Tests\\": "tests/"
30+
}
31+
},
32+
"config": {
33+
"allow-plugins": {
34+
"dealerdirect/phpcodesniffer-composer-installer": true
35+
},
36+
"sort-packages": true
37+
},
38+
"extra": {
39+
"laravel": {
40+
"providers": [
41+
"InteractionDesignFoundation\\LaravelDatabaseToolkit\\DatabaseToolkitServiceProvider"
42+
]
43+
}
44+
},
45+
"scripts": {
46+
"cs:check": "phpcbf -p -s --colors --report-full --report-summary",
47+
"cs:fix": "phpcbf -p --colors",
48+
"cs": "@cs:fix",
49+
"test": "phpunit --colors=always"
50+
}
51+
}

phpunit.xml.dist

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd"
5+
bootstrap="vendor/autoload.php"
6+
backupGlobals="false"
7+
colors="true"
8+
processIsolation="false"
9+
stopOnFailure="false"
10+
cacheDirectory=".phpunit.cache"
11+
backupStaticProperties="false">
12+
<coverage/>
13+
<testsuites>
14+
<testsuite name="Test Suite">
15+
<directory>tests</directory>
16+
</testsuite>
17+
</testsuites>
18+
<php>
19+
</php>
20+
<source>
21+
<include>
22+
<directory suffix=".php">src/</directory>
23+
</include>
24+
</source>
25+
</phpunit>

0 commit comments

Comments
 (0)