forked from importers/git-importer
Split Revision into OBS and DB
This commit is contained in:
16
lib/db.py
16
lib/db.py
@@ -51,21 +51,25 @@ class DB:
|
||||
CREATE TABLE scheme (
|
||||
id SERIAL PRIMARY KEY,
|
||||
version SMALLINT NOT NULL
|
||||
)
|
||||
""",
|
||||
)
|
||||
""",
|
||||
"INSERT INTO scheme (version) VALUES(1)",
|
||||
""" DROP TABLE IF EXISTS revisions""",
|
||||
""" CREATE TABLE revisions (
|
||||
id SERIAL PRIMARY KEY,
|
||||
project VARCHAR(255) NOT NULL,
|
||||
package VARCHAR(255) NOT NULL,
|
||||
rev VARCHAR(255) NOT NULL,
|
||||
rev INTEGER NOT NULL,
|
||||
unexpanded_srcmd5 VARCHAR(255) NOT NULL,
|
||||
commit_time timestamp NOT NULL,
|
||||
userid VARCHAR(255) NOT NULL,
|
||||
comment TEXT,
|
||||
requestid INTEGER
|
||||
)
|
||||
""",
|
||||
""",
|
||||
"""
|
||||
CREATE UNIQUE INDEX ppr ON revisions (project, package, rev);
|
||||
"""
|
||||
)
|
||||
|
||||
if self.schema_version() > 0:
|
||||
@@ -84,9 +88,11 @@ class DB:
|
||||
self.close()
|
||||
raise error
|
||||
|
||||
def cursor(self):
|
||||
return self.conn.cursor()
|
||||
|
||||
def import_rev(self, revision):
|
||||
cur = self.conn.cursor()
|
||||
print(revision)
|
||||
cur.execute(
|
||||
"""INSERT INTO revisions (project, package, rev, unexpanded_srcmd5, commit_time, userid, comment, requestid)
|
||||
VALUES(%s, %s, %s, %s, %s, %s, %s, %s)""",
|
||||
|
Reference in New Issue
Block a user