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

Can't reference on String entity ID #591

Closed
milosmns opened this issue Jun 28, 2019 · 2 comments
Closed

Can't reference on String entity ID #591

milosmns opened this issue Jun 28, 2019 · 2 comments

Comments

@milosmns
Copy link

milosmns commented Jun 28, 2019

Hi,

I'm trying to create a table of apps, each app has a bunch of users. So, something like this:

private object Apps : IdTable<String>(name = "apps") {
  override val id: Column<EntityID<String>> = varchar(name = "id", length = 64).primaryKey().entityId()
  val secret: Column<String> = varchar(name = "secret", length = 64)
  val name: Column<String> = varchar(name = "name", length = 32)
}
private object Users : IntIdTable(name = "users", columnName = "id") {
  val appId: Column<String> = varchar(name = "app_id", length = 64).references(Apps.id) // compile error!
  val username: Column<String> = varchar(name = "username", length = 64)
  val password: Column<String> = varchar(name = "password", length = 64)
}

But it looks like I can't reference the Apps.id in the Users.appId column.. either I'm doing something wrong, or there is an opportunity for improvement. 😄

Help please.

@Tapac
Copy link
Contributor

Tapac commented Jun 30, 2019

Try to replace it with:
val appId = reference("app_id, Apps)

Tapac added a commit that referenced this issue Jul 3, 2019
@Tapac
Copy link
Contributor

Tapac commented Jul 3, 2019

Fixed in master

@Tapac Tapac closed this as completed Jul 3, 2019
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