diff options
author | Steve McIntyre <steve.mcintyre@linaro.org> | 2018-01-31 17:28:55 +0000 |
---|---|---|
committer | Steve McIntyre <steve.mcintyre@linaro.org> | 2018-01-31 17:28:55 +0000 |
commit | d7c87682029a4e091c088f4731d9317dc7edfa61 (patch) | |
tree | f3ef66316a15b256bc3dc0a69155b16c1e2b5111 | |
parent | 8fed491ccd1cd6a93c5ec231f56bbe027da71bbb (diff) |
Store and use DATABASE_SCHEMA_VERSION in setup_db.py too
Change-Id: Ic31704960f4abbf92faf8ebb3ea3891e62a28acf
-rwxr-xr-x | db/setup_db.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/db/setup_db.py b/db/setup_db.py index 84fe622..2155776 100755 --- a/db/setup_db.py +++ b/db/setup_db.py @@ -27,6 +27,8 @@ import datetime from psycopg2 import connect +DATABASE_SCHEMA_VERSION = 1 + conn = connect(database="postgres", user="postgres", password="postgres") cur = conn.cursor() @@ -47,6 +49,6 @@ cur.execute("CREATE TABLE vlan (vlan_id SERIAL, name VARCHAR(32)," cur.execute("CREATE TABLE trunk (trunk_id SERIAL," "creation_time TIMESTAMP)") cur.execute("CREATE TABLE state (last_modified TIMESTAMP, schema_version INTEGER)") -cur.execute("INSERT INTO state (last_modified, schema_version) VALUES (%s, %s)" % (datetime.datetime.now(), "1")) +cur.execute("INSERT INTO state (last_modified, schema_version) VALUES (%s, %s)" % (datetime.datetime.now(), DATABASE_SCHEMA_VERSION)) cur.execute("COMMIT;") |