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.

MySQL Verifying as Sqlite

See original GitHub issue

Build Environment SQLDelight version: 1.5.0 OS: macOS Catalina 10.15.7 Gradle version: 6.8 Kotlin version: 1.4

I’m setting up a new project and have sqldelight configured for mysql. It will generate interfaces fine, but verification fails with a sqlite error saying AUTO_INCREMENT is not valid.

The error:

Execution failed for task ':verifyMainDatabaseMigration'.
A failure occurred while executing com.squareup.sqldelight.gradle.VerifyMigrationTask$VerifyMigrationAction
   [SQLITE_ERROR] SQL error or missing database (near "AUTO_INCREMENT": syntax error)

Sq file:

CREATE TABLE users (
  id int(11) NOT NULL AUTO_INCREMENT
);

build.gradle.kts

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

buildscript {
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath("com.squareup.sqldelight:gradle-plugin:1.5.0")
    }
}

plugins {
    kotlin("jvm") version "1.4.32"
    application
    id("com.squareup.sqldelight")
}

group = "api.sample"
version = "1.0-SNAPSHOT"

repositories {
    mavenCentral()
}

dependencies {
    testImplementation(kotlin("test-junit5"))
    testImplementation("org.junit.jupiter:junit-jupiter-api:5.6.0")
    testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.6.0")
    implementation("com.squareup.sqldelight:gradle-plugin:1.5.0")
    implementation("com.squareup.sqldelight:jdbc-driver:1.5.0")
}

tasks.test {
    useJUnitPlatform()
}

tasks.withType<KotlinCompile>() {
    kotlinOptions.jvmTarget = "13"
}

application {
    mainClassName = "MainKt"
}

sqldelight {
    database("Database") { // This will be the name of the generated database class.
        packageName = "com.sample.test"
        dialect = "mysql"
    }
}

settings.gradle.kts


rootProject.name = "KotlinSample"

pluginManagement {
    repositories {
        google()
        gradlePluginPortal()
    }
    resolutionStrategy {
        eachPlugin {
            if(requested.id.namespace == "com.squareup") {
                useModule("com.squareup.sqldelight:gradle-plugin:1.5.0")
            }
        }
    }
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15

github_iconTop GitHub Comments

1reaction
TylerHackYHcommented, May 7, 2021

I’m not the greatest at gradle, but it’s the one at KotlinSample > Tasks > build > build

0reactions
yissacharcommented, Nov 26, 2021

I’m encountering a similar issue:

Execution failed for task ':verifyMainDatabaseMigration'.
> There was a failure while executing work items
   > A failure occurred while executing com.squareup.sqldelight.gradle.VerifyMigrationTask$VerifyMigrationAction
      > [SQLITE_ERROR] SQL error or missing database (unknown database public)

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

I don’t have any .db file or db package and I’m on the latest plugin 1.5.3 using Postgres.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Migrate from SQLite to MySQL: 2 Easy Methods - Learn
The quickest and easiest way to convert SQLite to MySQL is by exporting an SQL Database to a Dump File, and then importing...
Read more >
MySQL-SQLite
Set the Connection Name to root. Everything else should be in place already. If your password is not empty, enter it into the...
Read more >
Exporting a MySQL database for import into SQLite
If you want to export both the structure and the data, check this.) Click Go. A file called databasename.sql will be created and...
Read more >
Converting SQLite to MySQL script (Check if correct)
i just wrote a small script to port sqlite table to mysql but im realy not sure if i did right. Im atleast...
Read more >
MySQL vs. SQLite - Towards Data Science
Both MySQL and SQLite are forms of a Relational Database Management System (RDBMS). These are based on the Structured Query Language (SQL). In ......
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