Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add table operation_log to rollup #46

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions migrations/rollup_state/20211202065806_operation_log.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-- Add migration script here

CREATE TABLE operation_log (
id BIGINT CHECK (id >= 0) NOT NULL PRIMARY KEY,
time TIMESTAMP(0) NOT NULL,
method TEXT NOT NULL,
params TEXT NOT NULL
);
1 change: 1 addition & 0 deletions src/db/models/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ cfg_if::cfg_if! {
mod rollup_state;
pub use rollup_state::account;
pub use rollup_state::l2_block;
pub use rollup_state::operation_log;
pub use rollup_state::tablenames;
pub use rollup_state::task;
}
Expand Down
2 changes: 2 additions & 0 deletions src/db/models/rollup_state/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
pub mod tablenames {
pub const ACCOUNT: &str = "account";
pub const L2_BLOCK: &str = "l2block";
pub const OPERATION_LOG: &str = "operation_log";
pub const TASK: &str = "task";
}

pub mod account;
pub mod l2_block;
pub mod operation_log;
pub mod task;
10 changes: 10 additions & 0 deletions src/db/models/rollup_state/operation_log.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use crate::db::TimestampDbType;
use serde::{Deserialize, Serialize};

#[derive(sqlx::FromRow, Debug, Clone, Serialize, Deserialize)]
pub struct OperationLog {
pub id: i64,
pub time: TimestampDbType,
pub method: String,
pub params: String, // TODO: change it to jsonb
}