Only create table if not exist

This commit is contained in:
nolash
2020-09-19 14:23:23 +02:00
parent 646dbf5f79
commit 6542fd9e2c
4 changed files with 8 additions and 4 deletions

View File

@@ -28,13 +28,13 @@ def to_bytes(x):
class ReferenceKeystore(Keystore):
schema = [
"""CREATE TABLE ethereum (
"""CREATE TABLE IF NOT EXISTS ethereum (
id SERIAL NOT NULL PRIMARY KEY,
key_ciphertext VARCHAR(256) NOT NULL,
wallet_address_hex CHAR(40) NOT NULL
);
""",
"""CREATE UNIQUE INDEX ethereum_address_idx ON ethereum ( wallet_address_hex );
"""CREATE UNIQUE INDEX IF NOT EXISTS ethereum_address_idx ON ethereum ( wallet_address_hex );
""",
]