Skip to content

Drift files #1519

Answered by simolus3
ghost asked this question in Q&A
Oct 28, 2021 · 1 comment
Discussion options

You must be logged in to vote

if I export the sql creation string and put it into a .drift file where can I specific the class name so like

You can use WITH at the end of a table's definition to specify an existing row class that you wrote yourself. The Dart class used must be imported into the drift file for this.
You can also use AS at the end of a table to specify a custom data class name for drift to generate (e.g. CREATE TABLE my_table (...) AS MyTable). More docs on this are here.

using the example of opening an existing database, I can't see where the generated code goes or is none created?

None is generated for that example in particular. Opening databases is a runtime-only matter, so it's ignored by the g…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant