Skip to content

Commit 3d84497

Browse files
author
Sebastian Michaelsen
committed
DatabaseMigrator
1 parent 5d85f15 commit 3d84497

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# PHPFramework Documentation
22

3-
This documentation refers to version 1.3 of [our fork](https://github.com/app-zap/PHPFramework) of the [PHPFramework](https://github.com/Luzifer/PHPFramework) which was developed by Knut Ahlers.
3+
This documentation refers to version 1.4 of [our fork](https://github.com/app-zap/PHPFramework) of the [PHPFramework](https://github.com/Luzifer/PHPFramework) which was developed by Knut Ahlers.
44

55
Don't worry, there will be a new name soon to get rid of this confusion.
66

SUMMARY.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
* [Signal/Slot](in-depth_documentation/signalslot.md)
1212
* [Plugin](in-depth_documentation/plugin.md)
1313
* [Domain Driven Design and ORM](in-depth_documentation/domain_driven_design_and_orm.md)
14+
* [DatabaseMigrator](in-depth_documentation/databasemigrator.md)
1415
* [Versions](versions/README.md)
1516

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# DatabaseMigrator
2+
3+
PHPFramework ships with a DatabaseMigrator which allows you to execute SQL files automatically. The migrator works only one-way at the moment.
4+
5+
## How it works
6+
7+
The migrator must be enabled and a directory must be provided (see the Configuration section for the details).
8+
9+
If it is enabled it is invoked on every call to the framework at an early point of execution (from a Signal in the constructor of the Dispatcher).
10+
11+
It executes numbered `.sql` files in the right order and remembers the last executed number. Each file is only executed once.
12+
13+
At the moment the `.sql` files must start at `1` and must increase without omitting any numbers. ([It's planned](https://github.com/app-zap/PHPFramework/issues/24) to change that to be less restricitive).
14+
15+
Files can either just contain the number as filename (`21.sql`) or also description separated from the number by underscore (`22_user_table.sql`).
16+
17+
All files must be directly in the configured directory. Subdirectories are not supported at the moment.

0 commit comments

Comments
 (0)