Closed robmaw closed 1 month ago
Fortunately, you won’t need to mess with the containers to add a Sqlite test, so that should make it a lot easier. You can just edit the Sqlite db file directly if you need to add a new table or column.
I use “Verify” to test the generated files:
https://github.com/JordanMarr/SqlHydra/blob/main/src/Tests/Sqlite/Generation.fs
The tests in that file all pass now. After you modify the generation code, the verification test will fail because it will no longer match the snapshot. So you can either debug the output in those tests to ensure your change was successful, or you can just run the sqlite .bat file in the Tests project folder to regen it.
At that point you can submit the PR and I will run the full test suite.
In my testing, the change to the generation code only results in a change in the first line against the snapshot. The PR contains 2 changes- the update to the generation code, and an update in the AdventureWorksLT.db , changing the SalesOrderHeader.SalesOrderNumber field from TEXT to LONGVARCHAR. please let me know if I've missed your point above, and I'll adjust the PR.
You changed SalesOrderHeader.SalesOrderNumber
from a TEXT
to a LONGVARCHAR
.
Since the generated file still includes the SalesOrderNumber
, your change appears to be working properly.
Released as SqlHydra.Cli v2.4.1.
On second thought, it probably would be a good idea to have an integration test to make sure that inserts and updates work properly and don’t truncate the string. I’m not sure if the parameter will be set properly, or if the parameter type matters for sqlite.
When using SqlHydra.Cli against a Sqlite database, the F# types and readers do not include columns that are of type
longvarchar
.A mapping is missing in
SqlHydra.Cli/Sqlite/SqliteDataTypes.fs
e.g.
"longvarchar", "string", DbType.String, nameof r.GetString
Happy to provide a PR, but will need some guidance on integrating a test for it.