Skip to content

Commit 5f89df9

Browse files
committed
fix(mysql): deprecate column width/zerofill
1 parent 8472b64 commit 5f89df9

24 files changed

+263
-233
lines changed

README-zh_CN.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -531,11 +531,11 @@ createConnection({
531531
+-------------+--------------+----------------------------+
532532
| photo |
533533
+-------------+--------------+----------------------------+
534-
| id | int(11) | PRIMARY KEY AUTO_INCREMENT |
534+
| id | int | PRIMARY KEY AUTO_INCREMENT |
535535
| name | varchar(100) | |
536536
| description | text | |
537537
| filename | varchar(255) | |
538-
| views | int(11) | |
538+
| views | int | |
539539
| isPublished | boolean | |
540540
+-------------+--------------+----------------------------+
541541
```
@@ -770,13 +770,13 @@ export class PhotoMetadata {
770770
+-------------+--------------+----------------------------+
771771
| photo_metadata |
772772
+-------------+--------------+----------------------------+
773-
| id | int(11) | PRIMARY KEY AUTO_INCREMENT |
774-
| height | int(11) | |
775-
| width | int(11) | |
773+
| id | int | PRIMARY KEY AUTO_INCREMENT |
774+
| height | int | |
775+
| width | int | |
776776
| comment | varchar(255) | |
777777
| compressed | boolean | |
778778
| orientation | varchar(255) | |
779-
| photoId | int(11) | FOREIGN KEY |
779+
| photoId | int | FOREIGN KEY |
780780
+-------------+--------------+----------------------------+
781781
```
782782

@@ -1009,7 +1009,7 @@ export class Photo {
10091009
+-------------+--------------+----------------------------+
10101010
| author |
10111011
+-------------+--------------+----------------------------+
1012-
| id | int(11) | PRIMARY KEY AUTO_INCREMENT |
1012+
| id | int | PRIMARY KEY AUTO_INCREMENT |
10131013
| name | varchar(255) | |
10141014
+-------------+--------------+----------------------------+
10151015
```
@@ -1020,12 +1020,12 @@ export class Photo {
10201020
+-------------+--------------+----------------------------+
10211021
| photo |
10221022
+-------------+--------------+----------------------------+
1023-
| id | int(11) | PRIMARY KEY AUTO_INCREMENT |
1023+
| id | int | PRIMARY KEY AUTO_INCREMENT |
10241024
| name | varchar(255) | |
10251025
| description | varchar(255) | |
10261026
| filename | varchar(255) | |
10271027
| isPublished | boolean | |
1028-
| authorId | int(11) | FOREIGN KEY |
1028+
| authorId | int | FOREIGN KEY |
10291029
+-------------+--------------+----------------------------+
10301030
```
10311031

@@ -1075,8 +1075,8 @@ export class Photo {
10751075
+-------------+--------------+----------------------------+
10761076
| album_photos_photo_albums |
10771077
+-------------+--------------+----------------------------+
1078-
| album_id | int(11) | PRIMARY KEY FOREIGN KEY |
1079-
| photo_id | int(11) | PRIMARY KEY FOREIGN KEY |
1078+
| album_id | int | PRIMARY KEY FOREIGN KEY |
1079+
| photo_id | int | PRIMARY KEY FOREIGN KEY |
10801080
+-------------+--------------+----------------------------+
10811081
```
10821082

README_ko.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -522,11 +522,11 @@ createConnection({
522522
+-------------+--------------+----------------------------+
523523
| photo |
524524
+-------------+--------------+----------------------------+
525-
| id | int(11) | PRIMARY KEY AUTO_INCREMENT |
525+
| id | int | PRIMARY KEY AUTO_INCREMENT |
526526
| name | varchar(100) | |
527527
| description | text | |
528528
| filename | varchar(255) | |
529-
| views | int(11) | |
529+
| views | int | |
530530
| isPublished | boolean | |
531531
+-------------+--------------+----------------------------+
532532
```
@@ -757,13 +757,13 @@ export class PhotoMetadata {
757757
+-------------+--------------+----------------------------+
758758
| photo_metadata |
759759
+-------------+--------------+----------------------------+
760-
| id | int(11) | PRIMARY KEY AUTO_INCREMENT |
761-
| height | int(11) | |
762-
| width | int(11) | |
760+
| id | int | PRIMARY KEY AUTO_INCREMENT |
761+
| height | int | |
762+
| width | int | |
763763
| comment | varchar(255) | |
764764
| compressed | boolean | |
765765
| orientation | varchar(255) | |
766-
| photoId | int(11) | FOREIGN KEY |
766+
| photoId | int | FOREIGN KEY |
767767
+-------------+--------------+----------------------------+
768768
```
769769

@@ -998,7 +998,7 @@ N:1/1:N 관계에서 소유자측은 항상 다대일(ManyToOne)이다. 즉 `@Ma
998998
+-------------+--------------+----------------------------+
999999
| author |
10001000
+-------------+--------------+----------------------------+
1001-
| id | int(11) | PRIMARY KEY AUTO_INCREMENT |
1001+
| id | int | PRIMARY KEY AUTO_INCREMENT |
10021002
| name | varchar(255) | |
10031003
+-------------+--------------+----------------------------+
10041004
```
@@ -1009,12 +1009,12 @@ N:1/1:N 관계에서 소유자측은 항상 다대일(ManyToOne)이다. 즉 `@Ma
10091009
+-------------+--------------+----------------------------+
10101010
| photo |
10111011
+-------------+--------------+----------------------------+
1012-
| id | int(11) | PRIMARY KEY AUTO_INCREMENT |
1012+
| id | int | PRIMARY KEY AUTO_INCREMENT |
10131013
| name | varchar(255) | |
10141014
| description | varchar(255) | |
10151015
| filename | varchar(255) | |
10161016
| isPublished | boolean | |
1017-
| authorId | int(11) | FOREIGN KEY |
1017+
| authorId | int | FOREIGN KEY |
10181018
+-------------+--------------+----------------------------+
10191019
```
10201020

@@ -1064,8 +1064,8 @@ export class Photo {
10641064
+-------------+--------------+----------------------------+
10651065
| album_photos_photo_albums |
10661066
+-------------+--------------+----------------------------+
1067-
| album_id | int(11) | PRIMARY KEY FOREIGN KEY |
1068-
| photo_id | int(11) | PRIMARY KEY FOREIGN KEY |
1067+
| album_id | int | PRIMARY KEY FOREIGN KEY |
1068+
| photo_id | int | PRIMARY KEY FOREIGN KEY |
10691069
+-------------+--------------+----------------------------+
10701070
```
10711071

docs/docs/entity/1-entities.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ export class User {
2626

2727
This will create following database table:
2828

29-
```shell
29+
```text
3030
+-------------+--------------+----------------------------+
3131
| user |
3232
+-------------+--------------+----------------------------+
33-
| id | int(11) | PRIMARY KEY AUTO_INCREMENT |
33+
| id | int | PRIMARY KEY AUTO_INCREMENT |
3434
| firstName | varchar(255) | |
3535
| lastName | varchar(255) | |
3636
| isActive | boolean | |
@@ -205,12 +205,6 @@ For example:
205205
@Column("varchar", { length: 200 })
206206
```
207207

208-
or
209-
210-
```typescript
211-
@Column({ type: "int", width: 200 })
212-
```
213-
214208
> Note about `bigint` type: `bigint` column type, used in SQL databases, doesn't fit into the regular `number` type and maps property to a `string` instead.
215209
216210
### `enum` column type
@@ -393,7 +387,6 @@ List of available options in `ColumnOptions`:
393387
You can change it by specifying your own name.
394388

395389
- `length: number` - Column type's length. For example if you want to create `varchar(150)` type you specify column type and length options.
396-
- `width: number` - column type's display width. Used only for [MySQL integer types](https://dev.mysql.com/doc/refman/5.7/en/integer-types.html)
397390
- `onUpdate: string` - `ON UPDATE` trigger. Used only in [MySQL](https://dev.mysql.com/doc/refman/5.7/en/timestamp-initialization.html).
398391
- `nullable: boolean` - Makes column `NULL` or `NOT NULL` in the database. By default column is `nullable: false`.
399392
- `update: boolean` - Indicates if column value is updated by "save" operation. If false, you'll be able to write this value only when you first time insert the object. Default value is `true`.
@@ -406,7 +399,6 @@ List of available options in `ColumnOptions`:
406399
- `precision: number` - The precision for a decimal (exact numeric) column (applies only for decimal column), which is the maximum
407400
number of digits that are stored for the values. Used in some column types.
408401
- `scale: number` - The scale for a decimal (exact numeric) column (applies only for decimal column), which represents the number of digits to the right of the decimal point and must not be greater than precision. Used in some column types.
409-
- `zerofill: boolean` - Puts `ZEROFILL` attribute on to a numeric column. Used only in MySQL. If `true`, MySQL automatically adds the `UNSIGNED` attribute to this column.
410402
- `unsigned: boolean` - Puts `UNSIGNED` attribute on to a numeric column. Used only in MySQL.
411403
- `charset: string` - Defines a column character set. Not supported by all database types.
412404
- `collation: string` - Defines a column collation.

docs/docs/entity/2-embedded-entities.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,11 @@ export class Student {
133133

134134
All columns defined in the `Name` entity will be merged into `user`, `employee` and `student`:
135135

136-
```shell
136+
```text
137137
+-------------+--------------+----------------------------+
138138
| user |
139139
+-------------+--------------+----------------------------+
140-
| id | int(11) | PRIMARY KEY AUTO_INCREMENT |
140+
| id | int | PRIMARY KEY AUTO_INCREMENT |
141141
| nameFirst | varchar(255) | |
142142
| nameLast | varchar(255) | |
143143
| isActive | boolean | |
@@ -146,16 +146,16 @@ All columns defined in the `Name` entity will be merged into `user`, `employee`
146146
+-------------+--------------+----------------------------+
147147
| employee |
148148
+-------------+--------------+----------------------------+
149-
| id | int(11) | PRIMARY KEY AUTO_INCREMENT |
149+
| id | int | PRIMARY KEY AUTO_INCREMENT |
150150
| nameFirst | varchar(255) | |
151151
| nameLast | varchar(255) | |
152-
| salary | int(11) | |
152+
| salary | int | |
153153
+-------------+--------------+----------------------------+
154154
155155
+-------------+--------------+----------------------------+
156156
| student |
157157
+-------------+--------------+----------------------------+
158-
| id | int(11) | PRIMARY KEY AUTO_INCREMENT |
158+
| id | int | PRIMARY KEY AUTO_INCREMENT |
159159
| nameFirst | varchar(255) | |
160160
| nameLast | varchar(255) | |
161161
| faculty | varchar(255) | |

docs/docs/getting-started.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -504,11 +504,11 @@ Now if you run your `index.ts`, a connection with the database will be initializ
504504
+-------------+--------------+----------------------------+
505505
| photo |
506506
+-------------+--------------+----------------------------+
507-
| id | int(11) | PRIMARY KEY AUTO_INCREMENT |
507+
| id | int | PRIMARY KEY AUTO_INCREMENT |
508508
| name | varchar(100) | |
509509
| description | text | |
510510
| filename | varchar(255) | |
511-
| views | int(11) | |
511+
| views | int | |
512512
| isPublished | boolean | |
513513
+-------------+--------------+----------------------------+
514514
```
@@ -703,13 +703,13 @@ If you run the app, you'll see a newly generated table, and it will contain a co
703703
+-------------+--------------+----------------------------+
704704
| photo_metadata |
705705
+-------------+--------------+----------------------------+
706-
| id | int(11) | PRIMARY KEY AUTO_INCREMENT |
707-
| height | int(11) | |
708-
| width | int(11) | |
706+
| id | int | PRIMARY KEY AUTO_INCREMENT |
707+
| height | int | |
708+
| width | int | |
709709
| comment | varchar(255) | |
710710
| compressed | boolean | |
711711
| orientation | varchar(255) | |
712-
| photoId | int(11) | FOREIGN KEY |
712+
| photoId | int | FOREIGN KEY |
713713
+-------------+--------------+----------------------------+
714714
```
715715

@@ -999,7 +999,7 @@ After you run the application, the ORM will create the `author` table:
999999
+-------------+--------------+----------------------------+
10001000
| author |
10011001
+-------------+--------------+----------------------------+
1002-
| id | int(11) | PRIMARY KEY AUTO_INCREMENT |
1002+
| id | int | PRIMARY KEY AUTO_INCREMENT |
10031003
| name | varchar(255) | |
10041004
+-------------+--------------+----------------------------+
10051005
```
@@ -1010,12 +1010,12 @@ It will also modify the `photo` table, adding a new `author` column and creating
10101010
+-------------+--------------+----------------------------+
10111011
| photo |
10121012
+-------------+--------------+----------------------------+
1013-
| id | int(11) | PRIMARY KEY AUTO_INCREMENT |
1013+
| id | int | PRIMARY KEY AUTO_INCREMENT |
10141014
| name | varchar(255) | |
10151015
| description | varchar(255) | |
10161016
| filename | varchar(255) | |
10171017
| isPublished | boolean | |
1018-
| authorId | int(11) | FOREIGN KEY |
1018+
| authorId | int | FOREIGN KEY |
10191019
+-------------+--------------+----------------------------+
10201020
```
10211021

@@ -1067,8 +1067,8 @@ After you run the application, the ORM will create an **album_photos_photo_album
10671067
+-------------+--------------+----------------------------+
10681068
| album_photos_photo_albums |
10691069
+-------------+--------------+----------------------------+
1070-
| album_id | int(11) | PRIMARY KEY FOREIGN KEY |
1071-
| photo_id | int(11) | PRIMARY KEY FOREIGN KEY |
1070+
| album_id | int | PRIMARY KEY FOREIGN KEY |
1071+
| photo_id | int | PRIMARY KEY FOREIGN KEY |
10721072
+-------------+--------------+----------------------------+
10731073
```
10741074

docs/docs/help/3-decorator-reference.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export class User {
134134
You can change it by specifying your own name.
135135
- `length: string|number` - Column type's length. For example, if you want to create `varchar(150)` type
136136
you specify column type and length options.
137-
- `width: number` - column type's display width. Used only for [MySQL integer types](https://dev.mysql.com/doc/refman/5.7/en/integer-types.html)
137+
- `width: number` - column type's display width. Used only for [MySQL integer types](https://dev.mysql.com/doc/refman/5.7/en/integer-types.html). _Deprecated_ in newer MySQL versions, will be removed from TypeORM in an upcoming version.
138138
- `onUpdate: string` - `ON UPDATE` trigger. Used only in [MySQL](https://dev.mysql.com/doc/refman/5.7/en/timestamp-initialization.html).
139139
- `nullable: boolean` - determines whether the column can become `NULL` or always has to be `NOT NULL`. By default column is `nullable: false`.
140140
- `update: boolean` - Indicates if column value is updated by "save" operation. If false, you'll be able to write this value only when you first time insert the object.
@@ -150,8 +150,7 @@ export class User {
150150
- `scale: number` - The scale for a decimal (exact numeric) column (applies only for decimal column),
151151
which represents the number of digits to the right of the decimal point and must not be greater than precision.
152152
Used in some column types.
153-
- `zerofill: boolean` - Puts `ZEROFILL` attribute on to a numeric column. Used only in MySQL.
154-
If `true`, MySQL automatically adds the `UNSIGNED` attribute to this column.
153+
- `zerofill: boolean` - Puts `ZEROFILL` attribute on to a numeric column. Used only in MySQL. If `true`, MySQL automatically adds the `UNSIGNED` attribute to this column. _Deprecated_ in newer MySQL versions, will be removed from TypeORM in an upcoming version. Use a character column and the `LPAD` function as suggested by MySQL.
155154
- `unsigned: boolean` - Puts `UNSIGNED` attribute on to a numeric column. Used only in MySQL.
156155
- `charset: string` - Defines a column character set. Not supported by all database types.
157156
- `collation: string` - Defines a column collation.

docs/docs/relations/2-one-to-one-relations.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,21 @@ The side you set `@JoinColumn` on, that side's table will contain a "relation id
5050

5151
This example will produce the following tables:
5252

53-
```shell
53+
```text
5454
+-------------+--------------+----------------------------+
5555
| profile |
5656
+-------------+--------------+----------------------------+
57-
| id | int(11) | PRIMARY KEY AUTO_INCREMENT |
57+
| id | int | PRIMARY KEY AUTO_INCREMENT |
5858
| gender | varchar(255) | |
5959
| photo | varchar(255) | |
6060
+-------------+--------------+----------------------------+
6161
6262
+-------------+--------------+----------------------------+
6363
| user |
6464
+-------------+--------------+----------------------------+
65-
| id | int(11) | PRIMARY KEY AUTO_INCREMENT |
65+
| id | int | PRIMARY KEY AUTO_INCREMENT |
6666
| name | varchar(255) | |
67-
| profileId | int(11) | FOREIGN KEY |
67+
| profileId | int | FOREIGN KEY |
6868
+-------------+--------------+----------------------------+
6969
```
7070

docs/docs/relations/3-many-to-one-one-to-many-relations.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,19 @@ Where you set `@ManyToOne` - its related entity will have "relation id" and fore
4646

4747
This example will produce following tables:
4848

49-
```shell
49+
```text
5050
+-------------+--------------+----------------------------+
5151
| photo |
5252
+-------------+--------------+----------------------------+
53-
| id | int(11) | PRIMARY KEY AUTO_INCREMENT |
53+
| id | int | PRIMARY KEY AUTO_INCREMENT |
5454
| url | varchar(255) | |
55-
| userId | int(11) | FOREIGN KEY |
55+
| userId | int | FOREIGN KEY |
5656
+-------------+--------------+----------------------------+
5757
5858
+-------------+--------------+----------------------------+
5959
| user |
6060
+-------------+--------------+----------------------------+
61-
| id | int(11) | PRIMARY KEY AUTO_INCREMENT |
61+
| id | int | PRIMARY KEY AUTO_INCREMENT |
6262
| name | varchar(255) | |
6363
+-------------+--------------+----------------------------+
6464
```

0 commit comments

Comments
 (0)