Conversation
2b88442 to
2f24317
Compare
|
Changed the comment deletion logic in the DB so that it moves a deleted record to |
|
Not sure about the current strategy, since having a similar table creates dependency on the original one, so when we want to modify/split the original table we would also have to do it with the archived table, and in the archived data. The current goal is to just do not lose information, so I agree with the archive concept, just how about implementing it with a more general approach, for example an Anyway if we seriously aim to not lose information and query better all data over time, that is, to have a time model for the data, we should probably consider using Datomic in the future. |
oskarth
left a comment
There was a problem hiding this comment.
Some general comments, no strong opinions on implementation
| @@ -0,0 +1 @@ | |||
| DROP TABLE issues_archived; | |||
There was a problem hiding this comment.
Seems safer to rename it and leave it be for a while, then do cleanup task once it is 100% it works well in both test and production.
There was a problem hiding this comment.
This is just a migration down, so why is the alter table really needed? We are not migrating down in production.
There was a problem hiding this comment.
I'm not decided on this. Suggest to keep it as is, might help during testing on develop.
There was a problem hiding this comment.
It's just because this breaks migration semantics I believe. To me migrations should be able to run up and down several times, and this would break that.
There was a problem hiding this comment.
Got you. Sounds reasonable. Changed to DROP.
| (when (= "reopened" action) | ||
| (handle-issue-reopened webhook-payload))) | ||
| (ok)) | ||
| (case action |
use archived issues as a contract pool when deploying new contracts
|
Changed the code so that deleted issues go to |
| ('user'); | ||
|
|
||
| CREATE TABLE archive ( | ||
| type TEXT REFERENCES data_types(name), |
There was a problem hiding this comment.
How about using an enum type so that we are not coupled to database values, but just to structure?
| -- :name remove-issue! :<! :1 | ||
| -- :doc removes issue | ||
| WITH archived AS ( | ||
| INSERT INTO archive(type,data) |
There was a problem hiding this comment.
How about describing this in clojure? I think that it is better to keep persistence as simple as possible and to have all of the logic in the the application code.
There was a problem hiding this comment.
I think it's simple enough to stay in a query, plus one roundtrip less to DB is a good thing.
|
|
||
| -- :name contract-from-pool :? :1 | ||
| -- :doc return first contract from archive for given owner | ||
| SELECT a.data->>'transaction_hash' as transaction_hash |
There was a problem hiding this comment.
Not totally convinced about treating an archive to use application logic there apart from archiving. How about modelling the Ethereum contract in a table, even if only with the params that we need right now (I think that transaction_hash and owner_address), and we don't need to archive it, but just need an attribute for status?
There was a problem hiding this comment.
@siphiuel Let me understand well the query before elaborating the proposal. Why are we selecting a.data->>'transaction_hash' and then filtering for it to be null with a.data->>'transaction_hash' = i.transaction_hash and i.transaction_hash is null? I might be understanding badly the logic. :S
There was a problem hiding this comment.
We use left join condition issues.transaction_hash=null so that to pick transaction hashes that are not in use already. It might happen that a record has been removed from issues table to the archive, and then restored. However, the archive table is append-only, so this will result in the same transaction hash being present both in issues and in the archive, and we want to filter that away.
There was a problem hiding this comment.
Okay, got it, thanks!
So my proposal was about starting modelling the Ethereum contract, since it is a model with some data in the end. And doing so only with the attributes and behaviours of the contract that we need for this.
For example, we could have a table ethereum_contract, with attrs id, owner_address, transaction_hash, status. When an issue is archived and has a contract that we can reuse, we can create a contract model there with the status not-used (or maybe a better name). Then when looking for available contracts, we search there, and when taking one, we change the status of it to used. That way we would avoid querying the archive table for application logic, and would express more directly the status of a contract and its filtering.
There was a problem hiding this comment.
Let's handle contract modeling in a separate issue: #267.
src/clj/commiteth/bounties.clj
Outdated
| (log/debug "Total issues for repo limit reached " repo " " count) | ||
| (add-bounty-for-issue repo repo-id issue)))) | ||
|
|
||
| (defn remove-bounty-for-issue [repo repo-id issue] |
There was a problem hiding this comment.
Probably better ending with !
src/clj/commiteth/db/issues.clj
Outdated
| :issue_number issue-number | ||
| :title issue-title}))) | ||
|
|
||
| (defn remove |
There was a problem hiding this comment.
Probably better ending with !
src/clj/commiteth/github/core.clj
Outdated
| (log/debug "Posting comment to" (str owner "/" repo "/" issue-number) ":" comment) | ||
| (issues/create-comment owner repo issue-number comment (self-auth-params)))) | ||
|
|
||
| (defn remove-deploying-comment |
There was a problem hiding this comment.
Probably better ending with !
use enum instead of table for data type storage
|
Agree. |
|
This seems good but I'm also a little bit worried about introducing a separate table. Wouldn't something like Thinking about #284 we'd need to
Are there any specific benefits with the separate table approach? |
|
Good point! Initially I've opted for Still, can think of 2 things in favor of archive approach:
Actually, the whole audit-trail related thing is important and requires more thought. |
|
To me the reason to not face re-modelling here isn't just about laziness, but about strategy. Introducing new tables or fields requires extra work in some existing things, and so might produce bugs as well. And we already intend to re-model with a different structure. So facing re-modelling here and in the new structure isn't probably needed. Besides, the feature that depends on the archive is an optional feature (re-use a contract) and easily refactored if needed. |
Agree. Event Sourcing may be an interesting approach for this as well and is fundamentally similar to how Datomic works. |
I personally don't think they're similar, since Event Sourcing is just about modelling and persisting round domain events, while Datomic is a general-purpose database that adds the time dimension. |
1. GH comment is not posted after deploying contractSteps:
Actual result:GH comment with contract details Expected result:no GH comment Video: http://take.ms/SMVwj |
…-bounty into feature/readd-bounty-#185
…-bounty into feature/readd-bounty-#185
FIX #185
Description
This fix does the following:
unlabeledevents from GitHub API.value_usdfield). This removes the bounty from SOB.Questions
value_usdthe correct field to check against when removing a bounty?Status: Finished.