Replace compiled_contracts.sources
column with source_codes
and compiled_contracts_sources
tables
#15
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds the two new tables that will replace the
compiled_contracts.sources
column:source_codes
andcompiled_contracts_sources
.In
source_codes
we provide the source hashes (sha256,keccak256), the language (solidity,vyper,...) the content of the file and the standard timestamp and ownership fields; we use the file's sha256 as primary key.language
is stored here to avoid having to joincompiled_contract
to find the language of that source.compiled_contracts_sources
is a many-to-many relationship table betweencompiled_contract
andsource_codes
using their respective PK as foreign keys (compilation_id->compiled_contract.id
,source_code_hash->source_codes.source_codes
). Incompiled_contracts_sources
we also have thepath
, since it varies for every compilation. This table doesn't contain timestamp and ownership fields since it's an extension of thecompiled_contract
table.Diagram