Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

db.json gets wiped when a new post is created, is this normal? #2900

Closed
MegaJ opened this issue Dec 11, 2017 · 2 comments
Closed

db.json gets wiped when a new post is created, is this normal? #2900

MegaJ opened this issue Dec 11, 2017 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@MegaJ
Copy link

MegaJ commented Dec 11, 2017

Should hexo new cool-blog-post wipe db.json? I had this happen to me. The reason seems to be that the db object exists, but the data is never loaded. The data gets deleted by lib/plugins/filter/before_exit/save_database.js which calls the database's .save()...but the db is empty so db.json gets written with empty fields.

I tested this on a fresh blog by running hexo init a-blog.

hexo server preserves the db.json (and updates it, I haven't checked), I think because the Hexo.prototype.watch gets called.

Environment Info

Node version(node -v): v8.4.0

Hexo and Plugin version(npm ls --depth 0):
├── hexo@3.4.3
├── hexo-generator-archive@0.1.5
├── hexo-generator-category@0.1.3
├── hexo-generator-index@0.2.1
├── hexo-generator-tag@0.2.0
├── hexo-renderer-ejs@0.3.1
├── hexo-renderer-marked@0.3.0
├── hexo-renderer-stylus@0.3.3
└── hexo-server@0.2.2

For question

So...is this supposed to happen...? If so, why wipe the db?

@NoahDragon
Copy link
Member

NoahDragon commented Dec 16, 2017

I never check the db file while generating posts, will try to reproduce it.

Confirmed, it is a bug.

@SukkaW
Copy link
Member

SukkaW commented Dec 1, 2019

Should be fixed by #3793. The fixes will be deliver with Hexo 4.1.0.

@SukkaW SukkaW added this to the v4.1.0 milestone Dec 1, 2019
@SukkaW SukkaW closed this as completed Dec 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants