Skip to content

bug: CapacitorSQLitePlugin.addUpgradeStatements() fails without error #621

Open

Description

Plugin version:
6.0.2

Platform(s):
Web

Current behavior:
Calling addUpgradeStatement() with SQL statements containing obvious syntax errors silently fails.

Expected behavior:
I expect the function to error when executing the statements. Instead, I get errors after initialization at "runtime" when I query my tables that were not created because of invalid upgrade statements.

Steps to reproduce:
Change the upgrade statements in this demo to contain obvious errors.

Related code:

{
	toVersion: 1,
	statements: [`CREATE TABLE IF NOT EXISTS tires (id NOT_A_TYPE);`, `CREATE; T1asd`, ''],
}

Capacitor doctor:

💊   Capacitor Doctor  💊 

Latest Dependencies:

  @capacitor/cli: 7.0.1
  @capacitor/core: 7.0.1
  @capacitor/android: 7.0.1
  @capacitor/ios: 7.0.1

Installed Dependencies:

  @capacitor/cli: 6.2.0
  @capacitor/core: 6.2.0
  @capacitor/android: 6.2.0
  @capacitor/ios: 6.2.0

[success] iOS looking great! 👌
[success] Android looking great! 👌

Activity

  1. ghost added
    bug/fixSomething isn't working
    on Jan 28, 2025
  2. cjhewett commented on May 8, 2026

    @cjhewett

    I just got bitten by this bug too.

    As well as surfacing the errors from addUpgradeStatement, I would say createConnection should throw an exception if it is unable to satisfy the requested version argument (either because the opened db is too new or too old). When there is a mismatch the connection which is returned is not suitable for use.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions