不要怂,就是干,撸起袖子干!

Commit af6c76f2 by John Committed by Sushant

(docs) #4768 Add schema examples for migrations (#6304)

Reverted removeColumn value changes

(docs) #4768 Add schema examples for migrations

(docs) #4768 Add schema examples for migrations
1 parent 40342064
Showing with 23 additions and 4 deletions
...@@ -119,8 +119,9 @@ queryInterface.createTable( ...@@ -119,8 +119,9 @@ queryInterface.createTable(
} }
}, },
{ {
engine: 'MYISAM', // default: 'InnoDB' engine: 'MYISAM', // default: 'InnoDB'
charset: 'latin1' // default: null charset: 'latin1', // default: null
schema: 'public' // default: public, PostgreSQL only.
} }
) )
``` ```
...@@ -182,7 +183,7 @@ queryInterface.describeTable('Person').then(function(attributes) { ...@@ -182,7 +183,7 @@ queryInterface.describeTable('Person').then(function(attributes) {
}) })
``` ```
### addColumn(tableName, attributeName, dataTypeOrOptions, options) ### addColumn(tableNameOrOptions, attributeName, dataTypeOrOptions, options)
This method allows adding columns to an existing table. The data type can be simple or complex. This method allows adding columns to an existing table. The data type can be simple or complex.
...@@ -203,14 +204,32 @@ queryInterface.addColumn( ...@@ -203,14 +204,32 @@ queryInterface.addColumn(
allowNull: false allowNull: false
} }
) )
// or with an explicit schema:
queryInterface.addColumn({
tableName: 'Person',
schema: 'public'
},
'signature',
Sequelize.STRING
)
``` ```
### removeColumn(tableName, attributeName, options) ### removeColumn(tableNameOrOptions, attributeName, options)
This method allows deletion of a specific column of an existing table. This method allows deletion of a specific column of an existing table.
```js ```js
queryInterface.removeColumn('Person', 'signature') queryInterface.removeColumn('Person', 'signature')
// or with an explicit schema:
queryInterface.removeColumn({
tableName: 'Person',
schema: 'public'
}, 'signature');
``` ```
### changeColumn(tableName, attributeName, dataTypeOrOptions, options) ### changeColumn(tableName, attributeName, dataTypeOrOptions, options)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!