ripple/ripple-rest — pull request #159 by wltsmrz (2014-09-28 21:49:27+00:00)
Title: New db

**Leave this request open**

Previously we had two tables;`outgoing_transactions` and `cilent_resource_id_records`.

+ `outgoing_transactions` is meant to be temporary. It's recreated on startup. It contains transaction entries that are updated whenever their states change (multiple times per submission).

+ `client_resouce_id_records` is meant to be persistent. It's not created on startup. It contains some essential transaction data for only transactions that are validated & finalized.

Entries are "moved" from `outgoing_transactions` to `client_resource_id_records` by querying the entire `outgoing_transactions` table for validated and finalized transactions. Transactions in the `outgoing_transactions` table that are not validated (any tels, tefs) will persist in the `outgoing_transactions` table until restart. This is [by design](https://github.com/ripple/ripple-rest/blob/develop/api/transactions.js#L374-L414). I think we should consider storing all finalized transactions & searching through the permanent table.

I'm not a fan of these table names. We should probably rename them `transaction_cache` and `transaction_final`.