diff --git a/composeApp/src/commonMain/kotlin/org/ooni/probe/data/models/NetworkModel.kt b/composeApp/src/commonMain/kotlin/org/ooni/probe/data/models/NetworkModel.kt index e8c65ad7..268703c2 100644 --- a/composeApp/src/commonMain/kotlin/org/ooni/probe/data/models/NetworkModel.kt +++ b/composeApp/src/commonMain/kotlin/org/ooni/probe/data/models/NetworkModel.kt @@ -14,7 +14,6 @@ import org.ooni.engine.models.NetworkType data class NetworkModel( @SerialName("id") val id: Id? = null, @SerialName("network_name") val networkName: String?, - @SerialName("ip") val ip: String?, @SerialName("asn") val asn: String?, @SerialName("country_code") val countryCode: String?, @SerialName("networkType") val networkType: NetworkType?, diff --git a/composeApp/src/commonMain/kotlin/org/ooni/probe/data/repositories/NetworkRepository.kt b/composeApp/src/commonMain/kotlin/org/ooni/probe/data/repositories/NetworkRepository.kt index 7fd39153..6a65f467 100644 --- a/composeApp/src/commonMain/kotlin/org/ooni/probe/data/repositories/NetworkRepository.kt +++ b/composeApp/src/commonMain/kotlin/org/ooni/probe/data/repositories/NetworkRepository.kt @@ -25,7 +25,6 @@ class NetworkRepository( if (model.id == null) { database.networkQueries.selectByValues( network_name = model.networkName, - ip = model.ip, asn = model.asn, country_code = model.countryCode, network_type = model.networkType?.value, @@ -37,7 +36,6 @@ class NetworkRepository( database.networkQueries.insertOrReplace( id = model.id?.value, network_name = model.networkName, - ip = model.ip, asn = model.asn, country_code = model.countryCode, network_type = model.networkType?.value, @@ -62,7 +60,6 @@ fun Network.toModel(): NetworkModel = NetworkModel( id = NetworkModel.Id(id), networkName = network_name, - ip = ip, asn = asn, countryCode = country_code, networkType = network_type?.let(NetworkType::fromValue), diff --git a/composeApp/src/commonMain/kotlin/org/ooni/probe/data/repositories/ResultRepository.kt b/composeApp/src/commonMain/kotlin/org/ooni/probe/data/repositories/ResultRepository.kt index 6c83620f..14a2c861 100644 --- a/composeApp/src/commonMain/kotlin/org/ooni/probe/data/repositories/ResultRepository.kt +++ b/composeApp/src/commonMain/kotlin/org/ooni/probe/data/repositories/ResultRepository.kt @@ -168,7 +168,6 @@ class ResultRepository( Network( id = networkId, network_name = network_name, - ip = ip, asn = asn, country_code = country_code, network_type = network_type, @@ -203,7 +202,6 @@ class ResultRepository( Network( id = networkId, network_name = network_name, - ip = ip, asn = asn, country_code = country_code, network_type = network_type, diff --git a/composeApp/src/commonMain/kotlin/org/ooni/probe/domain/RunNetTest.kt b/composeApp/src/commonMain/kotlin/org/ooni/probe/domain/RunNetTest.kt index 38fc49b0..3f88da92 100644 --- a/composeApp/src/commonMain/kotlin/org/ooni/probe/domain/RunNetTest.kt +++ b/composeApp/src/commonMain/kotlin/org/ooni/probe/domain/RunNetTest.kt @@ -80,7 +80,6 @@ class RunNetTest( is TaskEvent.GeoIpLookup -> { val network = NetworkModel( networkName = event.networkName, - ip = event.ip, asn = event.asn, countryCode = event.countryCode, networkType = event.networkType, diff --git a/composeApp/src/commonMain/sqldelight/migrations/9.sqm b/composeApp/src/commonMain/sqldelight/migrations/9.sqm new file mode 100644 index 00000000..2b705074 --- /dev/null +++ b/composeApp/src/commonMain/sqldelight/migrations/9.sqm @@ -0,0 +1,16 @@ +BEGIN TRANSACTION; + +CREATE TABLE NetworkTemporary( + id INTEGER PRIMARY KEY AUTOINCREMENT, + network_name TEXT, + asn TEXT, + country_code TEXT, + network_type TEXT +); + +INSERT INTO NetworkTemporary SELECT id, network_name, asn, country_code, network_type FROM Network; + +DROP TABLE Network; +ALTER TABLE NetworkTemporary RENAME TO Network; + +COMMIT; diff --git a/composeApp/src/commonMain/sqldelight/org/ooni/probe/data/Network.sq b/composeApp/src/commonMain/sqldelight/org/ooni/probe/data/Network.sq index ffd94866..9e6975b2 100644 --- a/composeApp/src/commonMain/sqldelight/org/ooni/probe/data/Network.sq +++ b/composeApp/src/commonMain/sqldelight/org/ooni/probe/data/Network.sq @@ -1,7 +1,6 @@ CREATE TABLE Network( id INTEGER PRIMARY KEY AUTOINCREMENT, network_name TEXT, - ip TEXT, asn TEXT, country_code TEXT, network_type TEXT @@ -11,11 +10,10 @@ insertOrReplace: INSERT OR REPLACE INTO Network ( id, network_name, - ip, asn, country_code, network_type -) VALUES (?,?,?,?,?,?); +) VALUES (?,?,?,?,?); deleteAll: DELETE FROM Network; @@ -28,5 +26,5 @@ SELECT * FROM Network; selectByValues: SELECT * FROM Network -WHERE network_name = ? AND ip = ? AND asn = ? AND country_code = ? AND network_type = ? +WHERE network_name = ? AND asn = ? AND country_code = ? AND network_type = ? LIMIT 1; diff --git a/composeApp/src/commonTest/kotlin/org/ooni/testing/factories/NetworkModelFactory.kt b/composeApp/src/commonTest/kotlin/org/ooni/testing/factories/NetworkModelFactory.kt index 1b6d7a20..f51ac235 100644 --- a/composeApp/src/commonTest/kotlin/org/ooni/testing/factories/NetworkModelFactory.kt +++ b/composeApp/src/commonTest/kotlin/org/ooni/testing/factories/NetworkModelFactory.kt @@ -8,14 +8,12 @@ object NetworkModelFactory { fun build( id: NetworkModel.Id? = null, networkName: String? = "Vodafone", - ip: String? = null, asn: String? = null, countryCode: String? = null, networkType: NetworkType? = null, ) = NetworkModel( id = id, networkName = networkName, - ip = ip, asn = asn, countryCode = countryCode, networkType = networkType,