Skip to content

Commit

Permalink
Remove unused field from operations data model (#221)
Browse files Browse the repository at this point in the history
* Remove unused field from operations data model

The same information is stored in `operation_id` on that model and
`entry_hash` is also not used anywhere afaict.

* Update changelog
  • Loading branch information
cafca committed Aug 4, 2022
1 parent dd73fe5 commit e574ecd
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 36 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Refactor scalars and replication API, replace `graphql-client` with `gql_client` [#184](https://github.com/p2panda/aquadoggo/pull/184)
- Give error types of worker a string for better debugging [#194](https://github.com/p2panda/aquadoggo/pull/194)
- Bump `p2panda-rs` which now supports log id's starting from `0` [#207](https://github.com/p2panda/aquadoggo/pull/207)
- Removed unused field `entry_hash` from operation data model [#221](https://github.com/p2panda/aquadoggo/pull/221)

### Fixed

Expand Down
1 change: 0 additions & 1 deletion aquadoggo/migrations/20220509090252_create-operations.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ CREATE TABLE IF NOT EXISTS operations_v1 (
author TEXT NOT NULL,
document_id TEXT NOT NULL,
operation_id TEXT NOT NULL UNIQUE,
entry_hash TEXT NOT NULL UNIQUE,
action TEXT NOT NULL,
schema_id TEXT NOT NULL,
previous_operations TEXT NULL,
Expand Down
8 changes: 2 additions & 6 deletions aquadoggo/src/db/models/operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ pub struct OperationRow {
pub document_id: String,

/// The id of this operation.
///
/// Also, the hash of the entry this operation is associated with.
pub operation_id: String,

/// The action type this operation is performing.
pub action: String,

/// The hash of the entry this operation is associated with.
pub entry_hash: String,

/// The id of the schema this operation follows.
pub schema_id: String,

Expand Down Expand Up @@ -65,9 +64,6 @@ pub struct OperationFieldsJoinedRow {
/// The action type this operation is performing.
pub action: String,

/// The hash of the entry this operation is associated with.
pub entry_hash: String,

/// The id of the schema this operation follows.
pub schema_id: String,

Expand Down
6 changes: 1 addition & 5 deletions aquadoggo/src/db/stores/operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,17 @@ impl OperationStore<VerifiedOperation> for SqlStorage {
author,
document_id,
operation_id,
entry_hash,
action,
schema_id,
previous_operations
)
VALUES
($1, $2, $3, $4, $5, $6, $7)
($1, $2, $3, $4, $5, $6)
",
)
.bind(operation.public_key().as_str())
.bind(document_id.as_str())
.bind(operation.operation_id().as_str())
.bind(operation.operation_id().as_hash().as_str())
.bind(operation.action().as_str())
.bind(operation.schema().as_str())
.bind(
Expand Down Expand Up @@ -193,7 +191,6 @@ impl OperationStore<VerifiedOperation> for SqlStorage {
operations_v1.author,
operations_v1.document_id,
operations_v1.operation_id,
operations_v1.entry_hash,
operations_v1.action,
operations_v1.schema_id,
operations_v1.previous_operations,
Expand Down Expand Up @@ -232,7 +229,6 @@ impl OperationStore<VerifiedOperation> for SqlStorage {
operations_v1.author,
operations_v1.document_id,
operations_v1.operation_id,
operations_v1.entry_hash,
operations_v1.action,
operations_v1.schema_id,
operations_v1.previous_operations,
Expand Down
24 changes: 0 additions & 24 deletions aquadoggo/src/db/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,6 @@ mod tests {
"0020b177ec1bf26dfb3b7010d473e6d44713b29b765b99c6e60ecbfae742de496543"
.to_string(),
action: "create".to_string(),
entry_hash: "0020b177ec1bf26dfb3b7010d473e6d44713b29b765b99c6e60ecbfae742de496543"
.to_string(),
schema_id:
"venue_0020c65567ae37efea293e34a9c7d13f8f2bf23dbdc3b5c7b9ab46293111c48fc78b"
.to_string(),
Expand All @@ -390,8 +388,6 @@ mod tests {
"0020b177ec1bf26dfb3b7010d473e6d44713b29b765b99c6e60ecbfae742de496543"
.to_string(),
action: "create".to_string(),
entry_hash: "0020b177ec1bf26dfb3b7010d473e6d44713b29b765b99c6e60ecbfae742de496543"
.to_string(),
schema_id:
"venue_0020c65567ae37efea293e34a9c7d13f8f2bf23dbdc3b5c7b9ab46293111c48fc78b"
.to_string(),
Expand All @@ -409,8 +405,6 @@ mod tests {
"0020b177ec1bf26dfb3b7010d473e6d44713b29b765b99c6e60ecbfae742de496543"
.to_string(),
action: "create".to_string(),
entry_hash: "0020b177ec1bf26dfb3b7010d473e6d44713b29b765b99c6e60ecbfae742de496543"
.to_string(),
schema_id:
"venue_0020c65567ae37efea293e34a9c7d13f8f2bf23dbdc3b5c7b9ab46293111c48fc78b"
.to_string(),
Expand All @@ -428,8 +422,6 @@ mod tests {
"0020b177ec1bf26dfb3b7010d473e6d44713b29b765b99c6e60ecbfae742de496543"
.to_string(),
action: "create".to_string(),
entry_hash: "0020b177ec1bf26dfb3b7010d473e6d44713b29b765b99c6e60ecbfae742de496543"
.to_string(),
schema_id:
"venue_0020c65567ae37efea293e34a9c7d13f8f2bf23dbdc3b5c7b9ab46293111c48fc78b"
.to_string(),
Expand All @@ -450,8 +442,6 @@ mod tests {
"0020b177ec1bf26dfb3b7010d473e6d44713b29b765b99c6e60ecbfae742de496543"
.to_string(),
action: "create".to_string(),
entry_hash: "0020b177ec1bf26dfb3b7010d473e6d44713b29b765b99c6e60ecbfae742de496543"
.to_string(),
schema_id:
"venue_0020c65567ae37efea293e34a9c7d13f8f2bf23dbdc3b5c7b9ab46293111c48fc78b"
.to_string(),
Expand All @@ -472,8 +462,6 @@ mod tests {
"0020b177ec1bf26dfb3b7010d473e6d44713b29b765b99c6e60ecbfae742de496543"
.to_string(),
action: "create".to_string(),
entry_hash: "0020b177ec1bf26dfb3b7010d473e6d44713b29b765b99c6e60ecbfae742de496543"
.to_string(),
schema_id:
"venue_0020c65567ae37efea293e34a9c7d13f8f2bf23dbdc3b5c7b9ab46293111c48fc78b"
.to_string(),
Expand All @@ -494,8 +482,6 @@ mod tests {
"0020b177ec1bf26dfb3b7010d473e6d44713b29b765b99c6e60ecbfae742de496543"
.to_string(),
action: "create".to_string(),
entry_hash: "0020b177ec1bf26dfb3b7010d473e6d44713b29b765b99c6e60ecbfae742de496543"
.to_string(),
schema_id:
"venue_0020c65567ae37efea293e34a9c7d13f8f2bf23dbdc3b5c7b9ab46293111c48fc78b"
.to_string(),
Expand All @@ -516,8 +502,6 @@ mod tests {
"0020b177ec1bf26dfb3b7010d473e6d44713b29b765b99c6e60ecbfae742de496543"
.to_string(),
action: "create".to_string(),
entry_hash: "0020b177ec1bf26dfb3b7010d473e6d44713b29b765b99c6e60ecbfae742de496543"
.to_string(),
schema_id:
"venue_0020c65567ae37efea293e34a9c7d13f8f2bf23dbdc3b5c7b9ab46293111c48fc78b"
.to_string(),
Expand All @@ -538,8 +522,6 @@ mod tests {
"0020b177ec1bf26dfb3b7010d473e6d44713b29b765b99c6e60ecbfae742de496543"
.to_string(),
action: "create".to_string(),
entry_hash: "0020b177ec1bf26dfb3b7010d473e6d44713b29b765b99c6e60ecbfae742de496543"
.to_string(),
schema_id:
"venue_0020c65567ae37efea293e34a9c7d13f8f2bf23dbdc3b5c7b9ab46293111c48fc78b"
.to_string(),
Expand All @@ -560,8 +542,6 @@ mod tests {
"0020b177ec1bf26dfb3b7010d473e6d44713b29b765b99c6e60ecbfae742de496543"
.to_string(),
action: "create".to_string(),
entry_hash: "0020b177ec1bf26dfb3b7010d473e6d44713b29b765b99c6e60ecbfae742de496543"
.to_string(),
schema_id:
"venue_0020c65567ae37efea293e34a9c7d13f8f2bf23dbdc3b5c7b9ab46293111c48fc78b"
.to_string(),
Expand All @@ -582,8 +562,6 @@ mod tests {
"0020b177ec1bf26dfb3b7010d473e6d44713b29b765b99c6e60ecbfae742de496543"
.to_string(),
action: "create".to_string(),
entry_hash: "0020b177ec1bf26dfb3b7010d473e6d44713b29b765b99c6e60ecbfae742de496543"
.to_string(),
schema_id:
"venue_0020c65567ae37efea293e34a9c7d13f8f2bf23dbdc3b5c7b9ab46293111c48fc78b"
.to_string(),
Expand All @@ -604,8 +582,6 @@ mod tests {
"0020b177ec1bf26dfb3b7010d473e6d44713b29b765b99c6e60ecbfae742de496543"
.to_string(),
action: "create".to_string(),
entry_hash: "0020b177ec1bf26dfb3b7010d473e6d44713b29b765b99c6e60ecbfae742de496543"
.to_string(),
schema_id:
"venue_0020c65567ae37efea293e34a9c7d13f8f2bf23dbdc3b5c7b9ab46293111c48fc78b"
.to_string(),
Expand Down

0 comments on commit e574ecd

Please sign in to comment.