-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove migration and model files for event logs...
- Loading branch information
1 parent
879b492
commit 446f072
Showing
4 changed files
with
127 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,36 @@ | ||
# your file name is you table name, for example, this table name is "event_log" | ||
|
||
# user address and topics to select event logs(jsonrpc getLogs) | ||
address: "0x35bd452c37d28beca42097cfd8ba671c8dd430a1" | ||
topics: [] | ||
table_name: "records" | ||
# type, column name, data name, no data name means data name equals to column name | ||
# "decode#data" means decode data | ||
# type can be "string", "integer", "bigint", "text" | ||
# we'll save ["string", "transactionHash"] and ["string", "blockNumber"] for check unique log | ||
# Postgres database types | ||
# type can be "varchar", "integer", "bigint", "text", "json" and so on... | ||
# we'll save ["varchar", "transactionHash"] and ["varchar", "blockNumber"] for check unique log | ||
columns: | ||
- ["string", "data"] | ||
- ["string", "blockHash", "blockHash"] | ||
- ["string", "block_number", "blockNumber"] | ||
- ["varchar", "data"] # preferred | ||
- ["varchar", "blockHash", "blockHash"] | ||
- ["varchar", "transaction_index", "transactionIndex"] | ||
|
||
# address => string | ||
# string => string | ||
# uint256 => integer, bigint, string | ||
# address => varchar | ||
# string => varchar | ||
# uint256 => integer, bigint, varchar | ||
decode: | ||
abi_inputs: | ||
[{ | ||
"indexed": false, | ||
"name": "_sender", | ||
"type": "address" | ||
}, { | ||
"indexed": false, | ||
"name": "_text", | ||
"type": "string" | ||
}, { | ||
"indexed": true, | ||
"name": "_time", | ||
"type": "uint256" | ||
}] | ||
"indexed": false, | ||
"name": "_sender", | ||
"type": "address" | ||
}, { | ||
"indexed": false, | ||
"name": "_text", | ||
"type": "string" | ||
}, { | ||
"indexed": true, | ||
"name": "_time", | ||
"type": "uint256" | ||
}] | ||
names: ["sender", "text", "time"] | ||
column_types: ["string", "string", "bigint"] | ||
column_types: ["varchar", "varchar", "bigint"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
namespace :event_log do | ||
desc "create a event log model and migration" | ||
task :create, [:file_name] => :environment do |task, args| | ||
puts EventLogProcess.new(args[:file_name]).generate_model | ||
puts EventLog.find_by(name: args[:file_name])&.update(block_number: nil) | ||
puts `bundle exec rake db:migrate` | ||
puts EventLogProcess.new(args[:file_name]).create_table | ||
end | ||
end |