Skip to content
Snippets Groups Projects
Commit dbb69dbc authored by inso's avatar inso
Browse files

Fix Identity Primary key

An Identity Primary Key should be based on
(Currency, Pubkey, Uid, Blockstamp)
parent 142cd2a9
No related branches found
No related tags found
No related merge requests found
...@@ -7,8 +7,8 @@ class Identity: ...@@ -7,8 +7,8 @@ class Identity:
currency = attr.ib(convert=str) currency = attr.ib(convert=str)
pubkey = attr.ib(convert=str) pubkey = attr.ib(convert=str)
uid = attr.ib(convert=str) uid = attr.ib(convert=str)
signature = attr.ib(convert=str)
blockstamp = attr.ib(convert=block_uid) blockstamp = attr.ib(convert=block_uid)
signature = attr.ib(convert=str)
timestamp = attr.ib(convert=int) timestamp = attr.ib(convert=int)
member = attr.ib(validator=attr.validators.instance_of(bool)) member = attr.ib(validator=attr.validators.instance_of(bool))
membership_buid = attr.ib(convert=block_uid) membership_buid = attr.ib(convert=block_uid)
......
...@@ -24,8 +24,8 @@ class IdentitiesRepo: ...@@ -24,8 +24,8 @@ class IdentitiesRepo:
with self._conn: with self._conn:
self.conn.execute("UPDATE identities SET " self.conn.execute("UPDATE identities SET "
"UID=?, " "UID=?, "
"SIGNATURE=?, "
"BLOCKSTAMP=?," "BLOCKSTAMP=?,"
"SIGNATURE=?, "
"TS=?," "TS=?,"
"MEMBER=?," "MEMBER=?,"
"MS_BUID=?," "MS_BUID=?,"
......
...@@ -48,13 +48,13 @@ class MetaDatabase: ...@@ -48,13 +48,13 @@ class MetaDatabase:
"CURRENCY varchar(30), " "CURRENCY varchar(30), "
"PUBKEY varchar(50)," "PUBKEY varchar(50),"
"UID varchar(255)," "UID varchar(255),"
"SIGNATURE varchar(100),"
"BLOCKSTAMP varchar(100)," "BLOCKSTAMP varchar(100),"
"SIGNATURE varchar(100),"
"TS int," "TS int,"
"MEMBER boolean," "MEMBER boolean,"
"MS_BUID varchar(100)," "MS_BUID varchar(100),"
"MS_TIMESTAMP int," "MS_TIMESTAMP int,"
"PRIMARY KEY (CURRENCY, PUBKEY)" "PRIMARY KEY (CURRENCY, PUBKEY, UID, BLOCKSTAMP)"
")" ")"
) )
......
...@@ -22,8 +22,8 @@ class TestIdentitiesRepo(unittest.TestCase): ...@@ -22,8 +22,8 @@ class TestIdentitiesRepo(unittest.TestCase):
identities_repo = IdentitiesRepo(self.con) identities_repo = IdentitiesRepo(self.con)
identities_repo.insert(Identity("testcurrency", "7Aqw6Efa9EzE7gtsc8SveLLrM7gm6NEGoywSv4FJx6pZ", identities_repo.insert(Identity("testcurrency", "7Aqw6Efa9EzE7gtsc8SveLLrM7gm6NEGoywSv4FJx6pZ",
"john", "john",
"H41/8OGV2W4CLKbE35kk5t1HJQsb3jEM0/QGLUf80CwJvGZf3HvVCcNtHPUFoUBKEDQO9mPK3KJkqOoxHpqHCw==",
"20-7518C700E78B56CC21FB1DDC6CBAB24E0FACC9A798F5ED8736EA007F38617D67", "20-7518C700E78B56CC21FB1DDC6CBAB24E0FACC9A798F5ED8736EA007F38617D67",
"H41/8OGV2W4CLKbE35kk5t1HJQsb3jEM0/QGLUf80CwJvGZf3HvVCcNtHPUFoUBKEDQO9mPK3KJkqOoxHpqHCw==",
1473108382, 1473108382,
False, False,
None, None,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment