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

Schema Inference Tests #905

Open
killercup opened this Issue May 14, 2017 · 0 comments

Comments

Projects
None yet
2 participants
@killercup
Member

killercup commented May 14, 2017

There are several places where the schema inference is tested, e.g., in the integration tests of diesel_tests, or the CLI tests for diesel print-schema. I think it'd make sense to also add some tests that focus only on creating a table and asserting the correct table! call gets written.

To implement this, you'd probably start by splitting off parts of the expand_infer_table_from_schema function into a new fn that accepts a given connection. Then, write tests that create a table, call the new fn to get the tokens of a table! call, and compare this to an expected output. (Afterwards, make sure the new table has been dropped; this happens automatically when using begin_test_transaction with SQLite and PG but doesn't work with MySQL.)

Interesting edge cases: Unusual type combinations (e.g., arrays of network addresses), multiple primary keys (expect error on >4 with current code), huge amounts of columns.

@killercup killercup added the tests label May 14, 2017

@sgrif sgrif added the enhancement label May 14, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment