Skip to content

Commit

Permalink
Init commit (find-invalid-values and find-risky-columns commands)
Browse files Browse the repository at this point in the history
  • Loading branch information
alies-dev committed Aug 27, 2024
0 parents commit d6bba13
Show file tree
Hide file tree
Showing 17 changed files with 710 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
max_line_length = 120
tab_width = 4

[*.{yml,yaml}]
indent_size = 2
17 changes: 17 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Path-based git attributes
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

# Ignore all test and documentation with "export-ignore".
/.github export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/phpunit.xml.dist export-ignore
/art export-ignore
/docs export-ignore
/tests export-ignore
/.editorconfig export-ignore
/.php_cs.dist.php export-ignore
/phpstan* export-ignore
/psalm* export-ignore
/CHANGELOG.md export-ignore
/CONTRIBUTING.md export-ignore
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/1_Bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: "Bug report"
about: "Report something that's broken."
---

<!-- DO NOT THROW THIS AWAY -->
<!-- Fill out the FULL versions with patch versions -->

- Package Version: #.#.#
- Laravel Version: #.#.#
- PHP Version: #.#.#

### Description:


### Steps To Reproduce:

<!-- If possible, please provide a code snippet to demonstrate your issue -->
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Support Questions & Other
url: https://github.com/InteractionDesignFoundation/laravel-db-toolkit/discussions
about: 'If you have a question or need help using the library, click:'
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: composer
directory: "/"
schedule:
interval: monthly
open-pull-requests-limit: 50
labels:
- "dependencies"
assignees:
- ixdf-bot
42 changes: 42 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: run-tests

on: [ push, pull_request ]

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [ 8.1, 8.2, 8.3 ]
laravel: [ 10.* ]
testbench: [ 8.* ]
dependency-version: [ prefer-stable ]

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: none

- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
env:
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}

- name: Execute tests
run: composer test
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/node_modules
yarn.lock
package-lock.json

/vendor
composer.phar
composer.lock
auth.json

phpunit.xml
.phpunit.result.cache
.phpunit.cache
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 The Interaction Design Foundation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Laravel Database Toolkit

![logo with ants-engineers repairing a database](./art/logo-sm.jpg)

[![Latest Stable Version](https://poser.pugx.org/interaction-design-foundation/laravel-db-toolkit/v)](https://packagist.org/packages/interaction-design-foundation/laravel-db-toolkit)
[![Total Downloads](https://poser.pugx.org/interaction-design-foundation/laravel-db-toolkit/downloads)](https://packagist.org/packages/interaction-design-foundation/laravel-db-toolkit)
[![License](https://poser.pugx.org/interaction-design-foundation/laravel-db-toolkit/license)](https://packagist.org/packages/interaction-design-foundation/laravel-db-toolkit)

The package contains few Laravel console commands that validate database schema and data and report about potential issues.


## Installation

You can install the package in to your Laravel app via composer:

```bash
composer require interaction-design-foundation/laravel-db-toolkit
```


## Usage

```shell
# Find invalid data created in non-strict SQL mode.
php artisan database:find-invalid-values

# Find risky auto-incremental columns on databases which values are close to max possible values.
php artisan database:find-risky-columns
```


### Changelog

Please see [Releases](https://github.com/InteractionDesignFoundation/laravel-db-toolkit/releases) for more information on what has changed recently.


## Contributing

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.


## License

The MIT License (MIT). Please see [License File](LICENSE) for more information.
Binary file added art/logo-sm.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"name": "interaction-design-foundation/laravel-db-toolkit",
"description": "A set of console commands for SQL databases",
"license": "MIT",
"type": "library",
"keywords": [
"laravel",
"database",
"console commands"
],
"require": {
"php": "^8.1",
"doctrine/dbal": "^3.7 || ^4.0",
"laravel/framework": "^10.2"
},
"require-dev": {
"interaction-design-foundation/coding-standard": "^0.3",
"phpunit/phpunit": "^10.1"
},
"minimum-stability": "dev",
"prefer-stable": true,
"autoload": {
"psr-4": {
"InteractionDesignFoundation\\LaravelDatabaseToolkit\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"InteractionDesignFoundation\\LaravelDatabaseToolkit\\Tests\\": "tests/"
}
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
},
"sort-packages": true
},
"extra": {
"laravel": {
"providers": [
"InteractionDesignFoundation\\LaravelDatabaseToolkit\\DatabaseToolkitServiceProvider"
]
}
},
"scripts": {
"cs:check": "phpcbf -p -s --colors --report-full --report-summary",
"cs:fix": "phpcbf -p --colors",
"cs": "@cs:fix",
"test": "phpunit --colors=always"
}
}
25 changes: 25 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd"
bootstrap="vendor/autoload.php"
backupGlobals="false"
colors="true"
processIsolation="false"
stopOnFailure="false"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false">
<coverage/>
<testsuites>
<testsuite name="Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<php>
</php>
<source>
<include>
<directory suffix=".php">src/</directory>
</include>
</source>
</phpunit>
Loading

0 comments on commit d6bba13

Please sign in to comment.