We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Given the following code:
object NoPrimaryKey: Table() { val autoIncrementValue: Column<Long> = long("auto_increment_value").autoIncrement() val someOtherValue: Column<String> = varchar("some_other_value", 20) } object StringPrimaryKey: Table() { val autoIncrementValue: Column<Long> = long("auto_increment_value").autoIncrement() val someOtherValue: Column<String> = varchar("some_other_value", 20).primaryKey() } fun main() { val db = Database.connect( "jdbc:postgresql://localhost:5432/postgres", "org.postgresql.Driver", "postgres", "lUosBQd2Sq") transaction(db) { SchemaUtils.createMissingTablesAndColumns(NoPrimaryKey, StringPrimaryKey) } }
produces the following CREATE TABLE sql statements:
CREATE TABLE
CREATE TABLE IF NOT EXISTS noprimarykey (auto_increment_value BIGSERIAL NOT NULL, some_other_value VARCHAR(20) NOT NULL, CONSTRAINT pk_NoPrimaryKey PRIMARY KEY (auto_increment_value)) CREATE TABLE IF NOT EXISTS stringprimarykey (auto_increment_value BIGSERIAL NOT NULL, some_other_value VARCHAR(20) PRIMARY KEY)
I do not get why the table noprimarykey will be created with the PRIMARY KEY constraint.
noprimarykey
Is there an explanation, or is this a bug?
The text was updated successfully, but these errors were encountered:
A table column with .autoIncrement() and NO .primaryKey() does create…
dd2fe8d
… primary key with SchemaUtils.createMissingTablesAndColumns() #649
d3e8cde
Thanks a lot for fixing this.
Sorry, something went wrong.
@istvanszoboszlai , hope to release it soon (on the next week)
No branches or pull requests
Given the following code:
produces the following
CREATE TABLE
sql statements:I do not get why the table
noprimarykey
will be created with the PRIMARY KEY constraint.Is there an explanation, or is this a bug?
The text was updated successfully, but these errors were encountered: