Skip to content

Commit

Permalink
fixup! feat(db): Add Epoch and Snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
fmoura committed Aug 9, 2024
1 parent 54e758a commit 8a39aee
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 13 additions & 0 deletions internal/repository/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,19 @@ func (s *RepositorySuite) TestGetSnapshot() {
s.Require().Equal(&expectedSnapshot, actualSnapshot)
}

func (s *RepositorySuite) TestInsertSnapshotFailsSameInputId() {

snapshot := Snapshot{
InputId: 1,
AppAddress: common.HexToAddress("feadbeef"),
URI: "/some/path",
}

_, err := s.database.InsertSnapshot(s.ctx, &snapshot)
s.Require().ErrorContains(err, "violates unique constraint")

}

func TestRepositorySuite(t *testing.T) {
suite.Run(t, new(RepositorySuite))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ CREATE TABLE "snapshot"
"uri" VARCHAR(4096) NOT NULL,
CONSTRAINT "snapshot_pkey" PRIMARY KEY ("id"),
CONSTRAINT "snapshot_input_id_fkey" FOREIGN KEY ("input_id") REFERENCES "input"("id"),
CONSTRAINT "snapshot_application_address_fkey" FOREIGN KEY ("application_address") REFERENCES "application"("contract_address")
CONSTRAINT "snapshot_application_address_fkey" FOREIGN KEY ("application_address") REFERENCES "application"("contract_address"),
UNIQUE("input_id")
);

CREATE TABLE "node_config"
Expand Down

0 comments on commit 8a39aee

Please sign in to comment.