Fix integrity error, add unique index and remove aoid from PK

This commit is contained in:
Jack Stdin 2016-01-13 00:22:13 +03:00
parent 3db2e6a75c
commit 3aeb00d82a
3 changed files with 4 additions and 3 deletions

View File

@ -27,7 +27,7 @@ class DbHandler:
self.db.transaction_commit() self.db.transaction_commit()
except: except:
self.db.transaction_rollback() self.db.transaction_rollback()
logging.error("Error updating sql. Reason : {}".format(format_exc())) raise BaseException("Error updating sql. Reason : {}".format(format_exc()))
logging.warning("Inserted {} queries FROM {}".format(chunk_size, csv_file_name)) logging.warning("Inserted {} queries FROM {}".format(chunk_size, csv_file_name))

View File

@ -9,7 +9,8 @@ CREATE TABLE "public"."ADDROBJ" (
"parentguid" UUID, "parentguid" UUID,
"actstatus" BIT(1), "actstatus" BIT(1),
"currstatus" INT2, "currstatus" INT2,
PRIMARY KEY ("id", "aoid") CONSTRAINT "aoid" UNIQUE ("aoid"),
CONSTRAINT "id" PRIMARY KEY ("id")
) )
WITH (OIDS =FALSE WITH (OIDS =FALSE
); );

View File

@ -26,7 +26,7 @@ def main():
help="Create/update DB from source. Value: \"http\" or absolute path to folder") help="Create/update DB from source. Value: \"http\" or absolute path to folder")
options, arguments = p.parse_args() options, arguments = p.parse_args()
if options.database and options.source: if options.database:
# create new database # create new database
if options.database == "create": if options.database == "create":
create_base(options.source) create_base(options.source)