Closed lcsphantom closed 3 years ago
I found the issue while looking in Column.kt and I am opening a pull request to fix this issue, let me know if I missed something and/or if I need to improve anything. Also feel free to just reject the pull request.
Hi @lcsphantom , thank you for a report and PR.
The sad thing is that your code doesn't compile and the problem is more complex as to define named primary autoincrement column the CONSTRAINT pk_name PRIMARY KEY AUTOINCREMENT
syntax should be used.
I'll push a fix and close your PR.
Issue: While using SQLite3 dialect and trying to create a table with autoincrement() and overriding primaryKey, the generated Table does not increment or insert the primary key value.
Computer: Linux Mint 20.1 IntelliJ 2021.1.1 (Ultimate Edition) April 30, 2021
How to replicate: Gradle
Connection
Table
Generated SQL CREATE TABLE IF NOT EXISTS "User" (id INT, "name" VARCHAR(50) NOT NULL, password VARCHAR(50) NOT NULL, email VARCHAR(100) NOT NULL, username VARCHAR(100) NOT NULL, CONSTRAINT PK_USER_ID PRIMARY KEY (id))
Fix but not ideal (deprecrated method primaryKey()):
Table
Generated SQL CREATE TABLE IF NOT EXISTS "User" (id INTEGER PRIMARY KEY AUTOINCREMENT, "name" VARCHAR(50) NOT NULL, password VARCHAR(50) NOT NULL, email VARCHAR(100) NOT NULL, username VARCHAR(100) NOT NULL)
Related issue (to some extent / outdated code)
669