Cli: db:seed:undo not working

Created on 4 Oct 2017  路  8Comments  路  Source: sequelize/cli

Hi there, according to the documentation in http://docs.sequelizejs.com/manual/tutorial/migrations.html#undoing-seeds, I should be able to undo the most recent seed with db:seed:undo. However, after running node_modules/.bin/sequelize db:seed:undo, the data created by the latest seed are still in the DB.

And if I run node_modules/.bin/sequelize db:seed:undo:all, it is working fine to undo all seeds.

I'm not sure is that related to the warning CLI v3 is not fully compatible to Sequelize v4.

Thanks.

refs sequelize/sequelize#8421

What are you doing?

I would like to undo the last data seed with

node_modules/.bin/sequelize db:seed:undo

What do you expect to happen?

The latest seed should be reverted

What is actually happening?

No data removed, and got the follow output:

Sequelize CLI [Node: 6.11.1, CLI: 3.0.0, ORM: 4.13.2]

WARNING: This version of Sequelize CLI is not fully compatible with Sequelize v4. https://github.com/sequelize/cli#sequelize-support

Loaded configuration file "config/database.json".
Using environment "development".
sequelize deprecated String based operators are now deprecated. Please use Symbol based operators for better security, read more at http://docs.sequelizejs.com/manual/tutorial/querying.html#operators node_modules/sequelize/lib/sequelize.js:236:13

__Dialect:__ postgres
__Dialect version:__ pg: 7.3.0, pg-hstore: 2.3.2
__Database version:__ PostgreSQL 9.6.5 on x86_64-apple-darwin16.7.0, compiled by Apple LLVM version 8.1.0 (clang-802.0.42), 64-bit
__Sequelize version:__ 4.13.2
__Sequelize CLI version:__ 3.0.0

docs feature

Most helpful comment

@Taylor123

sequelize db:seed:undo --seed '[seedName]'

(without .js and the path, just like in the storage)

Be careful, you can "undo" multiple times the seed (it doesn't check the storage)

+1, it needs to match migration stuff.
EDIT: and to be documented

All 8 comments

I think if no argument is passed to this command then it should undo the seed to match with migrate:undo

Need to change its description hence docs tag

Docs seem to still be outdated. --help in the cli does not say how to flag the seed file to undo.

What's the proper way to do so? Thanks!

@Taylor123

sequelize db:seed:undo --seed '[seedName]'

(without .js and the path, just like in the storage)

Be careful, you can "undo" multiple times the seed (it doesn't check the storage)

+1, it needs to match migration stuff.
EDIT: and to be documented

Status of this ?

@Taylor123

sequelize db:seed:undo --seed '[seedName]'

(without .js and the path, just like in the storage)

Be careful, you can "undo" multiple times the seed (it doesn't check the storage)

+1, it needs to match migration stuff.
EDIT: and to be documented

Thanks, we have been struggling with this for several hours and could not find anything in docs.
This worked for us.

sequelize db:seed:undo is still not reverting last seed for me :(

Is there a way to merge @empeje PR ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

eharoldreyes picture eharoldreyes  路  3Comments

TomerRon picture TomerRon  路  3Comments

LucasBadico picture LucasBadico  路  5Comments

TangMonk picture TangMonk  路  3Comments

papb picture papb  路  3Comments