Skip to main content

hypercall_db_diesel/
schema.rs

1//! Diesel schema definitions, auto-generated by `diesel print-schema`.
2//!
3//! Wallet/address columns are BYTEA (20 bytes). Price/size/fee columns use
4//! Numeric (`rust_decimal::Decimal`) for financial precision.
5
6// @generated automatically by Diesel CLI.
7
8diesel::table! {
9    order_infos (order_id) {
10        order_id -> BigInt,
11        wallet_address -> Bytea,
12        symbol -> Text,
13        side -> Text,
14        price -> Numeric,
15        size -> Numeric,
16        tif -> Text,
17        client_id -> Nullable<Text>,
18        is_perp -> Bool,
19        underlying -> Nullable<Text>,
20        reduce_only -> Nullable<Bool>,
21        nonce -> Nullable<BigInt>,
22        signature -> Nullable<Text>,
23        mmp_enabled -> Bool,
24        timestamp -> BigInt,
25        status -> Text,
26        filled_size -> Numeric,
27        created_at -> Nullable<Timestamp>,
28        updated_at -> Timestamp,
29        last_materialized_order_update_id -> Integer,
30    }
31}
32
33diesel::table! {
34    rejected_orders (id) {
35        id -> Nullable<Integer>,
36        wallet_address -> Bytea,
37        symbol -> Text,
38        side -> Text,
39        price -> Numeric,
40        size -> Numeric,
41        reason -> Text,
42        timestamp -> BigInt,
43        created_at -> Nullable<Timestamp>,
44    }
45}
46
47diesel::table! {
48    markets (underlying, expiry) {
49        underlying -> Text,
50        expiry -> BigInt,
51    }
52}
53
54diesel::table! {
55    instruments (id) {
56        instrument_numeric_id -> Integer,
57        id -> Text,
58        underlying -> Text,
59        strike -> Numeric,
60        expiry -> BigInt,
61        option_type -> Text,
62        option_token_address -> Nullable<Bytea>,
63        status -> Text,
64        trading_mode -> Text,
65    }
66}
67
68diesel::table! {
69    order_actions (id) {
70        id -> Nullable<Integer>,
71        timestamp -> BigInt,
72        wallet -> Bytea,
73        action -> Text,
74        symbol -> Text,
75        price -> Numeric,
76        size -> Numeric,
77        side -> Text,
78        tif -> Text,
79        client_id -> Nullable<Text>,
80        created_at -> Nullable<Timestamp>,
81    }
82}
83
84diesel::table! {
85    portfolio_snapshots (id) {
86        id -> Nullable<Integer>,
87        account -> Bytea,
88        symbol -> Text,
89        amount -> Numeric,
90        cash_balance -> Numeric,
91        last_fill_seq -> BigInt,
92        timestamp -> BigInt,
93        created_at -> Nullable<Timestamp>,
94    }
95}
96
97diesel::table! {
98    order_updates (id) {
99        id -> Nullable<Integer>,
100        timestamp -> BigInt,
101        order_id -> Nullable<BigInt>,
102        status -> Text,
103        reason -> Nullable<Text>,
104        filled_size -> Numeric,
105        symbol -> Text,
106        price -> Numeric,
107        size -> Numeric,
108        side -> Text,
109        tif -> Text,
110        client_id -> Nullable<Text>,
111        created_at -> Nullable<Timestamp>,
112    }
113}
114
115diesel::table! {
116    market_actions (id) {
117        id -> Nullable<Integer>,
118        timestamp -> BigInt,
119        action -> Text,
120        symbol -> Text,
121        underlying -> Text,
122        expiry -> BigInt,
123        strike -> Numeric,
124        option_type -> Text,
125        created_at -> Nullable<Timestamp>,
126    }
127}
128
129diesel::table! {
130    market_updates (id) {
131        id -> Nullable<Integer>,
132        timestamp -> BigInt,
133        status -> Text,
134        symbol -> Text,
135        underlying -> Text,
136        expiry -> BigInt,
137        strike -> Numeric,
138        option_type -> Text,
139        created_at -> Nullable<Timestamp>,
140    }
141}
142
143diesel::table! {
144    trades (trade_id) {
145        trade_id -> BigInt,
146        symbol -> Text,
147        price -> Numeric,
148        size -> Numeric,
149        maker_address -> Bytea,
150        taker_address -> Bytea,
151        maker_fee -> Numeric,
152        taker_fee -> Numeric,
153        timestamp -> BigInt,
154        created_at -> Nullable<Timestamp>,
155    }
156}
157
158diesel::table! {
159    account_balances (account_address) {
160        account_address -> Bytea,
161        balance -> Numeric,
162        updated_at -> Nullable<Timestamp>,
163    }
164}
165
166diesel::table! {
167    fills (fill_id) {
168        fill_id -> Nullable<BigInt>,
169        trade_id -> BigInt,
170        wallet_address -> Bytea,
171        symbol -> Text,
172        price -> Numeric,
173        size -> Numeric,
174        fee -> Numeric,
175        is_taker -> Bool,
176        timestamp -> BigInt,
177        builder_code_address -> Nullable<Bytea>,
178        builder_code_fee -> Nullable<Numeric>,
179        realized_pnl -> Nullable<Numeric>,
180        underlying_notional -> Nullable<Numeric>,
181        created_at -> Nullable<Timestamp>,
182    }
183}
184
185diesel::table! {
186    mmp_configs (wallet_address, currency) {
187        wallet_address -> Bytea,
188        currency -> Text,
189        interval_ms -> BigInt,
190        frozen_time_ms -> BigInt,
191        qty_limit -> Nullable<Numeric>,
192        delta_limit -> Nullable<Numeric>,
193        vega_limit -> Nullable<Numeric>,
194        enabled -> Bool,
195        created_at -> Nullable<Timestamp>,
196        updated_at -> Nullable<Timestamp>,
197    }
198}
199
200diesel::table! {
201    user_tiers (wallet_address) {
202        wallet_address -> Bytea,
203        tier -> Text,
204        created_at -> Nullable<Timestamp>,
205        updated_at -> Nullable<Timestamp>,
206        margin_mode -> Text,
207        version -> BigInt,
208        max_open_orders -> Nullable<Integer>,
209        max_open_positions -> Integer,
210        orders_per_minute -> Integer,
211        cancels_per_minute -> Integer,
212        api_requests_per_minute -> Integer,
213    }
214}
215
216diesel::table! {
217    tier_defaults (tier) {
218        tier -> Text,
219        max_open_orders -> Integer,
220        max_open_positions -> Integer,
221        orders_per_minute -> Integer,
222        cancels_per_minute -> Integer,
223        api_requests_per_minute -> Integer,
224    }
225}
226
227// === New tables for portfolio snapshot service ===
228
229diesel::table! {
230    engine_snapshots (id) {
231        id -> BigInt,
232        created_at -> Timestamptz,
233        snapshot_type -> Text,
234        engine_version -> Nullable<Text>,
235    }
236}
237
238diesel::table! {
239    portfolio_snapshot_accounts (snapshot_id, wallet) {
240        snapshot_id -> BigInt,
241        wallet -> Text,
242        data -> Bytea,
243    }
244}
245
246diesel::table! {
247    portfolio_snapshot_offsets (snapshot_id, stream, partition) {
248        snapshot_id -> BigInt,
249        stream -> Text,
250        partition -> Int4,
251        offset -> BigInt,
252    }
253}
254
255diesel::joinable!(portfolio_snapshot_accounts -> engine_snapshots (snapshot_id));
256diesel::joinable!(portfolio_snapshot_offsets -> engine_snapshots (snapshot_id));
257
258// === Oracle tables for mark price oracle ===
259
260diesel::table! {
261    oracle_price_samples (id) {
262        id -> BigInt,
263        symbol -> Text,
264        expiry_timestamp -> BigInt,
265        sample_timestamp_ms -> BigInt,
266        price -> Double,
267        source -> Text,
268        created_at -> Timestamptz,
269    }
270}
271
272diesel::table! {
273    oracle_settlement_prices (id) {
274        id -> BigInt,
275        symbol -> Text,
276        expiry_timestamp -> BigInt,
277        settlement_price -> Double,
278        sample_count -> Int4,
279        window_start -> BigInt,
280        window_end -> BigInt,
281        algorithm -> Text,
282        computed_at -> Timestamptz,
283    }
284}
285
286// === Liquidation Service Tables ===
287
288diesel::table! {
289    liquidation_states (wallet_address) {
290        wallet_address -> Bytea,
291        state -> Text,
292        margin_mode -> Text,
293        equity -> Numeric,
294        mm_required -> Numeric,
295        maintenance_margin -> Numeric,
296        liquidation_mode -> Nullable<Text>,
297        target_equity -> Nullable<Numeric>,
298        entered_pre_liq_at -> Nullable<BigInt>,
299        mm_shortfall -> Nullable<Numeric>,
300        escalation_deadline -> Nullable<BigInt>,
301        last_reprice_at -> Nullable<BigInt>,
302        partial_order_request_ids -> Nullable<Jsonb>,
303        partial_order_client_ids -> Nullable<Jsonb>,
304        partial_bonus_bps -> Nullable<Integer>,
305        auction_id -> Nullable<Text>,
306        request_id -> Nullable<Text>,
307        tx_hash -> Nullable<Text>,
308        auction_started_at -> Nullable<BigInt>,
309        chain_start_time -> Nullable<BigInt>,
310        margin_needed -> Nullable<Numeric>,
311        stop_request_id -> Nullable<Text>,
312        stop_tx_hash -> Nullable<Text>,
313        liquidated_at -> Nullable<BigInt>,
314        resolved_winner -> Nullable<Bytea>,
315        resolved_bonus -> Nullable<Numeric>,
316        resolution_tx_hash -> Nullable<Text>,
317        last_observed_block -> Nullable<BigInt>,
318        updated_at_ms -> Nullable<BigInt>,
319        created_at -> Nullable<Timestamp>,
320        updated_at -> Nullable<Timestamp>,
321    }
322}
323
324diesel::table! {
325    liquidation_history (id) {
326        id -> BigInt,
327        wallet_address -> Bytea,
328        previous_state -> Text,
329        new_state -> Text,
330        liquidation_mode -> Nullable<Text>,
331        equity -> Numeric,
332        mm_required -> Numeric,
333        maintenance_margin -> Numeric,
334        shortfall -> Numeric,
335        auction_id -> Nullable<Text>,
336        request_id -> Nullable<Text>,
337        tx_hash -> Nullable<Text>,
338        margin_needed -> Nullable<Numeric>,
339        winner_address -> Nullable<Bytea>,
340        bonus -> Nullable<Numeric>,
341        details -> Jsonb,
342        timestamp -> BigInt,
343        created_at -> Nullable<Timestamp>,
344    }
345}
346
347diesel::table! {
348    liquidation_auctions (auction_id) {
349        auction_id -> Text,
350        wallet_address -> Bytea,
351        status -> Text,
352        positions -> Jsonb,
353        equity_at_start -> Numeric,
354        mm_shortfall_at_start -> Numeric,
355        target_equity -> Nullable<Numeric>,
356        request_id -> Nullable<Text>,
357        tx_hash -> Nullable<Text>,
358        started_at -> BigInt,
359        chain_start_time -> Nullable<BigInt>,
360        margin_needed -> Nullable<Numeric>,
361        stop_request_id -> Nullable<Text>,
362        stop_tx_hash -> Nullable<Text>,
363        completed_at -> Nullable<BigInt>,
364        liquidator_address -> Nullable<Bytea>,
365        bonus -> Nullable<Numeric>,
366        settlement_value -> Nullable<Numeric>,
367        last_observed_block -> Nullable<BigInt>,
368        created_at -> Nullable<Timestamp>,
369        updated_at -> Nullable<Timestamp>,
370    }
371}
372
373diesel::table! {
374    rsm_signer_nonces (signer_address) {
375        signer_address -> Bytea,
376        next_nonce -> BigInt,
377        last_synced_nonce -> Nullable<BigInt>,
378        created_at -> Nullable<Timestamp>,
379        updated_at -> Nullable<Timestamp>,
380    }
381}
382
383diesel::table! {
384    rsm_signer_requests (request_id) {
385        request_id -> Text,
386        signer_address -> Bytea,
387        account_address -> Bytea,
388        action -> Bytea,
389        nonce -> BigInt,
390        status -> Text,
391        directive -> Nullable<Bytea>,
392        signature -> Nullable<Text>,
393        created_at -> Nullable<Timestamp>,
394        updated_at -> Nullable<Timestamp>,
395    }
396}
397// === Settlement idempotency tables ===
398
399diesel::table! {
400    position_expirations (id) {
401        id -> BigInt,
402        wallet -> Bytea,
403        symbol -> Text,
404        expiry_ts -> BigInt,
405        settlement_price -> Numeric,
406        settlement_value -> Numeric,
407        applied_at -> Nullable<Timestamptz>,
408    }
409}
410
411diesel::table! {
412    settlement_payouts (id) {
413        id -> BigInt,
414        wallet -> Bytea,
415        symbol -> Text,
416        expiry_ts -> BigInt,
417        position_size -> Numeric,
418        settlement_price -> Numeric,
419        payout_amount -> Numeric,
420        ledger_applied -> Bool,
421        created_at -> Nullable<Timestamptz>,
422        settlement_entry_price -> Nullable<Numeric>,
423        cost_basis -> Nullable<Numeric>,
424        net_pnl -> Nullable<Numeric>,
425    }
426}
427
428diesel::table! {
429    historical_pnl_snapshots (id) {
430        id -> BigInt,
431        wallet_address -> Bytea,
432        interval_ms -> BigInt,
433        timestamp_ms -> BigInt,
434        total_equity -> Numeric,
435        created_at -> Timestamptz,
436        attribution -> Nullable<Bytea>,
437    }
438}
439
440diesel::table! {
441    historical_theo_snapshots (id) {
442        id -> BigInt,
443        symbol -> Text,
444        interval_ms -> BigInt,
445        timestamp_ms -> BigInt,
446        theoretical_price -> Numeric,
447        created_at -> Timestamptz,
448    }
449}
450
451diesel::table! {
452    vol_surface_snapshots (id) {
453        id -> BigInt,
454        underlying -> Text,
455        interval_ms -> BigInt,
456        timestamp_ms -> BigInt,
457        surface_json -> Jsonb,
458        created_at -> Timestamptz,
459    }
460}
461
462diesel::table! {
463    bbo_snapshots (id) {
464        id -> BigInt,
465        symbol -> Text,
466        best_bid -> Numeric,
467        best_ask -> Numeric,
468        best_bid_size -> Nullable<Numeric>,
469        best_ask_size -> Nullable<Numeric>,
470        snapshot_ts -> BigInt,
471        created_at -> Timestamptz,
472    }
473}
474
475diesel::table! {
476    usernames (wallet_address) {
477        wallet_address -> Text,
478        username -> Text,
479        created_at -> Timestamptz,
480        updated_at -> Timestamptz,
481    }
482}
483
484diesel::table! {
485    settlement_payout_seen (wallet, payout_id) {
486        wallet -> Bytea,
487        payout_id -> BigInt,
488        seen_at -> Timestamptz,
489    }
490}
491
492diesel::table! {
493    competitions (id) {
494        id -> BigInt,
495        name -> Text,
496        description -> Nullable<Text>,
497        rules_url -> Nullable<Text>,
498        rules_content -> Nullable<Text>,
499        win_conditions -> Array<Text>,
500        primary_win_condition -> Text,
501        start_ts_ms -> BigInt,
502        end_ts_ms -> BigInt,
503        created_at -> Timestamptz,
504        updated_at -> Timestamptz,
505    }
506}
507
508diesel::table! {
509    competition_final_stats (id) {
510        id -> BigInt,
511        competition_id -> BigInt,
512        wallet -> Bytea,
513        rank -> Int4,
514        pnl -> Numeric,
515        volume -> Numeric,
516        efficiency -> Numeric,
517        medal -> Nullable<Int4>,
518        finalized_at -> Timestamptz,
519        created_at -> Timestamptz,
520    }
521}
522
523diesel::table! {
524    user_profiles (wallet_address) {
525        wallet_address -> Bytea,
526        approved_username -> Nullable<Text>,
527        profile_image_url -> Nullable<Text>,
528        profile_image_updated_at -> Nullable<Timestamptz>,
529        created_at -> Timestamptz,
530        updated_at -> Timestamptz,
531    }
532}
533
534diesel::table! {
535    ledger_events (id) {
536        id -> BigInt,
537        wallet -> Bytea,
538        event_ts_ms -> BigInt,
539        delta -> Numeric,
540        event_type -> Text,
541        reference_trade_id -> Nullable<BigInt>,
542        reference_symbol -> Nullable<Text>,
543        created_at -> Timestamptz,
544    }
545}
546
547diesel::table! {
548    competition_fill_events (id) {
549        id -> BigInt,
550        trade_id -> BigInt,
551        wallet -> Bytea,
552        symbol -> Text,
553        side -> Text,
554        price -> Numeric,
555        size -> Numeric,
556        fee -> Numeric,
557        timestamp_ms -> BigInt,
558        created_at -> Timestamptz,
559    }
560}
561
562// === Engine Journal Tables ===
563
564diesel::table! {
565    use diesel::sql_types::*;
566    use crate::engine_enums::EngineCommandTypeSql;
567
568    engine_commands (command_id) {
569        command_id -> BigInt,
570        received_ts_ms -> BigInt,
571        command_json -> Nullable<Jsonb>,
572        response_json -> Nullable<Jsonb>,
573        created_at -> Timestamptz,
574        order_id -> Nullable<BigInt>,
575        command_data -> Nullable<Bytea>,
576        response_data -> Nullable<Bytea>,
577        request_uuid -> Uuid,
578        command_type_enum -> Nullable<EngineCommandTypeSql>,
579    }
580}
581
582diesel::table! {
583    use diesel::sql_types::*;
584    use crate::engine_enums::EngineEventTypeSql;
585
586    engine_events (event_id) {
587        event_id -> BigInt,
588        command_id -> BigInt,
589        event_idx -> Int4,
590        event_data -> Bytea,
591        event_key -> Nullable<Text>,
592        l2_sequence -> Nullable<BigInt>,
593        created_at -> Timestamptz,
594        // Outbox publish tracking fields
595        published_at -> Nullable<Timestamptz>,
596        publish_attempts -> Int4,
597        last_publish_error -> Nullable<Text>,
598        last_publish_attempt_at -> Nullable<Timestamptz>,
599        event_type_enum -> EngineEventTypeSql,
600    }
601}
602
603diesel::table! {
604    engine_command_digests (command_id) {
605        command_id -> BigInt,
606        duration_ms -> BigInt,
607        created_at -> Timestamptz,
608        pre_digest_data -> Bytea,
609        post_digest_data -> Bytea,
610    }
611}
612
613diesel::table! {
614    push_subscriptions (id) {
615        id -> BigInt,
616        wallet_address -> Text,
617        endpoint -> Text,
618        auth_key -> Text,
619        p256dh_key -> Text,
620        preferences -> Jsonb,
621        created_at -> Timestamptz,
622    }
623}
624
625diesel::table! {
626    notifications (id) {
627        id -> BigInt,
628        wallet_address -> Text,
629        notification_type -> Text,
630        payload -> Bytea,
631        read_at -> Nullable<Timestamptz>,
632        created_at -> Timestamptz,
633    }
634}
635
636diesel::table! {
637    directive_outbox (outbox_seq) {
638        outbox_seq -> BigInt,
639        directive_id -> Text,
640        action_key -> Text,
641        domain_status -> Text,
642        delivery_status -> Text,
643        submitter_address -> Nullable<Bytea>,
644        submitter_nonce -> Nullable<BigInt>,
645        tx_hash -> Nullable<Text>,
646        last_delivery_error -> Nullable<Text>,
647        updated_at -> Timestamptz,
648    }
649}
650
651diesel::table! {
652    transaction_submitter_submissions (submission_id) {
653        submission_id -> BigInt,
654        submitter_address -> Bytea,
655        nonce -> BigInt,
656        status -> Text,
657        primary_tx_hash -> Nullable<Text>,
658        terminal_error -> Nullable<Text>,
659        created_at -> Timestamptz,
660        updated_at -> Timestamptz,
661    }
662}
663
664diesel::table! {
665    transaction_submitter_attempts (attempt_id) {
666        attempt_id -> BigInt,
667        submission_id -> BigInt,
668        tx_hash -> Text,
669        raw_tx -> Bytea,
670        created_at -> Timestamptz,
671    }
672}
673
674diesel::joinable!(engine_events -> engine_commands (command_id));
675diesel::joinable!(engine_command_digests -> engine_commands (command_id));
676diesel::joinable!(settlement_payout_seen -> settlement_payouts (payout_id));
677diesel::joinable!(competition_final_stats -> competitions (competition_id));
678diesel::joinable!(transaction_submitter_attempts -> transaction_submitter_submissions (submission_id));
679
680diesel::allow_tables_to_appear_in_same_query!(
681    order_infos,
682    rejected_orders,
683    markets,
684    instruments,
685    order_actions,
686    order_updates,
687    market_actions,
688    market_updates,
689    trades,
690    account_balances,
691    fills,
692    mmp_configs,
693    user_tiers,
694    tier_defaults,
695    engine_snapshots,
696    portfolio_snapshot_accounts,
697    portfolio_snapshot_offsets,
698    oracle_price_samples,
699    oracle_settlement_prices,
700    liquidation_states,
701    liquidation_history,
702    liquidation_auctions,
703    rsm_signer_nonces,
704    rsm_signer_requests,
705    position_expirations,
706    settlement_payouts,
707    historical_pnl_snapshots,
708    historical_theo_snapshots,
709    vol_surface_snapshots,
710    bbo_snapshots,
711    settlement_payout_seen,
712    competitions,
713    competition_final_stats,
714    user_profiles,
715    ledger_events,
716    competition_fill_events,
717    engine_commands,
718    engine_events,
719    engine_command_digests,
720    usernames,
721    quote_providers,
722    rfq_records,
723    rfq_legs,
724    rfq_quotes,
725    rfq_quote_legs,
726    rfq_fills,
727    push_subscriptions,
728    notifications,
729    directive_outbox,
730    transaction_submitter_submissions,
731    transaction_submitter_attempts,
732    engine_snapshot_boundary,
733);
734
735diesel::table! {
736    engine_snapshot_boundary (id) {
737        id -> Int4,
738        last_command_id -> BigInt,
739        updated_at -> Timestamptz,
740    }
741}
742
743diesel::table! {
744    quote_providers (wallet_address) {
745        wallet_address -> Bytea,
746        tier -> Text,
747        status -> Text,
748        allowed_underlyings -> Nullable<Array<Text>>,
749        max_notional_per_quote -> Numeric,
750        max_open_notional -> Numeric,
751        created_at -> Timestamptz,
752        updated_at -> Timestamptz,
753    }
754}
755
756diesel::table! {
757    rfq_records (rfq_id) {
758        rfq_id -> Text,
759        taker_wallet -> Bytea,
760        underlying -> Text,
761        status -> Text,
762        taker_signature -> Text,
763        taker_nonce -> BigInt,
764        legs_hash -> Bytea,
765        created_at -> Timestamptz,
766        expires_at -> Timestamptz,
767        executed_at -> Nullable<Timestamptz>,
768    }
769}
770
771diesel::table! {
772    rfq_legs (id) {
773        id -> Text,
774        rfq_id -> Text,
775        instrument -> Text,
776        side -> Text,
777        size -> Numeric,
778        leg_index -> SmallInt,
779    }
780}
781
782diesel::table! {
783    rfq_quotes (quote_id) {
784        quote_id -> Text,
785        rfq_id -> Text,
786        qp_wallet -> Bytea,
787        net_premium -> Numeric,
788        valid_for_ms -> BigInt,
789        qp_signature -> Text,
790        qp_nonce -> BigInt,
791        created_at -> Timestamptz,
792        expires_at -> Timestamptz,
793    }
794}
795
796diesel::table! {
797    rfq_quote_legs (id) {
798        id -> Text,
799        quote_id -> Text,
800        instrument -> Text,
801        side -> Text,
802        price -> Numeric,
803        size -> Numeric,
804        leg_index -> SmallInt,
805    }
806}
807
808diesel::table! {
809    rfq_fills (fill_id) {
810        fill_id -> Text,
811        rfq_id -> Text,
812        quote_id -> Text,
813        taker_wallet -> Bytea,
814        qp_wallet -> Bytea,
815        net_premium -> Numeric,
816        taker_accept_signature -> Text,
817        executed_at -> Timestamptz,
818    }
819}
820
821#[cfg(feature = "rsm-state")]
822diesel::table! {
823    validator_rsm_blocks (environment, height) {
824        environment -> SmallInt,
825        height -> BigInt,
826        hash -> Bytea,
827        parent_hash -> Bytea,
828        commands_hash -> Bytea,
829        batch_root -> Bytea,
830        command_count -> BigInt,
831        first_command_seq -> BigInt,
832        last_command_seq -> BigInt,
833        signer -> Nullable<Bytea>,
834        signature -> Nullable<Bytea>,
835        created_at -> Timestamptz,
836    }
837}
838
839#[cfg(feature = "rsm-state")]
840diesel::table! {
841    use diesel::sql_types::*;
842    use crate::engine_enums::EngineCommandTypeSql;
843
844    validator_rsm_block_commands (environment, height, rsm_command_seq) {
845        environment -> SmallInt,
846        height -> BigInt,
847        rsm_command_seq -> BigInt,
848        command_index -> BigInt,
849        engine_command_id -> BigInt,
850        request_uuid -> Uuid,
851        command_type -> EngineCommandTypeSql,
852        command_data -> Bytea,
853        command_identity_hash -> Bytea,
854        created_at -> Timestamptz,
855    }
856}
857
858#[cfg(feature = "rsm-state")]
859diesel::table! {
860    validator_rsm_batch_roots (environment, version) {
861        environment -> SmallInt,
862        version -> BigInt,
863        batch_seq -> BigInt,
864        state_root -> Bytea,
865        risk_root -> Bytea,
866        command_mmr_root -> Bytea,
867        obligation_mmr_root -> Bytea,
868        intent_mmr_root -> Bytea,
869        batch_root -> Bytea,
870        command_range_start -> BigInt,
871        command_range_end -> BigInt,
872        command_count -> BigInt,
873        schema_version -> Integer,
874        accepted_block_hash -> Bytea,
875        created_at -> Timestamptz,
876    }
877}
878
879#[cfg(feature = "rsm-state")]
880diesel::table! {
881    validator_rsm_current_state (environment) {
882        environment -> SmallInt,
883        current_version -> BigInt,
884        updated_at -> Timestamptz,
885    }
886}
887
888diesel::joinable!(rfq_legs -> rfq_records (rfq_id));
889diesel::joinable!(rfq_quotes -> rfq_records (rfq_id));
890diesel::joinable!(rfq_quote_legs -> rfq_quotes (quote_id));
891diesel::joinable!(rfq_fills -> rfq_records (rfq_id));
892diesel::joinable!(rfq_fills -> rfq_quotes (quote_id));
893#[cfg(feature = "rsm-state")]
894diesel::joinable!(validator_rsm_block_commands -> engine_commands (engine_command_id));
895
896#[cfg(feature = "rsm-state")]
897diesel::allow_tables_to_appear_in_same_query!(
898    engine_commands,
899    validator_rsm_blocks,
900    validator_rsm_block_commands,
901    validator_rsm_batch_roots,
902    validator_rsm_current_state,
903);