Created
August 10, 2019 07:53
-
-
Save ubuntudroid/162e554c689617cd65a97158a88019f8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity( | |
foreignKeys = [ | |
ForeignKey( | |
entity = Color::class, | |
parentColumns = ["id"], | |
childColumns = ["color_id"], | |
onDelete = ForeignKey.CASCADE, // or any other strategy | |
onUpdate = ForeignKey.CASCADE, // or any other strategy | |
// deferred = true | |
) | |
] | |
) | |
data class Car( | |
@PrimaryKey val id: String, | |
@ColumnInfo(name = "program_id", index = true) val colorId: String | |
) | |
@Entity | |
data class Color( | |
@PrimaryKey val id: String, | |
val name: String, | |
val hex: String | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment