Skip to content

Commit e4581da

Browse files
authored
Use new column builder (#279)
1 parent b3e6fcd commit e4581da

19 files changed

Lines changed: 385 additions & 303 deletions

.github/workflows/build.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,15 @@ jobs:
6161
- name: Set environment variables pull request linux.
6262
uses: yiisoft/actions/db/environment-linux@master
6363

64+
- name: Install db.
65+
uses: yiisoft/actions/db/subpackage-install@master
66+
with:
67+
BRANCH_NAME: ${{ env.BRANCH_NAME }}
68+
COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }}
69+
CURRENT_PACKAGE: db
70+
FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }}
71+
WORK_PACKAGE_URL: ${{ env.WORK_PACKAGE_URL }}
72+
6473
- name: Install db-sqlite.
6574
uses: yiisoft/actions/db/subpackage-install@master
6675
with:

.github/workflows/mssql.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,15 @@ jobs:
7878
- name: Set environment variables pull request linux.
7979
uses: yiisoft/actions/db/environment-linux@master
8080

81+
- name: Install db.
82+
uses: yiisoft/actions/db/subpackage-install@master
83+
with:
84+
BRANCH_NAME: ${{ env.BRANCH_NAME }}
85+
COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }}
86+
CURRENT_PACKAGE: db
87+
FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }}
88+
WORK_PACKAGE_URL: ${{ env.WORK_PACKAGE_URL }}
89+
8190
- name: Install db-mssql.
8291
uses: yiisoft/actions/db/subpackage-install@master
8392
with:

.github/workflows/mutation.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
name: PHP ${{ matrix.php }}
2626

2727
env:
28+
COMPOSER_ROOT_VERSION: dev-master
2829
extensions: pdo, pdo_pgsql, pdo_sqlite
2930

3031
runs-on: ubuntu-latest
@@ -63,6 +64,15 @@ jobs:
6364
- name: Set environment variables pull request linux.
6465
uses: yiisoft/actions/db/environment-linux@master
6566

67+
- name: Install db.
68+
uses: yiisoft/actions/db/subpackage-install@master
69+
with:
70+
BRANCH_NAME: ${{ env.BRANCH_NAME }}
71+
COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }}
72+
CURRENT_PACKAGE: db
73+
FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }}
74+
WORK_PACKAGE_URL: ${{ env.WORK_PACKAGE_URL }}
75+
6676
- name: Install db-pgsql.
6777
uses: yiisoft/actions/db/subpackage-install@master
6878
with:

.github/workflows/mysql.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ jobs:
7070
- name: Set environment variables pull request linux.
7171
uses: yiisoft/actions/db/environment-linux@master
7272

73+
- name: Install db.
74+
uses: yiisoft/actions/db/subpackage-install@master
75+
with:
76+
BRANCH_NAME: ${{ env.BRANCH_NAME }}
77+
COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }}
78+
CURRENT_PACKAGE: db
79+
FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }}
80+
WORK_PACKAGE_URL: ${{ env.WORK_PACKAGE_URL }}
81+
7382
- name: Install db-mysql.
7483
uses: yiisoft/actions/db/subpackage-install@master
7584
with:

.github/workflows/oracle.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,15 @@ jobs:
7474
- name: Set environment variables pull request linux.
7575
uses: yiisoft/actions/db/environment-linux@master
7676

77+
- name: Install db.
78+
uses: yiisoft/actions/db/subpackage-install@master
79+
with:
80+
BRANCH_NAME: ${{ env.BRANCH_NAME }}
81+
COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }}
82+
CURRENT_PACKAGE: db
83+
FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }}
84+
WORK_PACKAGE_URL: ${{ env.WORK_PACKAGE_URL }}
85+
7786
- name: Install db-oracle.
7887
uses: yiisoft/actions/db/subpackage-install@master
7988
with:

.github/workflows/pgsql.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ jobs:
7070
- name: Set environment variables pull request linux.
7171
uses: yiisoft/actions/db/environment-linux@master
7272

73+
- name: Install db.
74+
uses: yiisoft/actions/db/subpackage-install@master
75+
with:
76+
BRANCH_NAME: ${{ env.BRANCH_NAME }}
77+
COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }}
78+
CURRENT_PACKAGE: db
79+
FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }}
80+
WORK_PACKAGE_URL: ${{ env.WORK_PACKAGE_URL }}
81+
7382
- name: Install db-pgsql.
7483
uses: yiisoft/actions/db/subpackage-install@master
7584
with:

.github/workflows/sqlite.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,15 @@ jobs:
6868
if: matrix.os == 'windows-latest'
6969
uses: yiisoft/actions/db/environment-windows@master
7070

71+
- name: Install db.
72+
uses: yiisoft/actions/db/subpackage-install@master
73+
with:
74+
BRANCH_NAME: ${{ env.BRANCH_NAME }}
75+
COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }}
76+
CURRENT_PACKAGE: db
77+
FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }}
78+
WORK_PACKAGE_URL: ${{ env.WORK_PACKAGE_URL }}
79+
7180
- name: Install db-sqlite.
7281
uses: yiisoft/actions/db/subpackage-install@master
7382
with:

.github/workflows/static.yml

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,47 @@ name: static analysis
2020

2121
jobs:
2222
psalm:
23-
uses: yiisoft/actions/.github/workflows/psalm.yml@master
24-
with:
25-
os: >-
26-
['ubuntu-latest']
27-
php: >-
28-
['8.1', '8.2', '8.3']
23+
name: PHP ${{ matrix.php }}
24+
25+
env:
26+
COMPOSER_ROOT_VERSION: dev-master
27+
extensions: pdo
28+
29+
runs-on: ubuntu-latest
30+
31+
strategy:
32+
matrix:
33+
php:
34+
- 8.1
35+
- 8.2
36+
- 8.3
37+
38+
steps:
39+
- name: Checkout.
40+
uses: actions/checkout@v4
41+
42+
- name: Install PHP with extensions.
43+
uses: shivammathur/setup-php@v2
44+
with:
45+
php-version: ${{ matrix.php }}
46+
extensions: ${{ env.extensions }}
47+
coverage: none
48+
tools: cs2pr
49+
50+
- name: Update composer.
51+
run: composer self-update
52+
53+
- name: Set environment variables pull request linux.
54+
uses: yiisoft/actions/db/environment-linux@master
55+
56+
- name: Install db.
57+
uses: yiisoft/actions/db/subpackage-install@master
58+
with:
59+
BRANCH_NAME: ${{ env.BRANCH_NAME }}
60+
COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }}
61+
CURRENT_PACKAGE: db
62+
FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }}
63+
WORK_PACKAGE_URL: ${{ env.WORK_PACKAGE_URL }}
64+
65+
- name: Static analysis.
66+
run: vendor/bin/psalm --config=${{ inputs.psalm-config }} --shepherd --stats --output-format=github --php-version=${{ matrix.php }}

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# Yii DB Migration Change Log
22

3-
## 1.2.1 under development
3+
## 2.0.0 under development
44

55
- Enh #274: Refactor for compatibility with `yiisoft/db` package (@Tigrov)
66
- Bug #277: Fix when there is a namespace but the directory does not exist (@Tigrov)
7+
- Chg #279: Use `ColumnBuilder` class to create table column definitions (@Tigrov)
78

89
## 1.2.0 November 27, 2024
910

UPGRADE.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Upgrading Instructions for Yii DB Migration
2+
3+
This file contains the upgrade notes. These notes highlight changes that could break your
4+
application when you upgrade the package from one version to another.
5+
6+
> **Important!** The following upgrading instructions are cumulative. That is, if you want
7+
> to upgrade from version A to version C and there is version B between A and C, you need
8+
> to following the instructions for both A and B.
9+
10+
## Upgrade from 1.x to 2.x
11+
12+
Use `\Yiisoft\Db\Schema\Column\ColumnBuilder` to create table column definitions.
13+
14+
```php
15+
use Yiisoft\Db\Migration\MigrationBuilder;
16+
use Yiisoft\Db\Schema\Column\ColumnBuilder;
17+
18+
/** @var MigrationBuilder $b */
19+
$b->createTable('user', [
20+
'id' => ColumnBuilder::primaryKey(),
21+
'name' => ColumnBuilder::string(64)->notNull(),
22+
'age' => ColumnBuilder::integer(),
23+
'created_at' => ColumnBuilder::timestamp(),
24+
]);
25+
```

0 commit comments

Comments
 (0)