question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

A non-empty migration sqm file gets translated into an empty migration in kotlin

See original GitHub issue

Runtime Environment SQLDelight version: 1.2.1 Application OS: Android

Describe the bug Adding a new migration file 6.sqm results in an empty section in the kotlin migrate script.

$ cat 6.sqm
import com.mycelium.wapi.wallet.fio.FioName;

CREATE TABLE IF NOT EXISTS FioKnownNames(
    name TEXT AS FioName PRIMARY KEY
);
$ cat WalletDBImpl.kt
...
      if (oldVersion <= 5 && newVersion > 5) {
        driver.execute(null, "ALTER TABLE EthAccountBacking ADD COLUMN internalValue TEXT;", 0)
      }
      if (oldVersion <= 6 && newVersion > 6) {
      }
    }
  }
}
...

From the discussion below: deriveSchemaFromMigrations was not set.

The not-so-surprising stacktrace:

2020-09-29 22:57:34.545 9952-9952/com.mycelium.testnetwallet.debug E/SQLiteLog: (1) no such table: FioKnownNames in "SELECT name
    FROM FioKnownNames"
2020-09-29 22:57:34.548 9952-9952/com.mycelium.testnetwallet.debug E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.mycelium.testnetwallet.debug, PID: 9952
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mycelium.testnetwallet.debug/com.mycelium.wallet.activity.send.ManualAddressEntry}: android.database.sqlite.SQLiteException: no such table: FioKnownNames (code 1 SQLITE_ERROR): , while compiling: SELECT name
    FROM FioKnownNames

Expected behavior

Compile time error over the not allowed “AS FioName” part or kotlin output ignoring the “AS FioName” part.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
Giszmocommented, Sep 30, 2020

I removed the types and it works. The bug-part on the library’s side is just that it silently generates an empty migration that leads to runtime crashes instead of throwing a compiletime error.

I updated name and description.

0reactions
AlecStrongcommented, Sep 30, 2020

sweet thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

EF migration shows empty Up() Down() methods
Infortunately I get an empty migration Up() and Down() method. When I look in the database there is a __migrationHistory available with the...
Read more >
Database migrations with SQLDelight and Flyway
Once configured, SQLDelight looks for .sq files in the sqldelight folder under your sources path. With the options defined above, and assuming a ......
Read more >
why causes this change a non-empty migration?
Dear Django group, using a model like this: ``` class Kostenstelle(models.Model): id = models.AutoField(primary_key=True) name = models.
Read more >
Baeldung Author
Project loom in Java 19, ZGC in Java 18, empty finalize, cloud-native Micronaut, ... Learn how to migrate code from a web.xml file...
Read more >
Time Tracking Report - Hibernate JIRA - Atlassian
Bug, HHH-15712, Open, Major, Hibernate Gradle plugin broken with Kotlin ... Bug, HHH-15231, Closed, Major, DefaultSchema is Null after migrate to new ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found