How can I make sure that Database.Schema.create()
is only called once when using the application? You could add ...IF NOT EXISTS...
to the table definition, then the SQL instructions are executed during every startup but no tables are created after the first run, however, I'm not sure if this is the correct way to do this.
Alternatively, I could query the tables and check if they are already present.
What I'm looking for is something like:
if (<first run>) {
Database.Schema.create()
}
I thought I could use migrations for this, but migrations seem to work differently for sqldelight then I expected (I tried to create the tables inside a migration but this does not work).