slush-sequelize
v0.2.0
Published
Slush generator for sequelize migrations
Downloads
3
Readme
slush-sequelize
Slush generator for sequelize migrations, a la Rails
Example
.sequelizerc
module.exports = {
'migrations-path': 'db/migrate'
};
terminal
# Generate migration to create a users table
$ slush sequelize:migration CreateUsers name:string email isAdmin:boolean
Tasks
sequelize:migration <command> <attributes>
<command>
The command to generate, this includes the name of the migration and the table name.
<attributes>
One or more <attribute>
separated by spaces.
<attribute>
The attribute name and type separated by a colon. E.g. firstName:string
, isAdmin:boolean
Commands
Create*<table>* <attributes>
Generate migration to create a new table.
Example: CreateUsers name:string email:string isAdmin:boolean
Drop*<table>*
Generate migration to drop an existing table.
Examples: DropUsers
Add*<keyword>To<table>* <columns>
Generate a migration to add columns to an existing table. The <keyword> is only used
to give a name to the migration file.
Example: AddMembershipStateToUsers isActive:boolean activatedOn:datetime deactivatedOn:datetime
Remove*<keyword>From<table>* <columns>
Generate a migration to remove columns from an existing table. The <keyword> is only used
to give a name to the migration file.
Example: RemoveMembershipStateToUsers isActive:boolean activatedOn:datetime deactivatedOn:datetime
Add*<indextype>IndexTo<table>* <columns>
Generate a migration to add an index with a given type to an existing table associated with given columns. The supported index types.
Examples: AddUniqueIndexToUsers email
, AddIndexToUsers firstName lastName
RemoveIndexFrom*<table>* <columns>
Generate a migration to remove an index from the "users" table associated with the email column.
Example: RemoveUniqueIndexFromUsers email
Configuration
migrations-path
Type: string
Use .sequelizerc
file to configure a custom migrations path, default path is ./migrations
;