You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -336,7 +336,7 @@ Defines a table to be created or updated in the database.
336
336
| schema | <code>Object</code> | An object that defines the table's schema. See the [Defining Table Schemas](#defining-table-schemas) section. |
337
337
|[migrationStrategy]| <code>string</code> | One of `safe`, `alter`, or `drop`. This will override the `migrationStrategy` value from the [`config`](#module_mysql-plus..createPool) (but is still subject to the same restrictions in production environments). |
338
338
339
-
**Returns**: <code>[MySQLTable](#MySQLTable)</code> - A `MySQLTable` instance that lets you perform queries on the table.
339
+
**Returns**: <code>[MySQLTable](#MySQLTable)</code> - A `MySQLTable` instance that has methods for performing queries on the table.
@@ -830,7 +830,7 @@ fails because of a unique key constraint).
830
830
831
831
| Param | Type | Description |
832
832
|:--- |:--- |:--- |
833
-
| data | <code>Object</code> | An object mapping column names to data values to insert. The values are escaped by default. If you don't want a value to be escaped, create a "raw" value (see the last example below). |
833
+
| data | <code>Object</code> | An object mapping column names to data values to insert. |
834
834
| keyColumns | <code>Array.<string></code> | The names of columns in the `data` object. If there is already a row in the table with the same values for these columns as the values being inserted, the data will not be inserted. |
835
835
|[cb]| <code>[queryCallback](#module_mysql-plus..queryCallback)</code> | A callback that gets called with the results of the query. |
836
836
@@ -886,7 +886,7 @@ optional but at least one of them must be specified.
886
886
887
887
| Param | Type | Description |
888
888
|:--- |:--- |:--- |
889
-
|[data]| <code>Object</code> | An object of (column name)-(data value) pairs that define the new column values. This object will be escaped by `mysql.escape()` so if you want to use more sophisticated SQL (such as a MySQL function) to update a column's value, you'll need to use the `sqlString` argument instead. |
889
+
|[data]| <code>Object</code> | An object of (column name)-(data value) pairs that define the new column values. |
890
890
|[sqlString]| <code>string</code> | SQL to be appended to the query after the `SET data` clause or immediately after `SET ` if `data` is omitted. |
891
891
|[values]| <code>Array</code> | Values to replace the placeholders in `sqlString` (and/or `data`). |
892
892
|[cb]| <code>[queryCallback](#module_mysql-plus..queryCallback)</code> | A callback that gets called with the results of the query. |
@@ -1011,7 +1014,7 @@ The possible migration strategies are as follows:
1011
1014
+`alter` - default in a development environment
1012
1015
+`drop`
1013
1016
1014
-
In addition to being the default in a production environment, the `safe` strategy is the only allowed strategy in production. This means that if `alter` or `drop` are used anywhere to configure your connections or tables, they will be ignored and `safe` will be used instead. However, if you really want to use `alter` in production, you may set the `allowAlterInProduction` option to `true` in your[Pool configuration](#mysql-pluscreatepoolconfig--poolplus).
1017
+
In addition to being the default in a production environment, the `safe` strategy is the only allowed strategy in production. This means that if `alter` or `drop` are used anywhere to configure connections or tables, they will be ignored and `safe` will be used instead. However, it is possible to override this behavior to allow the `alter`strategy in production by setting the `allowAlterInProduction` option to `true` in the[Pool configuration](#mysql-pluscreatepoolconfig--poolplus).
1015
1018
1016
1019
### safe
1017
1020
@@ -1021,9 +1024,9 @@ Only allows newly-defined tables to be created. Existing tables are never change
1021
1024
1022
1025
Specifies that newly-defined tables will be created, existing tables that are no longer defined will be dropped, and existing tables that have a different definition from what is found in the database will be migrated with minimal data-loss.
1023
1026
1024
-
**To rename table columns**, you must specify the column's old name in the [column definition](#columndefinition) with the `.oldName('name')` method. If you don't, the column will be dropped and you will lose all of the data that was in that column.
1027
+
**To rename table columns**, the column's old name must be specified in the [column definition](#columndefinition) with the `.oldName('name')` method. If it is not, the column will be dropped and all of the data that was in that column will be lost.
1025
1028
1026
-
**Note:** It is up to you to understand how changes to an existing table might affect the data. For example, changing a DOUBLE column to a FLOAT will cause the precision of the value to be reduced so you may lose some significant digits (i.e. `1.123456789` would be reduced to `1.12346`). Furthermore, some changes to tables cannot be done and will cause an error. An example of this would be adding a column with the `NOT NULL` attribute to a non-empty table without specifying a default value.
1029
+
**Note:** It is up to you to understand how changes to an existing table might affect the data. For example, changing a DOUBLE column to a FLOAT will cause the precision of the value to be reduced so some significant digits may be lost (i.e. `1.123456789` would be reduced to `1.12346`). Furthermore, some changes to tables cannot be done and will cause an error. An example of this would be adding a column with the `NOT NULL` attribute to a non-empty table without specifying a default value.
1027
1030
1028
1031
### drop
1029
1032
@@ -1054,7 +1057,7 @@ Columns are defined using the `column` property which is an object where the key
1054
1057
}
1055
1058
```
1056
1059
1057
-
See the [Column Types](#column-types) section for all possible column types and attributes that you can define.
1060
+
See the [Column Types](#column-types) section for all possible column types and attributes that can be defined.
1058
1061
1059
1062
### Keys
1060
1063
@@ -1065,7 +1068,7 @@ The following properties can be used to define different types of keys:
1065
1068
+[`indexes`](#indexes--arraystringstring)
1066
1069
+[`spatialIndexes`](#spatialindexes--string)
1067
1070
1068
-
Note that [column definitions](#columndefinition) allow you to define these keys directly on the column. If you use that method of defining a key for a column, you should not define the key again using one of these properties.
1071
+
Note that [column definitions](#columndefinition) allow these keys to be defined directly on the column. If that method of defining a key for a column is used, the key should not be defined again using one of these properties (otherwise it will be duplicated).
1069
1072
1070
1073
#### `primaryKey` : `string|string[]`
1071
1074
@@ -1139,7 +1142,7 @@ If an object, it should have the following properties:
Alternatively, you can use a shorthand string that has the following form:
1145
+
Alternatively, a shorthand string that has the following form may be used:
1143
1146
1144
1147
```js
1145
1148
'<table>.<column> [reference_option]'// `[reference_option]` is optional
@@ -1221,7 +1224,7 @@ These schema properties configure table-level options. The options currently sup
1221
1224
}
1222
1225
```
1223
1226
1224
-
**Note:** After explicitly defining a table option in your schema, if you remove it from your schema and resync your table definitions, the table option will not change in the database. If you want to go back to the default value for the table option, you'll need to explicitly define it on your schema and resync the table (or manually change it on the command line), and then you may remove it from your schema.
1227
+
**Note:** After explicitly defining a table option in a schema, if you remove it from the schema and resync your table definitions, the table option will not change in the database. To go back to the default value for the table option, you'll need to explicitly define it on the schema and resync the table (or manually change it on the command line), and then you may remove it from the schema.
1225
1228
1226
1229
## Column Types
1227
1230
@@ -1358,7 +1361,7 @@ Compatible types:
1358
1361
1359
1362
+`timestamp`
1360
1363
1361
-
There aren't any extra methods on this type, but there are some things you should be aware of with `timestamp` columns:
1364
+
There aren't any extra methods on this type, but there are some things to be aware of with `timestamp` columns:
1362
1365
1363
1366
##### NULL Timestamps
1364
1367
@@ -1378,7 +1381,7 @@ would define a column with this SQL:
1378
1381
1379
1382
##### Timestamps' DEFAULT value
1380
1383
1381
-
If you define a timestamp column and use the `notNull()` method, the column's `DEFAULT` value will be set to `CURRENT_TIMESTAMP`. So the following:
1384
+
If a timestamp column is defined with the `notNull()` method, the column's `DEFAULT` value will be set to `CURRENT_TIMESTAMP`. So the following:
Copy file name to clipboardExpand all lines: jsdoc2md/README.hbs
+9-9Lines changed: 9 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -113,7 +113,7 @@ The possible migration strategies are as follows:
113
113
+ `alter` - default in a development environment
114
114
+ `drop`
115
115
116
-
In addition to being the default in a production environment, the `safe` strategy is the only allowed strategy in production. This means that if `alter` or `drop` are used anywhere to configure your connections or tables, they will be ignored and `safe` will be used instead. However, if you really want to use `alter` in production, you may set the `allowAlterInProduction` option to `true` in your [Pool configuration](#mysql-pluscreatepoolconfig--poolplus).
116
+
In addition to being the default in a production environment, the `safe` strategy is the only allowed strategy in production. This means that if `alter` or `drop` are used anywhere to configure connections or tables, they will be ignored and `safe` will be used instead. However, it is possible to override this behavior to allow the `alter` strategy in production by setting the `allowAlterInProduction` option to `true` in the [Pool configuration](#mysql-pluscreatepoolconfig--poolplus).
117
117
118
118
### safe
119
119
@@ -123,9 +123,9 @@ Only allows newly-defined tables to be created. Existing tables are never change
123
123
124
124
Specifies that newly-defined tables will be created, existing tables that are no longer defined will be dropped, and existing tables that have a different definition from what is found in the database will be migrated with minimal data-loss.
125
125
126
-
**To rename table columns**, you must specify the column's old name in the [column definition](#columndefinition) with the `.oldName('name')` method. If you don't, the column will be dropped and you will lose all of the data that was in that column.
126
+
**To rename table columns**, the column's old name must be specified in the [column definition](#columndefinition) with the `.oldName('name')` method. If it is not, the column will be dropped and all of the data that was in that column will be lost.
127
127
128
-
**Note:** It is up to you to understand how changes to an existing table might affect the data. For example, changing a DOUBLE column to a FLOAT will cause the precision of the value to be reduced so you may lose some significant digits (i.e. `1.123456789` would be reduced to `1.12346`). Furthermore, some changes to tables cannot be done and will cause an error. An example of this would be adding a column with the `NOT NULL` attribute to a non-empty table without specifying a default value.
128
+
**Note:** It is up to you to understand how changes to an existing table might affect the data. For example, changing a DOUBLE column to a FLOAT will cause the precision of the value to be reduced so some significant digits may be lost (i.e. `1.123456789` would be reduced to `1.12346`). Furthermore, some changes to tables cannot be done and will cause an error. An example of this would be adding a column with the `NOT NULL` attribute to a non-empty table without specifying a default value.
129
129
130
130
### drop
131
131
@@ -156,7 +156,7 @@ Columns are defined using the `column` property which is an object where the key
156
156
}
157
157
```
158
158
159
-
See the [Column Types](#column-types) section for all possible column types and attributes that you can define.
159
+
See the [Column Types](#column-types) section for all possible column types and attributes that can be defined.
160
160
161
161
### Keys
162
162
@@ -167,7 +167,7 @@ The following properties can be used to define different types of keys:
167
167
+ [`indexes`](#indexes--arraystringstring)
168
168
+ [`spatialIndexes`](#spatialindexes--string)
169
169
170
-
Note that [column definitions](#columndefinition) allow you to define these keys directly on the column. If you use that method of defining a key for a column, you should not define the key again using one of these properties.
170
+
Note that [column definitions](#columndefinition) allow these keys to be defined directly on the column. If that method of defining a key for a column is used, the key should not be defined again using one of these properties (otherwise it will be duplicated).
171
171
172
172
#### `primaryKey` : `string|string[]`
173
173
@@ -241,7 +241,7 @@ If an object, it should have the following properties:
Alternatively, you can use a shorthand string that has the following form:
244
+
Alternatively, a shorthand string that has the following form may be used:
245
245
246
246
```js
247
247
'<table>.<column> [reference_option]' // `[reference_option]` is optional
@@ -323,7 +323,7 @@ These schema properties configure table-level options. The options currently sup
323
323
}
324
324
```
325
325
326
-
**Note:** After explicitly defining a table option in your schema, if you remove it from your schema and resync your table definitions, the table option will not change in the database. If you want to go back to the default value for the table option, you'll need to explicitly define it on your schema and resync the table (or manually change it on the command line), and then you may remove it from your schema.
326
+
**Note:** After explicitly defining a table option in a schema, if you remove it from the schema and resync your table definitions, the table option will not change in the database. To go back to the default value for the table option, you'll need to explicitly define it on the schema and resync the table (or manually change it on the command line), and then you may remove it from the schema.
327
327
328
328
## Column Types
329
329
@@ -460,7 +460,7 @@ Compatible types:
460
460
461
461
+ `timestamp`
462
462
463
-
There aren't any extra methods on this type, but there are some things you should be aware of with `timestamp` columns:
463
+
There aren't any extra methods on this type, but there are some things to be aware of with `timestamp` columns:
464
464
465
465
##### NULL Timestamps
466
466
@@ -480,7 +480,7 @@ would define a column with this SQL:
480
480
481
481
##### Timestamps' DEFAULT value
482
482
483
-
If you define a timestamp column and use the `notNull()` method, the column's `DEFAULT` value will be set to `CURRENT_TIMESTAMP`. So the following:
483
+
If a timestamp column is defined with the `notNull()` method, the column's `DEFAULT` value will be set to `CURRENT_TIMESTAMP`. So the following:
0 commit comments