Skip to content

Commit

Permalink
Added section CreateTableBlueprint to documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterZydra committed Apr 19, 2024
1 parent e18a182 commit 38b8250
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ Types of changes: `Added`, `Changed`, `Deprecate`, `Removed`, `Fixed`, `Secruity
## [Unreleased]

### Added
- Added class `CreateTableBlueprint` to create statements for generating tables in MySQL/MariaDB and SQLite
- Added test mode to class `Config` so env values can be changed in test runs
- Added interface `ResultInterface` that all database providers use as return type for queries
- Added wrapper SQLite for PHP SQLite3 class
- Added support for SQLite
- Added unified interface `ResultInterface` for database results
- Added class `CreateTableBlueprint` to create statements for generating tables in MySQL/MariaDB and SQLite

## v2.5.0 - 17.03.2024 - Added statistic for amount and price development

Expand Down
26 changes: 26 additions & 0 deletions doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,32 @@ return new class extends Migration
...
```

### CreateTableBlueprint
Each DBSM has its own specific syntax.
The blueprint class `CreateTableBlueprint` can be used for the creation of a new table in MariaDB and SQLite.
Each supported database driver implements the [`CreateTableBlueprintInterface`](../framework/Database/Interface/CreateTableBlueprintInterface.php).

**Example**
```PHP
use Framework\Database\CreateTableBlueprint;
use Framework\Database\Database;
use Framework\Database\Migration\Migration;

return new class extends Migration
{
public function run(): void
{
Database::executeBlueprint((new CreateTableBlueprint('users'))
->id()
->string('name', 100)
->date('lastLogin')
->int('languageId', foreignKey: ['languages' => 'id'])
->timestamps()
);
}
};
```

-------------------------------------------------------------

## Seeders
Expand Down

0 comments on commit 38b8250

Please sign in to comment.