1+ -- Create a file with INSERT statements for the specific records
2+ \o 00102_import_chunks .sql
3+ \t on
4+ \a
5+ -- Write header comment
6+ SELECT ' -- +goose Up' ;
7+ SELECT ' -- +goose StatementBegin' ;
8+ SELECT ' ' ;
9+
10+ SELECT
11+ ' INSERT INTO chunk (' ||
12+ ' index, hash, start_block_number, start_block_hash, end_block_number, end_block_hash, ' ||
13+ ' start_block_time, total_l1_messages_popped_before, total_l1_messages_popped_in_chunk, ' ||
14+ ' prev_l1_message_queue_hash, post_l1_message_queue_hash, parent_chunk_hash, state_root, ' ||
15+ ' parent_chunk_state_root, withdraw_root, codec_version, enable_compress, ' ||
16+ ' total_l2_tx_gas, total_l2_tx_num, total_l1_commit_calldata_size, total_l1_commit_gas, ' ||
17+ ' created_at, updated_at' ||
18+ ' ) VALUES (' ||
19+ quote_literal(index) || ' , ' ||
20+ quote_literal(hash) || ' , ' ||
21+ quote_literal(start_block_number) || ' , ' ||
22+ quote_literal(start_block_hash) || ' , ' ||
23+ quote_literal(end_block_number) || ' , ' ||
24+ quote_literal(end_block_hash) || ' , ' ||
25+ quote_literal(start_block_time) || ' , ' ||
26+ quote_literal(total_l1_messages_popped_before) || ' , ' ||
27+ quote_literal(total_l1_messages_popped_in_chunk) || ' , ' ||
28+ quote_literal(prev_l1_message_queue_hash) || ' , ' ||
29+ quote_literal(post_l1_message_queue_hash) || ' , ' ||
30+ quote_literal(parent_chunk_hash) || ' , ' ||
31+ quote_literal(state_root) || ' , ' ||
32+ quote_literal(parent_chunk_state_root) || ' , ' ||
33+ quote_literal(withdraw_root) || ' , ' ||
34+ quote_literal(codec_version) || ' , ' ||
35+ quote_literal(enable_compress) || ' , ' ||
36+ quote_literal(total_l2_tx_gas) || ' , ' ||
37+ quote_literal(total_l2_tx_num) || ' , ' ||
38+ quote_literal(total_l1_commit_calldata_size) || ' , ' ||
39+ quote_literal(total_l1_commit_gas) || ' , ' ||
40+ quote_literal(created_at) || ' , ' ||
41+ quote_literal(updated_at) ||
42+ ' );'
43+ FROM chunk
44+ ORDER BY index ASC ;
45+
46+ -- Write footer
47+ SELECT ' ' ;
48+ SELECT ' -- +goose StatementEnd' ;
49+ SELECT ' -- +goose Down' ;
50+ SELECT ' -- +goose StatementBegin' ;
51+ SELECT ' DELETE FROM chunk;' ;
52+ SELECT ' -- +goose StatementEnd' ;
53+
54+ \t off
55+ \a
56+ \o
0 commit comments