Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native only Migration Issue #3812

Closed
mustafaozhan opened this issue Jan 13, 2023 · 1 comment
Closed

Native only Migration Issue #3812

mustafaozhan opened this issue Jan 13, 2023 · 1 comment
Labels

Comments

@mustafaozhan
Copy link

mustafaozhan commented Jan 13, 2023

SQLDelight Version

1.5.4

Application Operating System

iOS, Android, JVM

Describe the Bug

Hello 👋

In our recent update we had database migration, and Android users doesn't have any issue also the backend(JVM) doesn't have any issue from the migration but we start getting crashes in iOS devices. Here is the whole Migration file:

ALTER TABLE Offline_Rates RENAME TO Conversion;

BEGIN TRANSACTION;

CREATE TABLE CurrencyTemp(
    code TEXT NOT NULL PRIMARY KEY,
    name TEXT NOT NULL,
    symbol TEXT NOT NULL,
    rate REAL NOT NULL DEFAULT 0.0,
    isActive INTEGER NOT NULL DEFAULT 0
);

INSERT INTO CurrencyTemp(code, name, symbol, rate, isActive)
SELECT name, longName, symbol, rate, isActive
FROM Currency;

DROP TABLE Currency;

ALTER TABLE CurrencyTemp RENAME TO Currency;

COMMIT;

UPDATE Currency SET name = 'IMF Special drawing rights' WHERE code = 'XDR';
UPDATE Currency SET name = 'Bosnia-Herzegovina convertible marka' WHERE code = 'BAM';
UPDATE Currency SET name = 'Unidad de fomento' WHERE code = 'CLF';
UPDATE Currency SET name = 'Offshore Chinese Yuan Renminbi' WHERE code = 'CNH';
UPDATE Currency SET name = 'Chinese Yuan Renminbi' WHERE code = 'CNY';

We were not able to figure out what the problem is by looking at the crash log.
The migration has

  • renaming table
  • renaming 2 columns by creating a temporary table from existing one and dropping existing, then rename temporary one to old name
  • adding 5 new entries

I also put the stack trace, also project is located at: https://github.com/Oztechan/CCC
crash happens for the user who updates app 2.8.5 to 2.8.6 (tag names same as the versions)

Any help will be very much appreciated 🙏

Stacktrace

at 0   CCC                                 0x10599ac6b        kfun:kotlin.Throwable#<init>(kotlin.String?){} + 107 
    at 1   CCC                                 0x105993b77        kfun:kotlin.Exception#<init>(kotlin.String?){} + 103 
    at 2   CCC                                 0x105bbe12e        kfun:co.touchlab.sqliter.interop.SQLiteException#<init>(kotlin.String;co.touchlab.sqliter.interop.SqliteDatabaseConfig){} + 126 
    at 3   CCC                                 0x105bbe26d        kfun:co.touchlab.sqliter.interop.SQLiteExceptionErrorCode#<init>(kotlin.String;co.touchlab.sqliter.interop.SqliteDatabaseConfig;kotlin.Int){} + 285 
    at 4   CCC                                 0x105bbddc6        kfun:co.touchlab.sqliter.interop.ActualSqliteStatement#executeNonQuery(){}kotlin.Int + 1990 
    at 5   CCC                                 0x105bba839        kfun:co.touchlab.sqliter.interop.ActualSqliteStatement#execute(){} + 73 
    at 6   CCC                                 0x105bd541f        kfun:co.touchlab.sqliter.native.NativeStatement#execute(){} + 671 
    at 7   CCC                                 0x105bdfcbe        kfun:com.squareup.sqldelight.drivers.native.ConnectionWrapper.execute$lambda$0#internal + 558 
    at 8   CCC                                 0x105be0879        kfun:com.squareup.sqldelight.drivers.native.ConnectionWrapper.$execute$lambda$0$FUNCTION_REFERENCE$347.invoke#internal + 121 
    at 9   CCC                                 0x105be09db        kfun:com.squareup.sqldelight.drivers.native.ConnectionWrapper.$execute$lambda$0$FUNCTION_REFERENCE$347.$<bridge-UNNN>invoke(-1:0){}#internal + 107 
    at 10  CCC                                 0x105be39ec        kfun:com.squareup.sqldelight.drivers.native.SqliterWrappedConnection#accessConnection(kotlin.Boolean;kotlin.Function1<com.squareup.sqldelight.drivers.native.ThreadConnection,0:0>){0§<kotlin.Any?>}0:0 + 300 
    at 11  CCC                                 0x105bdf857        kfun:com.squareup.sqldelight.drivers.native.ConnectionWrapper#execute(kotlin.Int?;kotlin.String;kotlin.Int;kotlin.Function1<com.squareup.sqldelight.db.SqlPreparedStatement,kotlin.Unit>?){} + 455 
    at 12  CCC                                 0x105ae12c0        kfun:com.squareup.sqldelight.db.SqlDriver#execute$default(kotlin.Int?;kotlin.String;kotlin.Int;kotlin.Function1<com.squareup.sqldelight.db.SqlPreparedStatement,kotlin.Unit>?;kotlin.Int){} + 496 
    at 13  CCC                                 0x105e94bc0        kfun:com.oztechan.ccc.common.database.sql.common.CurrencyConverterCalculatorDatabaseImpl.Schema.migrate#internal + 320 
    at 14  CCC                                 0x105bde79c        kfun:com.squareup.sqldelight.drivers.native.NativeSqliteDriver.<init>$lambda$8$lambda$7#internal + 204 
    at 15  CCC                                 0x105bdf507        kfun:com.squareup.sqldelight.drivers.native.NativeSqliteDriver.$<init>$lambda$8$lambda$7$FUNCTION_REFERENCE$346.invoke#internal + 119 
    at 16  CCC                                 0x105bdf61b        kfun:com.squareup.sqldelight.drivers.native.NativeSqliteDriver.$<init>$lambda$8$lambda$7$FUNCTION_REFERENCE$346.$<bridge-UNNN>invoke(-1:0){}#internal + 107 
    at 17  CCC                                 0x105be0f87        kfun:com.squareup.sqldelight.drivers.native#wrapConnection(co.touchlab.sqliter.DatabaseConnection;kotlin.Function1<com.squareup.sqldelight.db.SqlDriver,kotlin.Unit>){} + 535 
    at 18  CCC                                 0x105bde918        kfun:com.squareup.sqldelight.drivers.native.NativeSqliteDriver.<init>$lambda$8#internal + 296 
    at 19  CCC                                 0x105bdedcf        kfun:com.squareup.sqldelight.drivers.native.NativeSqliteDriver.$<init>$lambda$8$FUNCTION_REFERENCE$341.invoke#internal + 239 
    at 20  CCC                                 0x105bdef17        kfun:com.squareup.sqldelight.drivers.native.NativeSqliteDriver.$<init>$lambda$8$FUNCTION_REFERENCE$341.$<bridge-UNNNNN>invoke(-1:0;-1:1;-1:2){}#internal + 183 
    at 21  CCC                                 0x105bd283e        kfun:co.touchlab.sqliter.native.NativeDatabaseConnection.migrateIfNeeded$lambda$2#internal + 846 
    at 22  CCC                                 0x105bd2c4f        kfun:co.touchlab.sqliter.native.NativeDatabaseConnection.$migrateIfNeeded$lambda$2$FUNCTION_REFERENCE$394.invoke#internal + 127 
    at 23  CCC                                 0x105bd2dcb        kfun:co.touchlab.sqliter.native.NativeDatabaseConnection.$migrateIfNeeded$lambda$2$FUNCTION_REFERENCE$394.$<bridge-UNNN>invoke(-1:0){}#internal + 107 
    at 24  CCC                                 0x105ba95ca        kfun:co.touchlab.sqliter#withTransaction__at__co.touchlab.sqliter.DatabaseConnection(kotlin.Function1<co.touchlab.sqliter.DatabaseConnection,0:0>){0§<kotlin.Any?>}0:0 + 474 
    at 25  CCC                                 0x105bd2344        kfun:co.touchlab.sqliter.native.NativeDatabaseConnection#migrateIfNeeded(kotlin.Function1<co.touchlab.sqliter.DatabaseConnection,kotlin.Unit>;kotlin.Function3<co.touchlab.sqliter.DatabaseConnection,kotlin.Int,kotlin.Int,kotlin.Unit>;kotlin.Int){} + 404 
    at 26  CCC                                 0x105bd4357        kfun:co.touchlab.sqliter.native.NativeDatabaseManager.createConnection#internal + 3623 
    at 27  CCC                                 0x105bd32d1        kfun:co.touchlab.sqliter.native.NativeDatabaseManager#createMultiThreadedConnection(){}co.touchlab.sqliter.DatabaseConnection + 177 
    at 28  CCC                                 0x105bde3ba        kfun:com.squareup.sqldelight.drivers.native.NativeSqliteDriver.<init>$lambda$4#internal + 314 
    at 29  CCC                                 0x105bdea95        kfun:com.squareup.sqldelight.drivers.native.NativeSqliteDriver.$<init>$lambda$4$FUNCTION_REFERENCE$339.invoke#internal + 85 
    at 30  CCC                                 0x105be6404        kfun:com.squareup.sqldelight.drivers.native.Pool.borrowEntry$lambda$2#internal + 1028 
    at 31  CCC                                 0x105be6803        kfun:com.squareup.sqldelight.drivers.native.Pool.$borrowEntry$lambda$2$FUNCTION_REFERENCE$354.invoke#internal + 115 
    at 32  CCC                                 0x105bdb446        kfun:com.squareup.sqldelight.drivers.native.util.PoolLock#withLock(kotlin.Function1<com.squareup.sqldelight.drivers.native.util.PoolLock.CriticalSection,0:0>){0§<kotlin.Any?>}0:0 + 646 
    at 33  CCC                                 0x105be442b        kfun:com.squareup.sqldelight.drivers.native.Pool#borrowEntry(){}com.squareup.sqldelight.drivers.native.Borrowed<1:0> + 987 
    at 34  CCC                                 0x105be4810        kfun:com.squareup.sqldelight.drivers.native.Pool#access(kotlin.Function1<1:0,0:0>){0§<kotlin.Any?>}0:0 + 352 
    at 35  CCC                                 0x105bdd991        kfun:com.squareup.sqldelight.drivers.native.NativeSqliteDriver#accessConnection(kotlin.Boolean;kotlin.Function1<com.squareup.sqldelight.drivers.native.ThreadConnection,0:0>){0§<kotlin.Any?>}0:0 + 929 
    at 36  CCC                                 0x105bdfa35        kfun:com.squareup.sqldelight.drivers.native.ConnectionWrapper#executeQuery(kotlin.Int?;kotlin.String;kotlin.Int;kotlin.Function1<com.squareup.sqldelight.db.SqlPreparedStatement,kotlin.Unit>?){}com.squareup.sqldelight.db.SqlCursor + 437 
    at 37  CCC                                 0x105ae1012        kfun:com.squareup.sqldelight.db.SqlDriver#executeQuery$default(kotlin.Int?;kotlin.String;kotlin.Int;kotlin.Function1<com.squareup.sqldelight.db.SqlPreparedStatement,kotlin.Unit>?;kotlin.Int){}com.squareup.sqldelight.db.SqlCursor + 514 
    at 38  CCC                                 0x105adc8a1        kfun:com.squareup.sqldelight.SimpleQuery.execute#internal + 305 
    at 39  CCC                                 0x105adb017        kfun:com.squareup.sqldelight.Query#executeAsList(){}kotlin.collections.List<1:0> + 471 
    at 40  CCC                                 0x105b9e438        kfun:com.squareup.sqldelight.runtime.coroutines.object-1.$collect$lambda$1$lambda$0COROUTINE$242.invokeSuspend#internal + 328 
    at 41  CCC                                 0x10599fb44        kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#resumeWith(kotlin.Result<kotlin.Any?>){} + 772 
    at 42  CCC                                 0x105b761f4        kfun:kotlinx.coroutines.DispatchedTask#run(){} + 3332 
    at 43  CCC                                 0x105b9ae85        kfun:kotlinx.coroutines.DarwinGlobalQueueDispatcher.dispatch$lambda$0#internal + 117 
    at 44  CCC                                 0x105b9af1d        kfun:kotlinx.coroutines.DarwinGlobalQueueDispatcher.$dispatch$lambda$0$FUNCTION_REFERENCE$416.invoke#internal + 77 
    at 45  CCC                                 0x105b9affd        kfun:kotlinx.coroutines.DarwinGlobalQueueDispatcher.$dispatch$lambda$0$FUNCTION_REFERENCE$416.$<bridge-UNN>invoke(){}#internal + 77 
    at 46  CCC                                 0x105b9c03c        _6f72672e6a6574627261696e732e6b6f746c696e783a6b6f746c696e782d636f726f7574696e65732d636f7265_knbridge580 + 252 
    at 47  libdispatch.dylib                   0x108240d17        _dispatch_call_block_and_release + 11 
    at 48  libdispatch.dylib                   0x108241f5a        _dispatch_client_callout + 7 
    at 49  libdispatch.dylib                   0x108244a27        _dispatch_queue_override_invoke + 1487 
    at 50  libdispatch.dylib                   0x108256e76        _dispatch_root_queue_drain + 413 
    at 51  libdispatch.dylib                   0x108257b16        _dispatch_worker_thread2 + 277 
    at 52  libsystem_pthread.dylib             0x7ff836172c9c     _pthread_wqthread + 255 
    at 53  libsystem_pthread.dylib             0x7ff836171c66     start_wqthread + 14 
Sqlite operation failure | error code SQLITE_ERROR
co.touchlab.sqliter.interop.SQLiteExceptionErrorCode: Sqlite operation failure
2023-01-14 00:26:41.167856+0200 CCC[34864:4346592] [siwa] No URL for Apple ID Authorization
    at 0   CCC                                 0x10599ac6b        kfun:kotlin.Throwable#<init>(kotlin.String?){} + 107 
    at 1   CCC                                 0x105993b77        kfun:kotlin.Exception#<init>(kotlin.String?){} + 103 
    at 2   CCC                                 0x105bbe12e        kfun:co.touchlab.sqliter.interop.SQLiteException#<init>(kotlin.String;co.touchlab.sqliter.interop.SqliteDatabaseConfig){} + 126 
    at 3   CCC                                 0x105bbe26d        kfun:co.touchlab.sqliter.interop.SQLiteExceptionErrorCode#<init>(kotlin.String;co.touchlab.sqliter.interop.SqliteDatabaseConfig;kotlin.Int){} + 285 
    at 4   CCC                                 0x105bb9e56        kfun:co.touchlab.sqliter.interop.ActualSqliteStatement#resetStatement(){} + 1158 
    at 5   CCC                                 0x105bd6f01        kfun:co.touchlab.sqliter.native.NativeStatement#resetStatement(){} + 609 
    at 6   CCC                                 0x105bd5709        kfun:co.touchlab.sqliter.native.NativeStatement#execute(){} + 1417 
    at 7   CCC                                 0x105bdfcbe        kfun:com.squareup.sqldelight.drivers.native.ConnectionWrapper.execute$lambda$0#internal + 558 
    at 8   CCC                                 0x105be0879        kfun:com.squareup.sqldelight.drivers.native.ConnectionWrapper.$execute$lambda$0$FUNCTION_REFERENCE$347.invoke#internal + 121 
    at 9   CCC                                 0x105be09db        kfun:com.squareup.sqldelight.drivers.native.ConnectionWrapper.$execute$lambda$0$FUNCTION_REFERENCE$347.$<bridge-UNNN>invoke(-1:0){}#internal + 107 
    at 10  CCC                                 0x105be39ec        kfun:com.squareup.sqldelight.drivers.native.SqliterWrappedConnection#accessConnection(kotlin.Boolean;kotlin.Function1<com.squareup.sqldelight.drivers.native.ThreadConnection,0:0>){0§<kotlin.Any?>}0:0 + 300 
    at 11  CCC                                 0x105bdf857        kfun:com.squareup.sqldelight.drivers.native.ConnectionWrapper#execute(kotlin.Int?;kotlin.String;kotlin.Int;kotlin.Function1<com.squareup.sqldelight.db.SqlPreparedStatement,kotlin.Unit>?){} + 455 
    at 12  CCC                                 0x105ae12c0        kfun:com.squareup.sqldelight.db.SqlDriver#execute$default(kotlin.Int?;kotlin.String;kotlin.Int;kotlin.Function1<com.squareup.sqldelight.db.SqlPreparedStatement,kotlin.Unit>?;kotlin.Int){} + 496 
    at 13  CCC                                 0x105e94bc0        kfun:com.oztechan.ccc.common.database.sql.common.CurrencyConverterCalculatorDatabaseImpl.Schema.migrate#internal + 320 
    at 14  CCC                                 0x105bde79c        kfun:com.squareup.sqldelight.drivers.native.NativeSqliteDriver.<init>$lambda$8$lambda$7#internal + 204 
    at 15  CCC                                 0x105bdf507        kfun:com.squareup.sqldelight.drivers.native.NativeSqliteDriver.$<init>$lambda$8$lambda$7$FUNCTION_REFERENCE$346.invoke#internal + 119 
    at 16  CCC                                 0x105bdf61b        kfun:com.squareup.sqldelight.drivers.native.NativeSqliteDriver.$<init>$lambda$8$lambda$7$FUNCTION_REFERENCE$346.$<bridge-UNNN>invoke(-1:0){}#internal + 107 
    at 17  CCC                                 0x105be0f87        kfun:com.squareup.sqldelight.drivers.native#wrapConnection(co.touchlab.sqliter.DatabaseConnection;kotlin.Function1<com.squareup.sqldelight.db.SqlDriver,kotlin.Unit>){} + 535 
    at 18  CCC                                 0x105bde918        kfun:com.squareup.sqldelight.drivers.native.NativeSqliteDriver.<init>$lambda$8#internal + 296 
    at 19  CCC                                 0x105bdedcf        kfun:com.squareup.sqldelight.drivers.native.NativeSqliteDriver.$<init>$lambda$8$FUNCTION_REFERENCE$341.invoke#internal + 239 
    at 20  CCC                                 0x105bdef17        kfun:com.squareup.sqldelight.drivers.native.NativeSqliteDriver.$<init>$lambda$8$FUNCTION_REFERENCE$341.$<bridge-UNNNNN>invoke(-1:0;-1:1;-1:2){}#internal + 183 
    at 21  CCC                                 0x105bd283e        kfun:co.touchlab.sqliter.native.NativeDatabaseConnection.migrateIfNeeded$lambda$2#internal + 846 
    at 22  CCC                                 0x105bd2c4f        kfun:co.touchlab.sqliter.native.NativeDatabaseConnection.$migrateIfNeeded$lambda$2$FUNCTION_REFERENCE$394.invoke#internal + 127 
    at 23  CCC                                 0x105bd2dcb        kfun:co.touchlab.sqliter.native.NativeDatabaseConnection.$migrateIfNeeded$lambda$2$FUNCTION_REFERENCE$394.$<bridge-UNNN>invoke(-1:0){}#internal + 107 
    at 24  CCC                                 0x105ba95ca        kfun:co.touchlab.sqliter#withTransaction__at__co.touchlab.sqliter.DatabaseConnection(kotlin.Function1<co.touchlab.sqliter.DatabaseConnection,0:0>){0§<kotlin.Any?>}0:0 + 474 
    at 25  CCC                                 0x105bd2344        kfun:co.touchlab.sqliter.native.NativeDatabaseConnection#migrateIfNeeded(kotlin.Function1<co.touchlab.sqliter.DatabaseConnection,kotlin.Unit>;kotlin.Function3<co.touchlab.sqliter.DatabaseConnection,kotlin.Int,kotlin.Int,kotlin.Unit>;kotlin.Int){} + 404 
    at 26  CCC                                 0x105bd4357        kfun:co.touchlab.sqliter.native.NativeDatabaseManager.createConnection#internal + 3623 
    at 27  CCC                                 0x105bd32d1        kfun:co.touchlab.sqliter.native.NativeDatabaseManager#createMultiThreadedConnection(){}co.touchlab.sqliter.DatabaseConnection + 177 
    at 28  CCC                                 0x105bde3ba        kfun:com.squareup.sqldelight.drivers.native.NativeSqliteDriver.<init>$lambda$4#internal + 314 
    at 29  CCC                                 0x105bdea95        kfun:com.squareup.sqldelight.drivers.native.NativeSqliteDriver.$<init>$lambda$4$FUNCTION_REFERENCE$339.invoke#internal + 85 
    at 30  CCC                                 0x105be6404        kfun:com.squareup.sqldelight.drivers.native.Pool.borrowEntry$lambda$2#internal + 1028 
    at 31  CCC                                 0x105be6803        kfun:com.squareup.sqldelight.drivers.native.Pool.$borrowEntry$lambda$2$FUNCTION_REFERENCE$354.invoke#internal + 115 
    at 32  CCC                                 0x105bdb446        kfun:com.squareup.sqldelight.drivers.native.util.PoolLock#withLock(kotlin.Function1<com.squareup.sqldelight.drivers.native.util.PoolLock.CriticalSection,0:0>){0§<kotlin.Any?>}0:0 + 646 
    at 33  CCC                                 0x105be442b        kfun:com.squareup.sqldelight.drivers.native.Pool#borrowEntry(){}com.squareup.sqldelight.drivers.native.Borrowed<1:0> + 987 
    at 34  CCC                                 0x105be4810        kfun:com.squareup.sqldelight.drivers.native.Pool#access(kotlin.Function1<1:0,0:0>){0§<kotlin.Any?>}0:0 + 352 
    at 35  CCC                                 0x105bdd991        kfun:com.squareup.sqldelight.drivers.native.NativeSqliteDriver#accessConnection(kotlin.Boolean;kotlin.Function1<com.squareup.sqldelight.drivers.native.ThreadConnection,0:0>){0§<kotlin.Any?>}0:0 + 929 
    at 36  CCC                                 0x105bdfa35        kfun:com.squareup.sqldelight.drivers.native.ConnectionWrapper#executeQuery(kotlin.Int?;kotlin.String;kotlin.Int;kotlin.Function1<com.squareup.sqldelight.db.SqlPreparedStatement,kotlin.Unit>?){}com.squareup.sqldelight.db.SqlCursor + 437 
    at 37  CCC                                 0x105ae1012        kfun:com.squareup.sqldelight.db.SqlDriver#executeQuery$default(kotlin.Int?;kotlin.String;kotlin.Int;kotlin.Function1<com.squareup.sqldelight.db.SqlPreparedStatement,kotlin.Unit>?;kotlin.Int){}com.squareup.sqldelight.db.SqlCursor + 514 
    at 38  CCC                                 0x105adc8a1        kfun:com.squareup.sqldelight.SimpleQuery.execute#internal + 305 
    at 39  CCC                                 0x105adb017        kfun:com.squareup.sqldelight.Query#executeAsList(){}kotlin.collections.List<1:0> + 471 
    at 40  CCC                                 0x105b9e438        kfun:com.squareup.sqldelight.runtime.coroutines.object-1.$collect$lambda$1$lambda$0COROUTINE$242.invokeSuspend#internal + 328 
    at 41  CCC                                 0x10599fb44        kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#resumeWith(kotlin.Result<kotlin.Any?>){} + 772 
    at 42  CCC                                 0x105b761f4        kfun:kotlinx.coroutines.DispatchedTask#run(){} + 3332 
    at 43  CCC                                 0x105b9ae85        kfun:kotlinx.coroutines.DarwinGlobalQueueDispatcher.dispatch$lambda$0#internal + 117 
    at 44  CCC                                 0x105b9af1d        kfun:kotlinx.coroutines.DarwinGlobalQueueDispatcher.$dispatch$lambda$0$FUNCTION_REFERENCE$416.invoke#internal + 77 
    at 45  CCC                                 0x105b9affd        kfun:kotlinx.coroutines.DarwinGlobalQueueDispatcher.$dispatch$lambda$0$FUNCTION_REFERENCE$416.$<bridge-UNN>invoke(){}#internal + 77 
    at 46  CCC                                 0x105b9c03c        _6f72672e6a6574627261696e732e6b6f746c696e783a6b6f746c696e782d636f726f7574696e65732d636f7265_knbridge580 + 252 
    at 47  libdispatch.dylib                   0x108240d17        _dispatch_call_block_and_release + 11 
    at 48  libdispatch.dylib                   0x108241f5a        _dispatch_client_callout + 7 
    at 49  libdispatch.dylib                   0x108244a27        _dispatch_queue_override_invoke + 1487 
    at 50  libdispatch.dylib                   0x108256e76        _dispatch_root_queue_drain + 413 
    at 51  libdispatch.dylib                   0x108257b16        _dispatch_worker_thread2 + 277 
    at 52  libsystem_pthread.dylib             0x7ff836172c9c     _pthread_wqthread + 255 
    at 53  libsystem_pthread.dylib             0x7ff836171c66     start_wqthread + 14 
attempted to run migration and failed. closing connection.
Uncaught Kotlin exception: co.touchlab.sqliter.interop.SQLiteExceptionErrorCode: Sqlite operation failure
    at 0   CCC                                 0x10599ac6b        kfun:kotlin.Throwable#<init>(kotlin.String?){} + 107 
    at 1   CCC                                 0x105993b77        kfun:kotlin.Exception#<init>(kotlin.String?){} + 103 
    at 2   CCC                                 0x105bbe12e        kfun:co.touchlab.sqliter.interop.SQLiteException#<init>(kotlin.String;co.touchlab.sqliter.interop.SqliteDatabaseConfig){} + 126 
    at 3   CCC                                 0x105bbe26d        kfun:co.touchlab.sqliter.interop.SQLiteExceptionErrorCode#<init>(kotlin.String;co.touchlab.sqliter.interop.SqliteDatabaseConfig;kotlin.Int){} + 285 
    at 4   CCC                                 0x105bb9e56        kfun:co.touchlab.sqliter.interop.ActualSqliteStatement#resetStatement(){} + 1158 
    at 5   CCC                                 0x105bd6f01        kfun:co.touchlab.sqliter.native.NativeStatement#resetStatement(){} + 609 
    at 6   CCC                                 0x105bd5709        kfun:co.touchlab.sqliter.native.NativeStatement#execute(){} + 1417 
    at 7   CCC                                 0x105bdfcbe        kfun:com.squareup.sqldelight.drivers.native.ConnectionWrapper.execute$lambda$0#internal + 558 
    at 8   CCC                                 0x105be0879        kfun:com.squareup.sqldelight.drivers.native.ConnectionWrapper.$execute$lambda$0$FUNCTION_REFERENCE$347.invoke#internal + 121 
    at 9   CCC                                 0x105be09db        kfun:com.squareup.sqldelight.drivers.native.ConnectionWrapper.$execute$lambda$0$FUNCTION_REFERENCE$347.$<bridge-UNNN>invoke(-1:0){}#internal + 107 
    at 10  CCC                                 0x105be39ec        kfun:com.squareup.sqldelight.drivers.native.SqliterWrappedConnection#accessConnection(kotlin.Boolean;kotlin.Function1<com.squareup.sqldelight.drivers.native.ThreadConnection,0:0>){0§<kotlin.Any?>}0:0 + 300 
    at 11  CCC                                 0x105bdf857        kfun:com.squareup.sqldelight.drivers.native.ConnectionWrapper#execute(kotlin.Int?;kotlin.String;kotlin.Int;kotlin.Function1<com.squareup.sqldelight.db.SqlPreparedStatement,kotlin.Unit>?){} + 455 
    at 12  CCC                                 0x105ae12c0        kfun:com.squareup.sqldelight.db.SqlDriver#execute$default(kotlin.Int?;kotlin.String;kotlin.Int;kotlin.Function1<com.squareup.sqldelight.db.SqlPreparedStatement,kotlin.Unit>?;kotlin.Int){} + 496 
    at 13  CCC                                 0x105e94bc0        kfun:com.oztechan.ccc.common.database.sql.common.CurrencyConverterCalculatorDatabaseImpl.Schema.migrate#internal + 320 
    at 14  CCC                                 0x105bde79c        kfun:com.squareup.sqldelight.drivers.native.NativeSqliteDriver.<init>$lambda$8$lambda$7#internal + 204 
    at 15  CCC                                 0x105bdf507        kfun:com.squareup.sqldelight.drivers.native.NativeSqliteDriver.$<init>$lambda$8$lambda$7$FUNCTION_REFERENCE$346.invoke#internal + 119 
    at 16  CCC                                 0x105bdf61b        kfun:com.squareup.sqldelight.drivers.native.NativeSqliteDriver.$<init>$lambda$8$lambda$7$FUNCTION_REFERENCE$346.$<bridge-UNNN>invoke(-1:0){}#internal + 107 executeNonQuery error | error code SQLITE_ERROR

    at 17  CCC                                 0x105be0f87        kfun:com.squareup.sqldelight.drivers.native#wrapConnection(co.touchlab.sqliter.DatabaseConnection;kotlin.Function1<com.squareup.sqldelight.db.SqlDriver,kotlin.Unit>){} + 535 
    at 18  CCC                                 0x105bde918        kfun:com.squareup.sqldelight.drivers.native.NativeSqliteDriver.<init>$lambda$8#internal + 296 
co.touchlab.sqliter.interop.SQLiteExceptionErrorCode: executeNonQuery error
    at 19  CCC                                 0x105bdedcf        kfun:com.squareup.sqldelight.drivers.native.NativeSqliteDriver.$<init>$lambda$8$FUNCTION_REFERENCE$341.invoke#internal + 239 
    at 20  CCC                                 0x105bdef17        kfun:com.squareup.sqldelight.drivers.native.NativeSqliteDriver.$<init>$lambda$8$FUNCTION_REFERENCE$341.$<bridge-UNNNNN>invoke(-1:0;-1:1;-1:2){}#internal + 183 
    at 21  CCC                                 0x105bd283e        kfun:co.touchlab.sqliter.native.NativeDatabaseConnection.migrateIfNeeded$lambda$2#internal + 846 
    at 22  CCC                                 0x105bd2c4f        kfun:co.touchlab.sqliter.native.NativeDatabaseConnection.$migrateIfNeeded$lambda$2$FUNCTION_REFERENCE$394.invoke#internal + 127 
    at 23  CCC                                 0x105bd2dcb        kfun:co.touchlab.sqliter.native.NativeDatabaseConnection.$migrateIfNeeded$lambda$2$FUNCTION_REFERENCE$394.$<bridge-UNNN>invoke(-1:0){}#internal + 107 
    at 24  CCC                                 0x105ba95ca        kfun:co.touchlab.sqliter#withTransaction__at__co.touchlab.sqliter.DatabaseConnection(kotlin.Function1<co.touchlab.sqliter.DatabaseConnection,0:0>){0§<kotlin.Any?>}0:0 + 474 
    at 25  CCC                                 0x105bd2344        kfun:co.touchlab.sqliter.native.NativeDatabaseConnection#migrateIfNeeded(kotlin.Function1<co.touchlab.sqliter.DatabaseConnection,kotlin.Unit>;kotlin.Function3<co.touchlab.sqliter.DatabaseConnection,kotlin.Int,kotlin.Int,kotlin.Unit>;kotlin.Int){} + 404 
    at 26  CCC                                 0x105bd4357        kfun:co.touchlab.sqliter.native.NativeDatabaseManager.createConnection#internal + 3623 
    at 27  CCC                                 0x105bd32d1        kfun:co.touchlab.sqliter.native.NativeDatabaseManager#createMultiThreadedConnection(){}co.touchlab.sqliter.DatabaseConnection + 177 
    at 28  CCC                                 0x105bde3ba        kfun:com.squareup.sqldelight.drivers.native.NativeSqliteDriver.<init>$lambda$4#internal + 314 
    at 29  CCC                                 0x105bdea95        kfun:com.squareup.sqldelight.drivers.native.NativeSqliteDriver.$<init>$lambda$4$FUNCTION_REFERENCE$339.invoke#internal + 85 
    at 30  CCC                                 0x105be6404        kfun:com.squareup.sqldelight.drivers.native.Pool.borrowEntry$lambda$2#internal + 1028 
    at 31  CCC                                 0x105be6803        kfun:com.squareup.sqldelight.drivers.native.Pool.$borrowEntry$lambda$2$FUNCTION_REFERENCE$354.invoke#internal + 115 
    at 32  CCC                                 0x105bdb446        kfun:com.squareup.sqldelight.drivers.native.util.PoolLock#withLock(kotlin.Function1<com.squareup.sqldelight.drivers.native.util.PoolLock.CriticalSection,0:0>){0§<kotlin.Any?>}0:0 + 646 
    at 33  CCC                                 0x105be442b        kfun:com.squareup.sqldelight.drivers.native.Pool#borrowEntry(){}com.squareup.sqldelight.drivers.native.Borrowed<1:0> + 987 
    at 34  CCC                                 0x105be4810        kfun:com.squareup.sqldelight.drivers.native.Pool#access(kotlin.Function1<1:0,0:0>){0§<kotlin.Any?>}0:0 + 352 
    at 35  CCC                                 0x105bdd991        kfun:com.squareup.sqldelight.drivers.native.NativeSqliteDriver#accessConnection(kotlin.Boolean;kotlin.Function1<com.squareup.sqldelight.drivers.native.ThreadConnection,0:0>){0§<kotlin.Any?>}0:0 + 929 
    at 36  CCC                                 0x105bdfa35        kfun:com.squareup.sqldelight.drivers.native.ConnectionWrapper#executeQuery(kotlin.Int?;kotlin.String;kotlin.Int;kotlin.Function1<com.squareup.sqldelight.db.SqlPreparedStatement,kotlin.Unit>?){}com.squareup.sqldelight.db.SqlCursor + 437 
    at 37  CCC                                 0x105ae1012        kfun:com.squareup.sqldelight.db.SqlDriver#executeQuery$default(kotlin.Int?;kotlin.String;kotlin.Int;kotlin.Function1<com.squareup.sqldelight.db.SqlPreparedStatement,kotlin.Unit>?;kotlin.Int){}com.squareup.sqldelight.db.SqlCursor + 514 
    at 38  CCC                                 0x105adc8a1        kfun:com.squareup.sqldelight.SimpleQuery.execute#internal + 305 
    at 39  CCC                                 0x105adb017        kfun:com.squareup.sqldelight.Query#executeAsList(){}kotlin.collections.List<1:0> + 471 
    at 40  CCC                                 0x105b9e438        kfun:com.squareup.sqldelight.runtime.coroutines.object-1.$collect$lambda$1$lambda$0COROUTINE$242.invokeSuspend#internal + 328 
    at 41  CCC                                 0x10599fb44        kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#resumeWith(kotlin.Result<kotlin.Any?>){} + 772 
    at 42  CCC                                 0x105b761f4        kfun:kotlinx.coroutines.DispatchedTask#run(){} + 3332 
    at 43  CCC                                 0x105b9ae85        kfun:kotlinx.coroutines.DarwinGlobalQueueDispatcher.dispatch$lambda$0#internal + 117 
    at 44  CCC                                 0x105b9af1d        kfun:kotlinx.coroutines.DarwinGlobalQueueDispatcher.$dispatch$lambda$0$FUNCTION_REFERENCE$416.invoke#internal + 77 
    at 45  CCC                                 0x105b9affd        kfun:kotlinx.coroutines.DarwinGlobalQueueDispatcher.$dispatch$lambda$0$FUNCTION_REFERENCE$416.$<bridge-UNN>invoke(){}#internal + 77 
    at 46  CCC                                 0x105b9c03c        _6f72672e6a6574627261696e732e6b6f746c696e783a6b6f746c696e782d636f726f7574696e65732d636f7265_knbridge580 + 252 
    at 47  libdispatch.dylib                   0x108240d17        _dispatch_call_block_and_release + 11 
    at 48  libdispatch.dylib                   0x108241f5a        _dispatch_client_callout + 7 
    at 49  libdispatch.dylib                   0x108244a27        _dispatch_queue_override_invoke + 1487 
    at 50  libdispatch.dylib                   0x108256e76        _dispatch_root_queue_drain + 413 
    at 51  libdispatch.dylib                   0x108257b16        _dispatch_worker_thread2 + 277 
    at 52  libsystem_pthread.dylib             0x7ff836172c9c     _pthread_wqthread + 255 
    at 53  libsystem_pthread.dylib             0x7ff836171c66     start_wqthread + 14 
CoreSimulator 857.14 - Device: iPhone 12 Pro (BD3A552F-8500-49CB-86F4-F4715EBA8E9F) - Runtime: iOS 16.2 (20C52) - DeviceType: iPhone 12 Pro
(lldb)

Note: I had a look #2447 and #1668 but couldn't get any result

@mustafaozhan
Copy link
Author

Anyone interested on the fix

In the migration section of Native: https://cashapp.github.io/sqldelight/1.5.4/native_sqlite/migrations/

It points that:

If the driver supports it, migrations are run in a transaction. You should not surround your migrations in BEGIN/END TRANSACTION, as this can cause a crash with some drivers.

So deleting the lines:

BEGIN TRANSACTION;

COMMIT;

Fixed my problem

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

No branches or pull requests

1 participant