Skip to content

Commit 2362592

Browse files
author
Bizley
authored
simple-sql-columns (#110)
1 parent 88d2d62 commit 2362592

File tree

80 files changed

+2613
-1247
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+2613
-1247
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ You can easily generate updating migration for database table by comparing its c
116116
| `fixHistory` | `fh` | Whether to add migration history entry when migration is generated.
117117
| `skipMigrations` | | List of migrations from the history table that should be skipped during the update process (see [2] below).
118118
| `excludeTables` | | List of tables that should be skipped.
119-
119+
| `experimental` | `ex` | **New in 4.1.0** - Whether to run in experimental mode (see [3] below).
120120

121121
[1] Remember that with different database types general column schemas may be generated with different length.
122122

@@ -138,6 +138,10 @@ You can easily generate updating migration for database table by comparing its c
138138
setting the RBAC hierarchy with authManager component. Such actions should be kept in separated migration and placed on
139139
this list to prevent them from being run during the extraction process.
140140

141+
[3] This mode allows using raw SQL column definition for migration updater (i.e. `['column' => 'varchar(255)']` instead
142+
of `['column' => $this->string()]`). Since the generating process in this mode depends on the individual DBMS syntax
143+
the results might not be correct. All help improving this mode is more than welcome.
144+
141145
## Renaming
142146

143147
When you rename a table or a column remember to generate appropriate migration manually otherwise this extension will

src/Extractor.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,16 @@ final class Extractor implements ExtractorInterface
1919
/** @var Connection */
2020
private $db;
2121

22-
public function __construct(Connection $db)
22+
/**
23+
* @var bool
24+
* @since 4.1.0
25+
*/
26+
private $experimental;
27+
28+
public function __construct(Connection $db, bool $experimental = false)
2329
{
2430
$this->db = $db;
31+
$this->experimental = $experimental;
2532
}
2633

2734
/** @var MigrationChangesInterface */
@@ -56,7 +63,7 @@ public function extract(string $migration, array $migrationPaths): void
5663
require_once $file;
5764
}
5865

59-
$this->subject = new $migration(['db' => clone $this->db]);
66+
$this->subject = new $migration(['db' => clone $this->db, 'experimental' => $this->experimental]);
6067
if ($this->subject instanceof MigrationChangesInterface === false) {
6168
throw new ErrorException(
6269
"Class '{$migration}' must implement bizley\migration\dummy\MigrationChangesInterface."

0 commit comments

Comments
 (0)