Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions docs/api-reference.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
sidebar_position: 5
title: API Reference
description: Complete PHP API documentation for database migrations
---

# API Reference
Expand Down Expand Up @@ -36,8 +38,9 @@ public function createVersion(): void
// Check if database is versioned
public function isDatabaseVersioned(): bool

// Get current version
public function getCurrentVersion(): int
// Get current version and status
// Returns: ['version' => int, 'status' => string]
public function getCurrentVersion(): array

// Update version table structure
public function updateTableVersion(): void
Expand Down Expand Up @@ -124,9 +127,9 @@ interface DatabaseInterface
### Built-in Handlers

- `MySqlDatabase`: MySQL/MariaDB
- `PostgresDatabase`: PostgreSQL
- `PgsqlDatabase`: PostgreSQL
- `SqliteDatabase`: SQLite
- `SqlServerDatabase`: Microsoft SQL Server
- `DblibDatabase`: Microsoft SQL Server (both dblib and sqlsrv)

## Examples

Expand Down Expand Up @@ -155,6 +158,10 @@ $migration->addCallbackProgress(function ($action, $version, $fileInfo) {

### With Transaction Support

:::note Transaction Support
Transaction support is not available for MySQL as it doesn't support DDL commands inside transactions. The setting will be silently ignored for MySQL databases.
:::

```php
$migration
->withTransactionEnabled(true)
Expand Down
2 changes: 2 additions & 0 deletions docs/cli-usage.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
sidebar_position: 4
title: CLI Usage
description: Command line interface guide for database migrations
---

# Command Line Interface Usage
Expand Down
8 changes: 6 additions & 2 deletions docs/database-setup.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
sidebar_position: 2
title: Database Setup
description: Configure database connections for MySQL, PostgreSQL, SQLite, and SQL Server
---

# Database Setup and Configuration
Expand Down Expand Up @@ -37,8 +39,10 @@ The library supports the following databases:
```

4. Transaction Limitations:
- DDL statements not supported in transactions
- Transaction settings ignored for DDL

:::warning MySQL Transaction Limitations
MySQL does not support DDL (Data Definition Language) statements within transactions. Any transaction settings will be ignored for DDL operations like CREATE TABLE, ALTER TABLE, etc.
:::

### PostgreSQL

Expand Down
6 changes: 5 additions & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
sidebar_position: 1
title: Getting Started
description: Get started with PHP Database Migration - a framework-agnostic database versioning tool using pure SQL
---

# Getting Started with PHP Database Migration
Expand Down Expand Up @@ -28,7 +30,9 @@ composer require "byjg/migration"
composer require "byjg/migration-cli"
```

For CLI usage, see [CLI documentation](cli-usage.md).
:::tip
For CLI usage, see the [CLI documentation](cli-usage.md) for detailed commands and options.
:::

## Basic Usage

Expand Down
10 changes: 10 additions & 0 deletions docs/migration-scripts.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
sidebar_position: 3
title: Migration Scripts
description: Learn how to write and organize database migration scripts
---

# Writing Migration Scripts
Expand All @@ -23,6 +25,10 @@ The number represents the version that the script will migrate to (up) or from (

## Multi-Developer Workflow

:::info Handling Multiple Developers
When multiple developers work on different branches, use the `-dev` suffix to avoid version conflicts.
:::

When multiple developers work on different branches:

1. Use `-dev` suffix for work in progress:
Expand Down Expand Up @@ -73,6 +79,10 @@ When multiple developers work on different branches:

### PostgreSQL-Specific Tips

:::warning Important for PostgreSQL Functions
Always add `--` comments after semicolons inside function definitions to prevent parsing errors.
:::

1. Use `--` after semicolons in functions:
```sql
CREATE FUNCTION update_timestamp() RETURNS trigger AS $$
Expand Down