Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement sharding already in the migrations #866

Closed
wants to merge 121 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
fd99b38
use multiple migrations directories and namespaces
goetas Sep 7, 2019
12b6288
update more commands
goetas Sep 15, 2019
81e3b4b
increase version
goetas Sep 15, 2019
564ce17
allow custom sorting
goetas Sep 15, 2019
2c97ea6
executor
goetas Sep 15, 2019
ba6494c
remove start migration
goetas Sep 15, 2019
e7253d9
value object comparison for versions
goetas Sep 15, 2019
0f3f33a
adapted execute command
goetas Sep 15, 2019
643198f
do not load from sub namespaces
goetas Sep 15, 2019
881c40c
format migration state
goetas Sep 15, 2019
c7b7f74
start adapting tests
goetas Sep 15, 2019
0d4090b
stricter execution result
goetas Sep 15, 2019
97894cc
create MigratorConfigurationFactory
goetas Sep 16, 2019
cfbcb4d
extract factory interface
goetas Sep 16, 2019
b130cc3
fix event dispatcher
goetas Sep 16, 2019
b4bda42
use configuration loaders, drop inheritance
goetas Sep 17, 2019
8ac4757
add config loader tests
goetas Sep 17, 2019
aa37721
config tests
goetas Sep 17, 2019
200e3e5
executor tests
goetas Sep 17, 2019
eccdc9a
command tests
goetas Sep 18, 2019
d7f073f
up to date command
goetas Sep 18, 2019
d8bccb0
migrations repo tests
goetas Sep 18, 2019
e01c482
metadata tests
goetas Sep 18, 2019
9aba11a
alias resolver tests
goetas Sep 18, 2019
dd6fa67
factory test
goetas Sep 18, 2019
eb239c1
cs and tests
goetas Sep 18, 2019
bd24edf
interface
goetas Sep 18, 2019
2898e88
autocommit listener
goetas Sep 18, 2019
d577200
migration plan calculator tests
goetas Sep 18, 2019
46282d3
simplify code for migration plan calculator
goetas Sep 19, 2019
1705b52
more tests
goetas Sep 19, 2019
7d694f9
rollup test
goetas Sep 19, 2019
5ecc3d6
restore file builder
goetas Sep 19, 2019
85c2efb
test schema diff
goetas Sep 19, 2019
cc0956b
stub schema provider
goetas Sep 19, 2019
b64c8e8
dump schema test
goetas Sep 19, 2019
da076fe
generate test
goetas Sep 19, 2019
1b43299
diff command
goetas Sep 19, 2019
bd3c691
dix deps
goetas Sep 19, 2019
b2581f9
execute command
goetas Sep 19, 2019
e0b3e04
migrate command
goetas Sep 19, 2019
e19306f
remove outdated tests
goetas Sep 19, 2019
f02ab70
simplify class
goetas Sep 19, 2019
06cc637
Update documentation
goetas Sep 19, 2019
38113ba
more changes
goetas Sep 19, 2019
c394941
add event arg test
goetas Sep 20, 2019
06d2d9c
static analysis
goetas Sep 20, 2019
6a17b92
moved new-migrations and unavailable migrations to the plan calculator
goetas Sep 22, 2019
1041887
green tests
goetas Sep 22, 2019
904ada9
fix most of the phpstan stuff
goetas Sep 23, 2019
c1c6979
update xsd validator for 3.0
goetas Sep 24, 2019
22c36e7
phpstan
goetas Sep 24, 2019
e5d1cb7
add constructor provided migrations
goetas Sep 29, 2019
26abc13
add missing range feature
goetas Sep 29, 2019
45f3ded
fix some failing tests
goetas Sep 29, 2019
1955103
missing factory method
goetas Sep 29, 2019
ad3ae6e
add config loader
goetas Sep 30, 2019
3a90ec0
first/last tests
goetas Sep 30, 2019
3c7721c
di test
goetas Sep 30, 2019
225af9e
move migrator option to command
goetas Oct 1, 2019
990177c
migrator tests
goetas Oct 1, 2019
bd9fc2a
phpstan and tests
goetas Oct 1, 2019
305243d
restore down migration behaviour
goetas Oct 1, 2019
ba154fb
stof code review suggestions
goetas Oct 1, 2019
b242c1d
use datetime immutable
goetas Oct 1, 2019
c3dcaac
mark value objects as final
goetas Oct 1, 2019
1e71f3a
single queries are run in debug mode
goetas Oct 1, 2019
98f246c
ensure proper typecasting
goetas Oct 2, 2019
8a75231
skip migration version table in the schema dumps
goetas Oct 3, 2019
204bf85
allow to filter tables in a dump
goetas Oct 3, 2019
7752951
prepare upgrading document
goetas Oct 3, 2019
50f9859
version it is a string
goetas Oct 3, 2019
c75234b
fix too large column size
goetas Oct 9, 2019
cb38a6c
change output levels
goetas Oct 9, 2019
9d68726
fixed a lot of stuff from code review
goetas Oct 11, 2019
045505e
move generateVersionNumber out of config class
goetas Oct 11, 2019
afb506b
rename MigratorConfigurationFactory
goetas Oct 11, 2019
9c3dcda
rename Factory
goetas Oct 11, 2019
5fe82ac
cs
goetas Oct 11, 2019
a2fbde8
add version equals method
goetas Oct 11, 2019
ddc1a3d
rename interfaces
goetas Oct 12, 2019
d5cc9be
more readable executed at code
goetas Oct 12, 2019
000e0d8
ensure lowercase column names
goetas Oct 12, 2019
0e0060e
document migrator interface
goetas Oct 12, 2019
d1e8546
code reviews by @greg0ire
goetas Oct 12, 2019
6499146
alphabetical sorting of loaders
goetas Oct 12, 2019
090aa0d
change argument order of ConnectionHelperLoader
goetas Oct 12, 2019
1d0abe4
rename PhpFileLoader
goetas Oct 12, 2019
e3a5336
remove param default
goetas Oct 12, 2019
69aed5e
mark getDirectoryRelativeToFile as final
goetas Oct 12, 2019
54a0825
rename UnableToLoadResource
goetas Oct 12, 2019
b89fffd
mark ConfigurationLoader as internal
goetas Oct 12, 2019
19029ea
split table storage documentation
goetas Oct 12, 2019
f4d8998
MigrationNotAvailable::forVersion
goetas Oct 12, 2019
21895ad
update composer lock
goetas Oct 13, 2019
5b130ba
handle possible regex errors
goetas Oct 13, 2019
549cc7f
diff command tests fixed after rebase
goetas Oct 13, 2019
a00fa06
upgrade
goetas Oct 13, 2019
ffcf543
run cs on php 7.2
goetas Oct 13, 2019
8fab0d0
windows tests
goetas Oct 13, 2019
45a028d
filesystem sorting is not relevant in the finder
goetas Oct 14, 2019
55ff179
migration plan execution is immutable
goetas Oct 14, 2019
97c868e
warn to not use registerMigrationInstance
goetas Oct 14, 2019
79035fa
regex finder accepts any class naming
goetas Oct 14, 2019
bc12a43
do not allow invalid config keys
goetas Oct 14, 2019
4c0029b
array loader is a hard dependency for the other loaders
goetas Oct 14, 2019
fadba6d
no invalid keys are allowed
goetas Oct 14, 2019
3a50fc4
refer to https://github.com/Roave/BackwardCompatibilityCheck instead …
goetas Oct 14, 2019
8e50943
classgenerator test
goetas Oct 22, 2019
9054023
ensure there is always some metadata configuration set
goetas Oct 25, 2019
599d9c4
test minimal metadata configuration
goetas Nov 3, 2019
83fef4a
do not generate anymore empty down() methods, but fail instead
goetas Oct 25, 2019
b43fad7
ensure ExecutionTimeColumn is always an integer
goetas Oct 31, 2019
71485dc
allow dump schema when migrations in other namespaces are present
goetas Oct 31, 2019
5f343d4
mark as executed only if all queries pass (including the transaction …
goetas Nov 1, 2019
716ea39
test changes are not committed on metadata failure
goetas Nov 3, 2019
da08c1b
use executeUpdate for migration queries as it is a write operation
goetas Nov 1, 2019
cdcf19b
test execute update is used for migration queries
goetas Nov 3, 2019
90ecbd6
get possible storage metadata configs from the config when creating t…
goetas Nov 1, 2019
bf672b7
allow to change logger
goetas Nov 1, 2019
eb75475
sharded connection loader
goetas Nov 8, 2019
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
9 changes: 6 additions & 3 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ cache:

environment:
matrix:
- php: 7.2
- php: 7.2.23
- php: 7.3.10
- php: 7.1.32

init:
- SET PATH=C:\Program Files\OpenSSL;c:\tools\php;C:\tools\composer;%PATH%
Expand All @@ -25,14 +27,15 @@ install:
- ps: |
# Check if installation is cached
if (!(Test-Path c:\tools\php)) {
appveyor-retry cinst --params '""/InstallDir:C:\tools\php""' --ignore-checksums -y php --version ((choco search php --exact --all-versions -r | select-string -pattern $env:php | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','')
appveyor-retry cinst --params '""/InstallDir:C:\tools\php""' --no-progress --ignore-checksums -y php --version $env:php
# install sqlite
appveyor-retry cinst -y sqlite
appveyor-retry cinst -y sqlite --no-progress
Get-ChildItem -Path c:\tools\php
cd c:\tools\php

# Set PHP environment items that are always needed
copy php.ini-production php.ini

Add-Content php.ini "`n date.timezone=UTC"
Add-Content php.ini "`n extension_dir=ext"
Add-Content php.ini "`n memory_limit=1G"
Expand Down
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:

- stage: Test
env: COVERAGE
php: 7.2
before_script:
- mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{.disabled,}
- if [[ ! $(php -m | grep -si xdebug) ]]; then echo "xdebug required for coverage"; exit 1; fi
Expand All @@ -47,10 +48,12 @@ jobs:

- stage: Code Quality
env: CODING_STANDARDS
php: 7.2
install: travis_retry composer install --prefer-dist
script: ./vendor/bin/phpcs

- stage: Code Quality
env: STATIC_ANALYSIS
php: 7.2
install: travis_retry composer install --prefer-dist
script: vendor/bin/phpstan analyse
70 changes: 70 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,73 @@
# Upgrade to 3.0

- The "version" is the FQCN of the migration class (existing entries in the migrations table will be automatically updated).
- `MigrationsEventArgs` and `MigrationsVersionEventArgs` expose different API,
please refer to the [Code BC breaks](#code-bc-breaks) section.

## Console
- Console output changed. The commands use a different output style. If you were relying on specific output,
please update your scripts.
Console output is not covered by the BC promise, so please try not to rely on specific a output.
Different levels of verbosity are available now (`-v`, `-vv` and `-vvv` ).

## Migrations table

- The migrations table now has a new column named `execution_time`.


## Configuration files

*migrations.php Before*
```php
<?php

return [
'name' => 'My Project Migrations',
'migrations_namespace' => 'MyProject\Migrations',
'table_name' => 'doctrine_migration_versions',
'column_name' => 'version',
'column_length' => 14,
'executed_at_column_name' => 'executed_at',
'migrations_directory' => '/data/doctrine/migrations-docs-example/lib/MyProject/Migrations',
'all_or_nothing' => true,
'check_database_platform' => true,
];
```
*migrations.php After*

```php
<?php

return [
'name' => 'My Project Migrations',

'table_storage' => [
'table_name' => 'doctrine_migration_versions',
'version_column_name' => 'version',
'version_column_length' => 1024,
'executed_at_column_name' => 'executed_at',
'execution_time_column_name' => 'execution_time',
],

'migrations_paths' => [
'MyProject\Migrations' => '/data/doctrine/migrations/lib/MyProject/Migrations',
'MyProject\Component\Migrations' => './Component/MyProject/Migrations',
],

'all_or_nothing' => true,
'check_database_platform' => true,
];
```

Files in XML, YAML or JSON also changed in a similar way. Please refer to the official documentation for more details.

## Code BC breaks

Most of the code is protected by the `@internal` declaration and in a very rare cases you might have dealt with the
internals of this library.
You can use [Roave/BackwardCompatibilityCheck](https://github.com/Roave/BackwardCompatibilityCheck) and get a list of
changed elements.

# Upgrade to 2.0

## BC Break: Moved `Doctrine\DBAL\Migrations` to `Doctrine\Migrations`
Expand Down
13 changes: 7 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@
"doctrine/coding-standard": "^6.0",
"doctrine/orm": "^2.6",
"jdorn/sql-formatter": "^1.1",
"mikey179/vfsstream": "^1.6",
"phpstan/phpstan": "^0.10",
"phpstan/phpstan-deprecation-rules": "^0.10",
"phpstan/phpstan-phpunit": "^0.10",
"phpstan/phpstan-strict-rules": "^0.10",
"mikey179/vfsStream": "^1.6",
"phpstan/phpstan": "^0.11",
"phpstan/phpstan-deprecation-rules": "^0.11",
"phpstan/phpstan-phpunit": "^0.11",
"phpstan/phpstan-strict-rules": "^0.11",
"phpstan/phpstan-symfony": "^0.11.6",
"phpunit/phpunit": "^7.0",
"symfony/process": "^3.4||^4.0||^5.0",
"symfony/yaml": "^3.4||^4.0||^5.0"
Expand All @@ -51,7 +52,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "2.2.x-dev"
"dev-master": "3.0.x-dev"
}
},
"bin": [
Expand Down
Loading