Skip to content

Commit ca68280

Browse files
authored
Release/v0.1.1 (#120)
* fix(BodyData): Added default body data (#118) * Update dependencies * Add default value to body data * feat(Migrations): Implemented db migrations (#119) * Install doctrine migrations package * Add migrations configuration * Add migrations folder * Update usefull commands * Generates initial migration * Load all migrations * Update readme * Update pr template * Add foreign keys * Rename workflow * Move cache up * Move checkout * Bump version
1 parent 52136af commit ca68280

File tree

16 files changed

+1472
-1283
lines changed

16 files changed

+1472
-1283
lines changed

.github/pull_request_template.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ Describe your changes in detail.
99
- [ ] Unit tests for the changes have been added
1010
- [ ] Static analysis exits without any error
1111
- [ ] CS Fix exits without any error
12+
- [ ] DB schema migration has been generated

.github/workflows/main.workflow.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@ name: Main workflow
22
on:
33
push:
44
jobs:
5-
ci:
5+
main:
66
runs-on: ubuntu-20.04
77
env:
88
DB_NAME: test
99
DB_PASSWORD: root
1010
steps:
11-
- uses: actions/checkout@v2
12-
1311
- uses: shivammathur/setup-php@v2
1412
with:
1513
php-version: '7.4'
@@ -21,17 +19,15 @@ jobs:
2119
mysql database: ${{ env.DB_NAME }}
2220
mysql root password: ${{ env.DB_PASSWORD }}
2321

24-
- name: Install new instance
25-
run: ./bin/install.sh root "$DB_PASSWORD" "$DB_NAME" 127.0.0.1 3306
22+
- uses: actions/checkout@v2
2623

27-
- name: Cache Composer packages
28-
id: composer-cache
29-
uses: actions/cache@v2
24+
- uses: actions/cache@v2
3025
with:
3126
path: vendor
3227
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
33-
restore-keys: |
34-
${{ runner.os }}-php-
28+
29+
- name: Install new instance
30+
run: ./bin/install.sh root "$DB_PASSWORD" "$DB_NAME" 127.0.0.1 3306
3531

3632
- name: Validate DB schema
3733
run: composer orm:validate

README.md

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,52 +2,69 @@
22

33
## Instalation
44

5-
1. Clone repository: `git clone https://github.com/Stacha-dev/back-end.git && cd back-end`
5+
1. Clone repository: `git clone https://github.com/Stacha-dev/tardis.git && cd tardis`
66
2. Run install script `./bin/install.sh <db_user> <db_password> <db_name>`
77
3. Generate password for root user `composer app:password <password>`
88

99
## Development
1010

1111
1. Update `git pull develop` to get recent commits
1212
2. Install composer dependencies `composer install`
13-
3. Reload DB schema `composer orm:drop` and then `composer orm:create`
14-
4. Create new branch by `git checkout -b <branch_name>`
15-
- Feature `feat/<feature_name>`
16-
- Bugfix `fix/<bugfix_name>`
17-
5. Commit changes to repository
13+
3. Load DB schema `composer migrations:migrate` and generate proxies `composer orm:proxies`
14+
4. Create new branch by `git checkout -b <branch-name>` follow this convention:
15+
- Feature `feat/<feature-name>`
16+
- Bugfix `fix/<bugfix-name>`
17+
- Chore `chore/<chore-name>`
18+
5. Commit changes to the remote branch
1819
6. In case of feature add PHP Unit test suite
19-
6. Create pull request into `develop` branch
20+
6. Create pull request into `develop` branch follow this convention
21+
- `<type>(Scope): Description` example: `feat(User): Added user model`
2022

2123
## API
2224

2325
Endpoints: [POSTMAN](https://documenter.getpostman.com/view/10875200/T1LTdP9o?version=latest)
2426

25-
## Usefull commands
27+
## Usefull Commands
2628

2729
### App
28-
- Generate password `composer app:password <password>`
30+
31+
```
32+
composer app:password <password> // Generates password
33+
```
2934

3035
### ORM
3136

32-
- Create DB schema `composer orm:create`
33-
- Update DB schema`composer orm:update`
34-
- Drop DB schema`composer orm:drop`
37+
```
38+
composer orm:create // Creates DB schema
39+
composer orm:update // Updates DB schema
40+
compsoer orm:drop // Drops DB schema
41+
```
3542

36-
### Composer
43+
### Migrations
3744

38-
- Install `composer require <package>`
39-
- Update `composer update`
40-
- Remove `composer remove <package>`
45+
```
46+
composer migrations:diff // Generates differences in DB schema
47+
composer migrations:status // Show migration status
48+
composer migrations:migrate // Migrate to latest migration
49+
```
4150

4251
### PHPStan
4352

44-
- Static analysis `composer phpstan`
53+
```
54+
composer phpstan // Runs static analysis
55+
```
56+
57+
### Coding Standards
4558

46-
### CS
59+
```
60+
composer cs // Checks coding standarts
61+
composer cs:fix // Fixes coding standarts
4762
48-
- Check cs `composer cs:fix`
49-
- Fix cs `composer cs`
63+
```
5064

5165
### PHP Unit
52-
- Run all tests `composer test`
53-
- Generate test coverage `composer test:codecov`
66+
67+
```
68+
composer test // Runs all unit tests
69+
compsoer test:coverage // Generates test coverage
70+
```

bin/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ generate_config config/common.ini > config/common.local.ini
2525

2626
# ORM
2727
composer orm:drop
28-
composer orm:create
28+
composer migrations:migrate -- --no-interaction
2929
composer orm:proxies
3030

3131
# Fixtures

composer.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "stacha/back-end",
33
"type": "project",
44
"description": "Back-end for our applications.",
5-
"version": "0.1.0",
5+
"version": "0.1.1",
66
"license": "MIT",
77
"authors": [
88
{
@@ -17,17 +17,18 @@
1717
}
1818
],
1919
"require": {
20+
"doctrine/data-fixtures": "^1.5",
21+
"doctrine/migrations": "^3.1",
2022
"doctrine/orm": "^2.7.3",
21-
"firebase/php-jwt": "^5.2"
23+
"firebase/php-jwt": "^5.2",
24+
"symfony/console": "^5.2"
2225
},
2326
"require-dev": {
24-
"doctrine/data-fixtures": "^1.4",
2527
"friendsofphp/php-cs-fixer": "^2.16",
2628
"phpdocumentor/graphviz": "^2.0@dev",
2729
"phpdocumentor/phpdocumentor": "^3.0",
2830
"phpstan/phpstan": "^0.12.25",
2931
"phpunit/phpunit": "^8.5",
30-
"symfony/console": "^5.2",
3132
"symfony/finder": "5.1.*",
3233
"symfony/process": "5.1.*",
3334
"symfony/string": "5.1.*"
@@ -41,16 +42,20 @@
4142
"sort-packages": true
4243
},
4344
"scripts": {
45+
"app:password": "php bin/console app:password",
4446
"docs": "phpdoc",
4547
"test": "vendor/bin/phpunit tests",
4648
"test:coverage": "XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-html public/reports/test-coverage/",
4749
"orm:create": "doctrine orm:schema-tool:create",
48-
"orm:update": "doctrine orm:clear-cache:metadata && doctrine orm:schema-tool:update --force",
50+
"orm:update": "composer orm:clear-cache:metadata && doctrine orm:schema-tool:update --force",
4951
"orm:drop": "doctrine orm:clear-cache:metadata && doctrine orm:schema-tool:drop --full-database --force",
5052
"orm:proxies": "doctrine orm:generate-proxies",
5153
"orm:validate": "doctrine orm:validate-schema",
54+
"orm:clear-cache:metadata": "doctrine orm:clear-cache:metadata",
5255
"fixtures:load": "php bin/console fixtures:load",
53-
"app:password": "php bin/console app:password",
56+
"migrations:diff": "composer orm:clear-cache:metadata && doctrine-migrations migrations:diff",
57+
"migrations:status": "doctrine-migrations migrations:status",
58+
"migrations:migrate": "doctrine-migrations migrations:migrate",
5459
"phpstan": "phpstan analyse",
5560
"cs": "vendor/bin/php-cs-fixer fix src --dry-run --ansi",
5661
"cs:fix": "vendor/bin/php-cs-fixer fix src --ansi"

0 commit comments

Comments
 (0)