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

Feature Request: seed:run should print the file name of the failing seed #2972

Closed
Wintereise opened this Issue Dec 25, 2018 · 4 comments

Comments

Projects
None yet
2 participants
@Wintereise
Copy link

Wintereise commented Dec 25, 2018

Environment

Knex version: 0.15.2
Database + version: PostgreSQL 10.6
OS: Ubuntu Linux

Feature discussion / request

  1. Why

When seed:run is called and something goes wrong (perhaps due to a DB constraint), Knex does NOT print which exact seed file the issue happened in. This leaves you with a wild goose chase.

  1. Explain what kind of feature would support this

Simply printing the file the error was generated while running + db + table-name would likely be plenty.

  1. Give some API proposal, how the feature should work

See above.

Demonstration

λ  knex seed:run
error: 値は型character varying(64)としては長すぎます
    at Connection.parseE (G:\xen\manager\node_modules\pg\lib\connection.js:554:11)
    at Connection.parseMessage (G:\xen\manager\node_modules\pg\lib\connection.js:379:19)
    at Socket.<anonymous> (G:\xen\manager\node_modules\pg\lib\connection.js:119:22)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)
    at Socket.Readable.push (_stream_readable.js:208:10)
    at TCP.onread (net.js:607:20)

From the above output, you really can't tell which one of my 20+ seed files this actually happened in (or which field for that matter). All it says is that the length validation failed in one of my many VARCHAR fields with length set to 64.

This issue is largely the same for the MySQL2 driver as well, and feels like something that should be addressed in core knex.

@kibertoad

This comment has been minimized.

Copy link
Collaborator

kibertoad commented Dec 25, 2018

@Wintereise Could you please try 0.16.3? I think it was addressed there.

@kibertoad

This comment has been minimized.

Copy link
Collaborator

kibertoad commented Dec 25, 2018

Ah, seeds. It should work properly for migrations, but it could be that it's not the case for seeds. I'll look into it.

@Wintereise

This comment has been minimized.

Copy link
Author

Wintereise commented Dec 25, 2018

Yep, same behavior on 0.16.3 @kibertoad

λ  knex seed:run
error: 値は型character varying(64)としては長すぎます
    at Connection.parseE (G:\xen\manager\node_modules\pg\lib\connection.js:554:11)
    at Connection.parseMessage (G:\xen\manager\node_modules\pg\lib\connection.js:379:19)
    at Socket.<anonymous> (G:\xen\manager\node_modules\pg\lib\connection.js:119:22)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)
    at Socket.Readable.push (_stream_readable.js:208:10)
    at TCP.onread (net.js:607:20)

G:\xen\manager [master ≡ +1 ~1 -0 | +0 ~12 -0 !]
λ  knex -V
Knex CLI version:  0.16.3
Local Knex version:  0.16.3

Thank you for looking into it!

@kibertoad

This comment has been minimized.

Copy link
Collaborator

kibertoad commented Dec 25, 2018

@Wintereise Could you please review #2973?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.