Skip to content

Commit a7a0920

Browse files
committed
update guide & help
1 parent b5999f3 commit a7a0920

File tree

8 files changed

+135
-37
lines changed

8 files changed

+135
-37
lines changed

guide/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
- [Application Console](development/console.md)
2323
- [Web-backend](development/backend.md)
2424
- [Web-frontend](development/frontend.md)
25+
- [Logging](tutorials/logging.md)
2526
- [Extensions](development/extensions.md)
2627
- [Conventions](development/conventions.md)
2728
- [Troubleshooting](development/troubleshooting.md)
@@ -48,7 +49,6 @@
4849
- [Develop vendor extensions with git repositories](tutorials/extension-development.md)
4950
- [Update application packages](tutorials/composer-update-packages.md)
5051
- [Upgrading applications](tutorials/upgrading.md)
51-
- [Logging](tutorials/logging.md)
5252

5353
##### Assets
5454

File renamed without changes.

guide/tutorials/database-export.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
Example for storing database dumps on S3.
3+
4+
yii db/export && \
5+
yii fs/sync runtime://mysql s3:// --interactive=0 && \
6+
yii fs/rmdir runtime://mysql --recursive --interactive=0
7+
8+
9+
-----
10+
11+
Transfer data from staging to migrations
12+
13+
- Go to `/resque`
14+
- `yii db/x-dump/data`
15+
- Download (via Moxiemanager or Filyfly)
16+
- Create file migration, place into tests/codeception/_migrations/VERSION
17+
- cd tests
18+
- make clean all
19+
- make run-tests (or make bash $ codecept run)
20+
21+
22+
Production
23+
==========
24+
25+
:warning: This section is under development.
26+
27+
### Migrate production data sets
28+
29+
- Do not export the schema (experimental: use `yii db/x-dump-data`)
30+
- Don't export the data of tables such as
31+
- log
32+
- migration
33+
- language
34+
- auth
35+
- Use correct time in migration history
36+
- minimize the number of `dev-master` packages
37+
Lines changed: 46 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,63 @@
1+
# Database migrations
12

2-
### Database migrations
3+
> :bulb: It is recommended to keep structural (schema) and data-only migrations separated.
34
4-
> :bulb: It is recommended to keep structural and data migrations separated.
55

6-
Lookup paths for migrations can be defined in application configuration, for details see [dmstr/yii2-migrate-command](https://github.com/dmstr/yii2-migrate-command/blob/master/README.md).
6+
## Development data
77

8-
'params' => [
9-
'yii.migrations' => [
10-
'@yii/rbac/migrations',
11-
'@dektrium/user/migrations',
12-
'@vendor/lajax/yii2-translate-manager/migrations',
13-
'@bedezign/yii2/audit/migrations'
8+
### Configuration
9+
10+
Configure migrate command with predefined values *use only for creating file migrations*
11+
12+
'controllerMap' => [
13+
'file:migrate' => [
14+
'class' => 'yii\console\controllers\MigrateController',
15+
'templateFile' => '@vendor/dmstr/yii2-db/db/mysql/templates/file-migration.php',
16+
'migrationPath' => '@project/migrations/dev-data',
1417
]
15-
]
16-
18+
],
19+
20+
### Usage
21+
22+
- Create the database export, which is basically an adjusted dump
23+
24+
> yii db/export --outputPath=@project/migrations/dev-data
25+
26+
> :exclamation: The dump truncates all exported tables by default
27+
28+
- Create a migration
29+
30+
> yii file:migrate/create dev_data
1731
18-
### Create a database migration from a SQL file
32+
- Adjust `public $file = '<NAME_OF_YOUR_EXPORTED_FILE>.sql';` in the newly created migration.
1933

20-
yii migrate/create \
21-
--templateFile='@dmstr/db/mysql/templates/file-migration.php' \
22-
--migrationPath='@app/migrations/demo-data' \
23-
data_migration
34+
- For development add the development-data migrations via ENV variable in `docker-compose.dev.yml`
2435

25-
Do not forget to add the migration path to the configuration
36+
APP_MIGRATION_LOOKUP=@project/migrations/dev-data
2637

27-
'params' => [
38+
39+
## Additional information
40+
41+
If you create initial data for the application, which is required and should always be inserted in inital setup, do not forget to add the migration path to the configuration
42+
43+
'params' => [
2844
'yii.migrations' => [
29-
'@app/migrations/demo-data',
45+
'@app/migrations/data',
3046
]
3147
]
3248

33-
:green_book: https://github.com/dmstr/yii2-db/blob/master/README.md
3449

50+
Lookup paths for migrations can be defined in application configuration, for details see [dmstr/yii2-migrate-command](https://github.com/dmstr/yii2-migrate-command/blob/master/README.md).
3551

36-
### Commands
52+
'params' => [
53+
'yii.migrations' => [
54+
'@yii/rbac/migrations',
55+
'@dektrium/user/migrations',
56+
'@vendor/lajax/yii2-translate-manager/migrations',
57+
'@bedezign/yii2/audit/migrations'
58+
]
59+
]
3760

38-
Configure migrate command with predefined values *use only for creating file migrations*
61+
## Resources
3962

40-
'controllerMap' => [
41-
'file:migrate' => [
42-
'class' => 'yii\console\controllers\MigrateController',
43-
'templateFile' => '@vendor/dmstr/yii2-db/db/mysql/templates/file-migration.php',
44-
'migrationPath' => '@app/modules/_migrations/demo-data',
45-
]
46-
],
63+
:green_book: https://github.com/dmstr/yii2-db/blob/master/README.md

guide/tutorials/filesystems.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33
As an ephemeral container, a *phd5* application usually does not store files directly.
44
It requires one or more storage backends, which are used for permanent file storage.
55

6-
Example for storing database dumps on S3.
7-
8-
yii db/export && \
9-
yii fs/sync runtime://mysql s3:// --interactive=0 && \
10-
yii fs/rmdir runtime://mysql --recursive --interactive=0
6+
yii fs --help
117

128

139

guide/tutorials/seo.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# SEO
2+
3+
## Pages
4+
5+
'defaultRoute' => 'site/root-node',

guide/tutorials/testing-yii2-extensions.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,41 @@ Setup
2828
Configuration
2929
-------------
3030

31+
*TBD*
32+
33+
```
34+
{
35+
"repositories": [
36+
{
37+
"type": "vcs",
38+
"url": "file:///repo/schmunk42/yii2-giiant"
39+
}
40+
],
41+
"require": {
42+
"wikimedia/composer-merge-plugin": "~1.4",
43+
"schmunk42/yii2-giiant": "dev-develop"
44+
},
45+
"extra": {
46+
"merge-plugin": {
47+
"require": [
48+
"/app/composer.json",
49+
"/repo/schmunk42/yii2-giiant/composer.json"
50+
]
51+
}
52+
},
53+
"config": {
54+
"fxp-asset": {
55+
"installer-paths": {
56+
"npm-asset-library": "vendor/npm",
57+
"bower-asset-library": "vendor/bower"
58+
},
59+
"vcs-driver-options": {
60+
"github-no-api": true
61+
},
62+
"git-skip-update": "2 days",
63+
"pattern-skip-version": "(-build|-patch)",
64+
"optimize-with-installed-packages": false
65+
}
66+
}
67+
}
68+
```

help/frontend-developer/module-prototype-twig.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,21 +201,24 @@ Enable **setting** `app.layout.enableTwigNavbar` and create a **prototype/twig**
201201

202202
> :warning: Be careful, when changing the navbar, see the **audit** module for your latest changes
203203
204+
{# Importing widgets namespaces and classes #}
204205
{{ use('dmstr/modules/pages/models') }}
205206
{{ use('rmrevin/yii/fontawesome') }}
206207
{{ use('yii/helpers') }}
207208
{{ use('yii/bootstrap') }}
208209

209-
{% set frontendItems = Tree.getMenuItems('root', true) %}
210+
{# Prepare menu variables #}
211+
{% set frontendItems = Tree.{# Importing widgets namespaces and classes #}getMenuItems('root', true) %}
210212
{% set backendItems = Tree.getMenuItems('backend', true) %}
211213

212-
214+
{# Navigation #}
213215
{{ nav_bar_begin(
214216
{
215217
'brandLabel': FA.i('cog'),
216218
}
217219
) }}
218220

221+
{# Backend items #}
219222
{{ nav_widget(
220223
{
221224
'options': {
@@ -231,6 +234,7 @@ Enable **setting** `app.layout.enableTwigNavbar` and create a **prototype/twig**
231234
}
232235
) }}
233236

237+
{# Frontend items #}
234238
{{ nav_widget(
235239
{
236240
'options': {
@@ -240,6 +244,7 @@ Enable **setting** `app.layout.enableTwigNavbar` and create a **prototype/twig**
240244
}
241245
) }}
242246
247+
{# Logout #}
243248
{{ nav_widget(
244249
{
245250
'options': {

0 commit comments

Comments
 (0)