ENUM types will no longer in Postgres
Postgres will now add enum's values on .sync() if you were to add
entires into the attribute's.value. It'll also add the enum type in
the proper order. For example:
```js
Table = sequelize.define...
mood: {
type: DataTypes.ENUM,
values: ['happy', 'sad']
}
// For some reason down the road you redefine the same table
// ...
mood: {
type: DataTypes.ENUM,
values: ['neutral', 'happy', 'sad', 'joyful']
}
```
Will result in the following SQL:
```sql
ALTER TYPE "...enumTypeName..." ADD VALUE 'neutral' BEFORE 'happy';
ALTER TYPE "...enumTypeName..." ADD VALUE 'jouful' AFTER 'sad';
```
- ```.drop()``` will now pass the options object through (optional)
- Added Postgres.QueryGenerator.pgListEnums(tableName=null,
attrName=null, options) which lists all of the ENUM types for
Postgres, if you don't specify an attribute and tablename then
Sequelize will list all of the Enums
- Added Postgres.QueryGenerator.pgEnumAdd(tableName, attr, value,
options) which will alter the enum type and add values
- Added Postgres.QueryGenerator.pgEnumDrop(tableName, attr) which
will drop the enum type
- Postgres.QueryGenerator.pgEnum() will no longer try to drop the
type unless {force: true} within the ```.sync()``` commands
- Refactored ```QueryInterface.createTable()``` in order to allow
Postgres to create enum types explicitly rather than from
Postgres.```QueryGenerator.createTable()```
- Refactored QueryInterface.dropTable() -- same as ```createTable()```
changes .. also {force: true/force} will now set options.cascade
- QueryInterface.dropAllTables() will now correctly add a quote
identifier to table names for MySQL
Closes https://github.com/sequelize/sequelize/issues/546
Showing
with
259 additions
and
21 deletions
-
Please register or sign in to post a comment