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

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 22 additions and 3 deletions
......@@ -120,7 +120,8 @@ queryInterface.createTable(
},
{
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) {
})
```
### 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.
......@@ -203,14 +204,32 @@ queryInterface.addColumn(
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.
```js
queryInterface.removeColumn('Person', 'signature')
// or with an explicit schema:
queryInterface.removeColumn({
tableName: 'Person',
schema: 'public'
}, 'signature');
```
### 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!