Store and use DATABASE_SCHEMA_VERSION in setup_db.py too
Change-Id: Ic31704960f4abbf92faf8ebb3ea3891e62a28acf
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 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;")