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

Duplicate foreign key constraint generated #866

Closed
robyka400 opened this issue Apr 8, 2020 · 2 comments
Closed

Duplicate foreign key constraint generated #866

robyka400 opened this issue Apr 8, 2020 · 2 comments

Comments

@robyka400
Copy link

robyka400 commented Apr 8, 2020

I have this table schema:

object ValuesTable : IntIdTable("values") {
    val parameter =
        reference("parameters", ParametersTable, onDelete = ReferenceOption.CASCADE, onUpdate = ReferenceOption.CASCADE)
    val service =
        reference("services", ServicesTable, onDelete = ReferenceOption.CASCADE, onUpdate = ReferenceOption.CASCADE)
    val values = text("actual_values")
}

When exposed tries to create my table i'm getting java.sql.SQLException: Duplicate foreign key constraint name 'fk_values_parameters_id'. I've tried manually adding a different fkName, also tried to use a different table name starting with uppercase.

MySQL version is : Ver 8.0.19 for macos10.15 on x86_64 (MySQL Community Server - GPL)

@robyka400
Copy link
Author

The problem seems to be caused SchemaUtils.createMissingTablesAndColumns. Using simply SchemaUtils.create() works as expected

@Tapac
Copy link
Contributor

Tapac commented Jun 19, 2020

Should be fixed in 0.26.1

@Tapac Tapac closed this as completed Jun 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants