MCPcopy Create free account
hub / github.com/internetarchive/openlibrary / get_database_version

Method get_database_version

scripts/migrate_db.py:90–102  ·  view source on GitHub ↗
(self, db)

Source from the content-addressed store, hash-verified

88 db.query(q)
89
90 def get_database_version(self, db):
91 schema = self.read_schema(db)
92
93 if "seq" not in schema:
94 return 10
95 elif "data" not in schema["transaction"]:
96 return 11
97 elif "changes" not in schema["transaction"]:
98 return 12
99 elif "transaction_index" not in schema:
100 return 13
101 else:
102 return LATEST_VERSION
103
104 def read_schema(self, db):
105 rows = db.query("SELECT table_name, column_name, data_type FROM information_schema.columns WHERE table_schema = 'public'")

Callers 1

upgradeMethod · 0.95

Calls 1

read_schemaMethod · 0.95

Tested by

no test coverage detected