-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Sqlite backends for Contacts service and Wallet peer db (#1071
) Merge pull request #1071 This PR adds a Sqlite backend for the Contacts Service and the Peer database for the wallet It also update the respective integration tests to test using both the sqlite and memory db’s
- Loading branch information
Showing
20 changed files
with
619 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 3 additions & 4 deletions
7
base_layer/wallet/migrations/2019-06-26-130555_initial/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
DROP TABLE IF EXISTS sent_messages; | ||
DROP TABLE IF EXISTS received_messages; | ||
DROP TABLE IF EXISTS contacts; | ||
DROP TABLE IF EXISTS settings; | ||
-- DROP TABLE IF EXISTS sent_messages; | ||
-- DROP TABLE IF EXISTS received_messages; | ||
-- DROP TABLE IF EXISTS settings; |
48 changes: 22 additions & 26 deletions
48
base_layer/wallet/migrations/2019-06-26-130555_initial/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,25 @@ | ||
CREATE TABLE sent_messages ( | ||
id TEXT PRIMARY KEY NOT NULL, | ||
source_pub_key TEXT NOT NULL, | ||
dest_pub_key TEXT NOT NULL, | ||
message TEXT NOT NULL, | ||
timestamp DATETIME NOT NULL, | ||
acknowledged INTEGER NOT NULL DEFAULT 0, | ||
is_read INTEGER NOT NULL DEFAULT 0, | ||
FOREIGN KEY(dest_pub_key) REFERENCES contacts(pub_key) | ||
); | ||
-- CREATE TABLE sent_messages ( | ||
-- id TEXT PRIMARY KEY NOT NULL, | ||
-- source_pub_key TEXT NOT NULL, | ||
-- dest_pub_key TEXT NOT NULL, | ||
-- message TEXT NOT NULL, | ||
-- timestamp DATETIME NOT NULL, | ||
-- acknowledged INTEGER NOT NULL DEFAULT 0, | ||
-- is_read INTEGER NOT NULL DEFAULT 0, | ||
-- FOREIGN KEY(dest_pub_key) REFERENCES contacts(pub_key) | ||
-- ); | ||
|
||
CREATE TABLE received_messages ( | ||
id BLOB PRIMARY KEY NOT NULL, | ||
source_pub_key TEXT NOT NULL, | ||
dest_pub_key TEXT NOT NULL, | ||
message TEXT NOT NULL, | ||
timestamp DATETIME NOT NULL | ||
); | ||
-- CREATE TABLE received_messages ( | ||
-- id BLOB PRIMARY KEY NOT NULL, | ||
-- source_pub_key TEXT NOT NULL, | ||
-- dest_pub_key TEXT NOT NULL, | ||
-- message TEXT NOT NULL, | ||
-- timestamp DATETIME NOT NULL | ||
-- ); | ||
|
||
-- CREATE TABLE settings ( | ||
-- pub_key TEXT PRIMARY KEY NOT NULL, | ||
-- screen_name TEXT NOT NULL | ||
-- ) | ||
|
||
CREATE TABLE contacts ( | ||
pub_key TEXT PRIMARY KEY NOT NULL UNIQUE, | ||
screen_name TEXT NOT NULL, | ||
address TEXT NOT NULL | ||
); | ||
|
||
CREATE TABLE settings ( | ||
pub_key TEXT PRIMARY KEY NOT NULL, | ||
screen_name TEXT NOT NULL | ||
) |
1 change: 1 addition & 0 deletions
1
base_layer/wallet/migrations/2019-11-26-105357_contacts/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DROP TABLE IF EXISTS contacts; |
4 changes: 4 additions & 0 deletions
4
base_layer/wallet/migrations/2019-11-26-105357_contacts/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
CREATE TABLE contacts ( | ||
public_key BLOB PRIMARY KEY NOT NULL UNIQUE, | ||
alias TEXT NOT NULL | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DROP TABLE IF EXISTS peers; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
CREATE TABLE peers ( | ||
public_key BLOB PRIMARY KEY NOT NULL UNIQUE, | ||
peer TEXT NOT NULL | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,4 @@ | |
|
||
pub mod database; | ||
pub mod memory_db; | ||
pub mod sqlite_db; |
Oops, something went wrong.