Skip to content

Commit

Permalink
Re-added previous foreign key constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
Pablosanqt committed Oct 24, 2024
1 parent 8e974f2 commit a242418
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import de.tum.informatics.www1.artemis.native_app.feature.push.communication_not
CommunicationMessageEntity::class
],
exportSchema = true,
version = 10,
version = 11,
)
@TypeConverters(RoomTypeConverters::class)
abstract class AppDatabase : RoomDatabase() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import androidx.room.Index
*/
@Entity(
tableName = "metis_post_context",
primaryKeys = ["client_post_id", "course_id", "conversation_id", "type", "server_id"],
primaryKeys = ["client_post_id", "course_id", "conversation_id", "type"],
foreignKeys = [
ForeignKey(
entity = BasePostingEntity::class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,20 @@ import androidx.room.Index

@Entity(
tableName = "reactions",
primaryKeys = ["post_id", "emoji", "author_id", "server_id"],
primaryKeys = ["post_id", "emoji", "author_id"],
foreignKeys = [
ForeignKey(
entity = BasePostingEntity::class,
parentColumns = ["id"],
childColumns = ["post_id"],
onDelete = ForeignKey.CASCADE
),
ForeignKey(
entity = MetisUserEntity::class,
parentColumns = ["server_id", "id"],
childColumns = ["server_id", "author_id"]
)
],
indices = [Index("server_id", "author_id", name = "server_id_author_id_index")]
)
data class PostReactionEntity(
Expand Down

0 comments on commit a242418

Please sign in to comment.