Skip to content
Merged
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
115 changes: 115 additions & 0 deletions backend/logs/audit-immutable.log

Large diffs are not rendered by default.

1,955 changes: 1,955 additions & 0 deletions backend/logs/combined.log

Large diffs are not rendered by default.

236 changes: 236 additions & 0 deletions backend/logs/error.log

Large diffs are not rendered by default.

1,105 changes: 1,105 additions & 0 deletions backend/test_output.log

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions pending/001_create_jobs_table.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
-- Create jobs table for async task queue
CREATE TABLE IF NOT EXISTS jobs (
id UUID PRIMARY KEY,
job_type VARCHAR(50) NOT NULL,
status VARCHAR(20) NOT NULL DEFAULT 'queued',
payload JSONB NOT NULL,
result JSONB,
progress_percent INTEGER NOT NULL DEFAULT 0,
progress_message VARCHAR(255) NOT NULL DEFAULT 'Queued',
webhook_url VARCHAR(500),
webhook_headers JSONB,
webhook_secret VARCHAR(255),
error_message TEXT,
error_type VARCHAR(50),
timeout_secs INTEGER NOT NULL DEFAULT 300,
retry_count INTEGER NOT NULL DEFAULT 0,
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
started_at TIMESTAMP WITH TIME ZONE,
completed_at TIMESTAMP WITH TIME ZONE,
updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);

-- Create indexes for efficient querying
CREATE INDEX IF NOT EXISTS idx_jobs_status ON jobs(status);
CREATE INDEX IF NOT EXISTS idx_jobs_created_at ON jobs(created_at);
CREATE INDEX IF NOT EXISTS idx_jobs_status_created_at ON jobs(status, created_at);

-- Create function to update updated_at timestamp
CREATE OR REPLACE FUNCTION update_updated_at_column()
RETURNS TRIGGER AS $$
BEGIN
NEW.updated_at = NOW();
RETURN NEW;
END;
$$ language 'plpgsql';

-- Create trigger to automatically update updated_at
DROP TRIGGER IF EXISTS update_jobs_updated_at ON jobs;
CREATE TRIGGER update_jobs_updated_at
BEFORE UPDATE ON jobs
FOR EACH ROW
EXECUTE FUNCTION update_updated_at_column();
32 changes: 32 additions & 0 deletions pending/002_create_fee_tables.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
-- Migration 002: Create fee market analysis tables
-- Stores historical ledger fee data and transaction fee records for fee prediction

CREATE TABLE IF NOT EXISTS ledger_fee_samples (
ledger_sequence BIGINT PRIMARY KEY,
collected_at TIMESTAMP NOT NULL,
base_reserve BIGINT NOT NULL,
base_fee BIGINT NOT NULL,
max_fee BIGINT NOT NULL,
fee_charged BIGINT NOT NULL,
transaction_count INTEGER NOT NULL,
ledger_close_time TIMESTAMP NOT NULL
);

CREATE TABLE IF NOT EXISTS transaction_fee_records (
id TEXT PRIMARY KEY,
ledger_sequence BIGINT NOT NULL,
tx_hash VARCHAR(64) NOT NULL,
fee_bid BIGINT NOT NULL,
fee_charged BIGINT NOT NULL,
resource_fee BIGINT NOT NULL,
inclusion_success BOOLEAN NOT NULL,
recorded_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (ledger_sequence) REFERENCES ledger_fee_samples(ledger_sequence)
);

-- Indexes for efficient time-series queries
CREATE INDEX IF NOT EXISTS idx_fee_samples_sequence ON ledger_fee_samples(ledger_sequence);
CREATE INDEX IF NOT EXISTS idx_fee_samples_close_time ON ledger_fee_samples(ledger_close_time);
CREATE INDEX IF NOT EXISTS idx_tx_records_ledger ON transaction_fee_records(ledger_sequence);
CREATE INDEX IF NOT EXISTS idx_tx_records_hash ON transaction_fee_records(tx_hash);
CREATE INDEX IF NOT EXISTS idx_tx_records_recorded_at ON transaction_fee_records(recorded_at);
Loading
Loading