|
@ -484,24 +484,6 @@ def create_posts(cur, row, forumId, topicId): |
|
|
'dateinserted_post': row[8], |
|
|
'dateinserted_post': row[8], |
|
|
'postId': postId}) |
|
|
'postId': postId}) |
|
|
|
|
|
|
|
|
def create_status(cur, forumId, date, status): |
|
|
|
|
|
|
|
|
|
|
|
date = datetime.strptime(date, "%m%d%Y") |
|
|
|
|
|
|
|
|
|
|
|
# checking if status already exists |
|
|
|
|
|
sql = "select * from forums_status where forum_id = %(forum_id)s and date_inserted = %(date_inserted)s" |
|
|
|
|
|
cur.execute(sql, {'forum_id': forumId, 'date_inserted': date}) |
|
|
|
|
|
|
|
|
|
|
|
recset = cur.fetchall() |
|
|
|
|
|
if recset: |
|
|
|
|
|
sql = "Update forums_status set status = %(status)s where forum_id = %(forum_id)s and date_inserted = %(date_inserted)s" |
|
|
|
|
|
recset = {'status': status, 'forum_id': forumId, 'date_inserted': date} |
|
|
|
|
|
else: |
|
|
|
|
|
sql = "Insert into forums_status (forum_id, date_inserted, status) Values (%s, %s, %s)" |
|
|
|
|
|
recset = [forumId, date, status] |
|
|
|
|
|
|
|
|
|
|
|
cur.execute(sql, recset) |
|
|
|
|
|
|
|
|
|
|
|
def create_database(cur, con): |
|
|
def create_database(cur, con): |
|
|
|
|
|
|
|
|
try: |
|
|
try: |
|
@ -514,11 +496,6 @@ def create_database(cur, con): |
|
|
sql = "create unique index unique_forum ON forums USING btree (name_forum ASC NULLS LAST)" |
|
|
sql = "create unique index unique_forum ON forums USING btree (name_forum ASC NULLS LAST)" |
|
|
cur.execute(sql) |
|
|
cur.execute(sql) |
|
|
|
|
|
|
|
|
sql = "Create table forums_status (forum_id integer NOT NULL, date_inserted date NOT NULL, status bit(1) NOT NULL, " \ |
|
|
|
|
|
"CONSTRAINT forums_log_pkey PRIMARY KEY (forum_id, date_inserted), " \ |
|
|
|
|
|
"CONSTRAINT forums_fk FOREIGN KEY (forum_id) REFERENCES forums (forum_id))" |
|
|
|
|
|
cur.execute(sql) |
|
|
|
|
|
|
|
|
|
|
|
sql = "create table users (user_id integer NOT NULL, forum_id integer NOT NULL, name_user character varying(" \ |
|
|
sql = "create table users (user_id integer NOT NULL, forum_id integer NOT NULL, name_user character varying(" \ |
|
|
"255) NOT NULL, status_user character varying(255) null, reputation_user character varying(255) null, " \ |
|
|
"255) NOT NULL, status_user character varying(255) null, reputation_user character varying(255) null, " \ |
|
|
"interest_user character varying(5000) null, signature_user character varying(1000) null, " \ |
|
|
"interest_user character varying(5000) null, signature_user character varying(1000) null, " \ |
|
|