@ -42,12 +42,12 @@ def verifyForum(cur, nameForum):
print ( trace )
def verifyBoard ( cur , forum , nameBoard ) :
def verifyTopic ( cur , forumId , authorId , titleTopic ) :
try :
cur . execute ( " select board_id from boards where forum_id = %(forum)s and name_board = %(nameBoard )s limit 1 " ,
{ ' forum ' : forum , ' nameBoard ' : nameBoard } )
cur . execute ( " select topic_id from topics where forum_id = %(forumId)s and author_id = %(authorId)s and title_topic = %(titleTopic )s limit 1 " ,
{ ' forumId ' : forumId , ' authorId ' : authorId , ' titleTopic ' : titleTopic } )
recset = cur . fetchall ( )
@ -62,12 +62,14 @@ def verifyBoard(cur, forum, nameBoard):
print ( trace )
def verifyTopic ( cur , forumId , authorId , titleTopic ) :
def verifyPost ( cur , topicId , userId , dateAdded ) :
try :
cur . execute ( " select topic_id from topics where forum_id = %(forumId)s and author_id = %(authorId)s and title_topic = %(titleTopic)s limit 1 " ,
{ ' forumId ' : forumId , ' authorId ' : authorId , ' titleTopic ' : titleTopic } )
cur . execute ( " select post_id from posts where topic_id = %(topicId)s and "
" user_id = %(userId)s and dateadded_post = %(dateAdded)s limit 1 " , { ' topicId ' : topicId ,
' userId ' : userId ,
' dateAdded ' : dateAdded } )
recset = cur . fetchall ( )
@ -82,14 +84,12 @@ def verifyTopic(cur, forumId, authorId, titleTopic):
print ( trace )
def verifyPost ( cur , topicId , userId , dateAdde d ) :
def verifyUser ( cur , nameUser , forumI d ) :
try :
cur . execute ( " select post_id from posts where topic_id = %(topicId)s and "
" user_id = %(userId)s and dateadded_post = %(dateAdded)s limit 1 " , { ' topicId ' : topicId ,
' userId ' : userId ,
' dateAdded ' : dateAdded } )
cur . execute ( " select user_id from users where name_user = %(nameUser)s and forum_id = %(forumId)s limit 1 " ,
{ ' nameUser ' : nameUser , ' forumId ' : forumId } )
recset = cur . fetchall ( )
@ -104,12 +104,11 @@ def verifyPost(cur, topicId, userId, dateAdded):
print ( trace )
def verifyUser ( cur , nameUser , forumId ) :
def getLastForum ( cur ) :
try :
cur . execute ( " select user_id from users where name_user = %(nameUser)s and forum_id = %(forumId)s limit 1 " ,
{ ' nameUser ' : nameUser , ' forumId ' : forumId } )
cur . execute ( " select forum_id from forums order by forum_id desc limit 1 " )
recset = cur . fetchall ( )
@ -124,11 +123,11 @@ def verifyUser(cur, nameUser, forumId):
print ( trace )
def getLastForum ( cur ) :
def getLastTopic ( cur ) :
try :
cur . execute ( " select forum_id from forums order by forum _id desc limit 1 " )
cur . execute ( " select topic_id from topics order by topic _id desc limit 1 " )
recset = cur . fetchall ( )
@ -143,11 +142,11 @@ def getLastForum(cur):
print ( trace )
def getLastBoard ( cur ) :
def getLastUser ( cur ) :
try :
cur . execute ( " select board_id from boards order by board _id desc limit 1 " )
cur . execute ( " select user_id from users order by user _id desc limit 1 " )
recset = cur . fetchall ( )
@ -161,12 +160,11 @@ def getLastBoard(cur):
trace = traceback . format_exc ( )
print ( trace )
def getLastTopic ( cur ) :
def getLastUserVersion ( cur , userId ) :
try :
cur . execute ( " select topic_id from topics order by topic_id desc limit 1 " )
cur . execute ( " select version_user from users_history where user_id = %(userId)s order by version_user desc limit 1 " , { ' userId ' : userId } )
recset = cur . fetchall ( )
@ -180,12 +178,11 @@ def getLastTopic(cur):
trace = traceback . format_exc ( )
print ( trace )
def getLastUser ( cur ) :
def getLastTopicVersion ( cur , topicId ) :
try :
cur . execute ( " select user_id from users order by user_id desc limit 1 " )
cur . execute ( " select version_topic from topics_history where topic_id = %(topicId)s order by version_topic desc limit 1 " , { ' topicId ' : topicId } )
recset = cur . fetchall ( )
@ -199,6 +196,23 @@ def getLastUser(cur):
trace = traceback . format_exc ( )
print ( trace )
def getLastPostVersion ( cur , postId ) :
try :
cur . execute ( " select version_post from posts_history where post_id = %(postId)s order by version_post desc limit 1 " , { ' postId ' : postId } )
recset = cur . fetchall ( )
if recset :
return recset [ 0 ] [ 0 ]
else :
return 0
except :
trace = traceback . format_exc ( )
print ( trace )
def getLastPost ( cur ) :
@ -259,7 +273,7 @@ def create_topic(cur, forumId, row, authorId):
row [ 6 ] if row [ 6 ] != ' -1 ' else None ,
row [ 7 ] if row [ 7 ] != ' -1 ' else None ,
row [ 8 ] ,
row [ 17 ] ]
row [ 19 ] ]
cur . execute ( sql , recset )
else :
@ -273,11 +287,13 @@ def create_topic(cur, forumId, row, authorId):
if ( str ( recset [ 0 ] [ 4 ] ) != str ( row [ 1 ] ) or str ( recset [ 0 ] [ 5 ] ) != str ( row [ 4 ] if row [ 4 ] != ' -1 ' else None ) or # there was a change in the topic information
str ( recset [ 0 ] [ 6 ] ) != str ( row [ 5 ] if row [ 5 ] != ' -1 ' else None ) ) :
sql = " Insert into topics_history (topic_id, forum_id, author_id, title_topic, board_topic, views_topic, posts_topic, " \
topicVersionId = int ( getLastTopicVersion ( cur , topicId ) + 1 )
sql = " Insert into topics_history (topic_id, version_topic, forum_id, author_id, title_topic, board_topic, views_topic, posts_topic, " \
" href_topic, dateadded_topic, dateinserted_topic, classification_topic) Values ( %s , %s , %s , %s , %s , " \
" %s , %s , %s , %s , %s , %s ) "
" %s , %s , %s , %s , %s , %s , %s )"
recset = [ topicId , forumId , authorId ,
recset = [ topicId , topicVersionId , forumId , authorId ,
recset [ 0 ] [ 3 ] ,
recset [ 0 ] [ 4 ] ,
recset [ 0 ] [ 5 ] ,
@ -308,10 +324,10 @@ def create_author(cur, row, forumId):
userId = int ( getLastUser ( cur ) + 1 )
sql = " Insert into users (user_id, forum_id, name_user, status_user, reputation_user, interest_user, " \
" signature_user, dateinserted_user) Values ( %s , %s , %s , %s , %s , %s , %s , %s ) "
" signature_user, image_user, dateinserted_user) Values ( %s , %s , %s , %s , %s , %s , %s , %s , %s ) "
recset = [ userId , forumId ,
row [ 2 ] , ' Nan ' , ' Nan ' , ' Nan ' , ' Nan ' , #telling the create_posts function to not track changes here
row [ 2 ] , ' Nan ' , ' Nan ' , ' Nan ' , ' Nan ' , ' Nan ' , #telling the create_user function to not track changes here
row [ 8 ] ]
cur . execute ( sql , recset )
@ -321,7 +337,7 @@ def create_author(cur, row, forumId):
def create_user ( cur , row , forumId , index ) :
userId = verifyUser ( cur , row [ 9 ] [ index ] , forumId )
userId = verifyUser ( cur , row [ 10 ] [ index ] , forumId )
if not userId :
userId = int ( getLastUser ( cur ) + 1 )
@ -332,14 +348,15 @@ def create_user(cur, row, forumId, index):
if newUser :
sql = " Insert into users (user_id, forum_id, name_user, status_user, reputation_user, interest_user, " \
" signature_user, dateinserted_user) Values ( %s , %s , %s , %s , %s , %s , %s , %s ) "
" signature_user, image_user, dateinserted_user) Values ( %s , %s , %s , %s , %s , %s , %s , %s , %s ) "
recset = [ userId , forumId ,
row [ 9 ] [ index ] ,
row [ 10 ] [ index ] if row [ 10 ] [ index ] != ' -1 ' else None ,
row [ 10 ] [ index ] ,
row [ 11 ] [ index ] if row [ 11 ] [ index ] != ' -1 ' else None ,
row [ 12 ] [ index ] if row [ 12 ] [ index ] != ' -1 ' else None ,
row [ 13 ] [ index ] if row [ 13 ] [ index ] != ' -1 ' else None ,
row [ 14 ] [ index ] if row [ 14 ] [ index ] != ' -1 ' else None ,
row [ 9 ] [ index ] if row [ 9 ] [ index ] != ' -1 ' else None ,
row [ 8 ] ]
cur . execute ( sql , recset )
@ -352,31 +369,38 @@ def create_user(cur, row, forumId, index):
recset = cur . fetchall ( )
if ( str ( recset [ 0 ] [ 3 ] ) != str ( row [ 10 ] [ index ] if row [ 10 ] [ index ] != ' -1 ' else None ) or str ( recset [ 0 ] [ 4 ] ) != str ( row [ 11 ] [ index ] if row [ 11 ] [ index ] != ' -1 ' else None ) or
str ( recset [ 0 ] [ 5 ] ) != str ( row [ 12 ] [ index ] if row [ 12 ] [ index ] != ' -1 ' else None ) or str ( recset [ 0 ] [ 6 ] ) != str ( row [ 13 ] [ index ] if row [ 13 ] [ index ] != ' -1 ' else None ) ) : # there was a change in the user information
# decode_decrypt_image_in_base64(recset[0][7])
if ( str ( recset [ 0 ] [ 3 ] ) != str ( row [ 11 ] [ index ] if row [ 11 ] [ index ] != ' -1 ' else None ) or str ( recset [ 0 ] [ 4 ] ) != str ( row [ 12 ] [ index ] if row [ 12 ] [ index ] != ' -1 ' else None ) or
str ( recset [ 0 ] [ 5 ] ) != str ( row [ 13 ] [ index ] if row [ 13 ] [ index ] != ' -1 ' else None ) or str ( recset [ 0 ] [ 6 ] ) != str ( row [ 14 ] [ index ] if row [ 14 ] [ index ] != ' -1 ' else None ) or
str ( recset [ 0 ] [ 7 ] ) != str ( row [ 9 ] [ index ] if row [ 9 ] [ index ] != ' -1 ' else None ) ) : # there was a change in the user information
if ( str ( recset [ 0 ] [ 3 ] ) != ' Nan ' or str ( recset [ 0 ] [ 4 ] ) != ' Nan ' or str ( recset [ 0 ] [ 5 ] ) != ' Nan ' or str ( recset [ 0 ] [ 6 ] ) != ' Nan ' ) :
if ( str ( recset [ 0 ] [ 3 ] ) != ' Nan ' or str ( recset [ 0 ] [ 4 ] ) != ' Nan ' or str ( recset [ 0 ] [ 5 ] ) != ' Nan ' or str ( recset [ 0 ] [ 6 ] ) != ' Nan ' or str ( recset [ 0 ] [ 7 ] ) != ' Nan ' ) :
sql = " Insert into users_history (user_id, forum_id, name_user, status_user, reputation_user, interest_user, " \
" signature_user, dateinserted_user) Values ( %s , %s , %s , %s , %s , %s , %s , %s ) "
userVersionId = int ( getLastUserVersion ( cur , userId ) + 1 )
recset = [ userId , forumId ,
sql = " Insert into users_history (user_id, version_user, forum_id, name_user, status_user, reputation_user, interest_user, " \
" signature_user, image_user, dateinserted_user) Values ( %s , %s , %s , %s , %s , %s , %s , %s , %s , %s ) "
recset = [ userId , userVersionId , forumId ,
recset [ 0 ] [ 2 ] ,
recset [ 0 ] [ 3 ] ,
recset [ 0 ] [ 4 ] ,
recset [ 0 ] [ 5 ] ,
recset [ 0 ] [ 6 ] ,
recset [ 0 ] [ 7 ] ]
recset [ 0 ] [ 7 ] ,
recset [ 0 ] [ 8 ] ]
cur . execute ( sql , recset )
sql = " Update users set status_user = %(status_user)s , reputation_user = %(reputation_user)s , " \
" interest_user = %(interest_user)s , signature_user = %(signature_user)s , dateinserted_user = %(dateinserted_user)s " \
" where user_id = %(userId)s "
cur . execute ( sql , { ' status_user ' : row [ 10 ] [ index ] if row [ 10 ] [ index ] != ' -1 ' else None ,
' reputation_user ' : row [ 11 ] [ index ] if row [ 11 ] [ index ] != ' -1 ' else None ,
' interest_user ' : row [ 12 ] [ index ] if row [ 12 ] [ index ] != ' -1 ' else None ,
' signature_user ' : row [ 13 ] [ index ] if row [ 13 ] [ index ] != ' -1 ' else None ,
" interest_user = %(interest_user)s , signature_user = %(signature_user)s , image_user = %(image_user)s , " \
" dateinserted_user = %(dateinserted_user)s where user_id = %(userId)s "
cur . execute ( sql , { ' status_user ' : row [ 11 ] [ index ] if row [ 11 ] [ index ] != ' -1 ' else None ,
' reputation_user ' : row [ 12 ] [ index ] if row [ 12 ] [ index ] != ' -1 ' else None ,
' interest_user ' : row [ 13 ] [ index ] if row [ 13 ] [ index ] != ' -1 ' else None ,
' signature_user ' : row [ 14 ] [ index ] if row [ 14 ] [ index ] != ' -1 ' else None ,
' image_user ' : row [ 9 ] [ index ] if row [ 9 ] [ index ] != ' -1 ' else None ,
' dateinserted_user ' : row [ 8 ] if row [ 8 ] != ' -1 ' else None ,
' userId ' : userId } )
@ -385,25 +409,26 @@ def create_user(cur, row, forumId, index):
def create_posts ( cur , row , forumId , topicId ) :
if row [ 9 ] != " -1 " :
if row [ 10 ] != " -1 " :
for i in range ( len ( row [ 9 ] ) ) :
for i in range ( len ( row [ 10 ] ) ) :
userId = create_user ( cur , row , forumId , i )
postId = verifyPost ( cur , topicId , userId , row [ 16 ] [ i ] )
postId = verifyPost ( cur , topicId , userId , row [ 17 ] [ i ] )
if not postId :
postId = int ( getLastPost ( cur ) + 1 )
sql = " Insert into posts (post_id, topic_id, user_id, content_post, feedback_post, " \
" dateadded_post, dateinserted_post) Values ( %s , %s , %s , %s , %s , %s , %s ) "
sql = " Insert into posts (post_id, topic_id, user_id, content_post, feedback_post, image_post, " \
" dateadded_post, dateinserted_post) Values ( %s , %s , %s , %s , %s , %s , %s , %s )"
recset = [ postId , topicId , userId ,
row [ 14 ] [ i ] if row [ 14 ] [ i ] != ' -1 ' else None ,
row [ 15 ] [ i ] if row [ 15 ] [ i ] != ' -1 ' else None ,
row [ 16 ] [ i ] if row [ 16 ] [ i ] != ' -1 ' else None ,
row [ 18 ] [ i ] if row [ 18 ] [ i ] != ' -1 ' else None ,
row [ 17 ] [ i ] if row [ 17 ] [ i ] != ' -1 ' else None ,
row [ 8 ] ]
cur . execute ( sql , recset )
@ -416,34 +441,38 @@ def create_posts(cur, row, forumId, topicId):
recset = cur . fetchall ( )
if ( str ( recset [ 0 ] [ 3 ] ) != str ( row [ 14 ] [ i ] ) or str ( recset [ 0 ] [ 4 ] ) != str ( row [ 15 ] [ i ] if row [ 15 ] [ i ] != ' -1 ' else None ) ) : # there was a change in the post information
if ( str ( recset [ 0 ] [ 3 ] ) != str ( row [ 15 ] [ i ] ) or str ( recset [ 0 ] [ 4 ] ) != str ( row [ 16 ] [ i ] if row [ 16 ] [ i ] != ' -1 ' else None ) or
str ( recset [ 0 ] [ 5 ] ) != str ( row [ 18 ] [ i ] if row [ 18 ] [ i ] != ' -1 ' else None ) ) : # there was a change in the post information
postVersionId = int ( getLastPostVersion ( cur , postId ) + 1 )
sql = " Insert into posts_history (post_id, topic_id, user_id, content_post, feedback_post, " \
" dateadded_post, dateinserted_post) Values ( %s , %s , %s , %s , %s , %s , %s ) "
sql = " Insert into posts_history (post_id, version_post, topic_id, user_id, content_post, feedback_post, " \
" image_post, dateadded_post, dateinserted_post) Values (%s , %s , %s , %s , %s , %s , %s , %s , %s ) "
recset = [ postId , topicId , userId ,
recset = [ postId , postVersionId , topicId , userId ,
recset [ 0 ] [ 3 ] ,
recset [ 0 ] [ 4 ] ,
recset [ 0 ] [ 5 ] ,
recset [ 0 ] [ 6 ] ]
recset [ 0 ] [ 6 ] ,
recset [ 0 ] [ 7 ] ]
cur . execute ( sql , recset )
sql = " Update posts set content_post = %(content_post)s , feedback_post = %(feedback_post)s , dateinserted_post = %(dateinserted_post)s " \
" where post_id = %(postId)s "
cur . execute ( sql , { ' content_post ' : row [ 14 ] [ i ] if row [ 14 ] [ i ] != ' -1 ' else None ,
' feedback_post ' : row [ 15 ] [ i ] if row [ 15 ] [ i ] != ' -1 ' else None ,
sql = " Update posts set content_post = %(content_post)s , feedback_post = %(feedback_post)s , " \
" image_post = %(image_post)s , dateinserted_post = %(dateinserted_post)s where post_id = %(postId)s "
cur . execute ( sql , { ' content_post ' : row [ 15 ] [ i ] if row [ 15 ] [ i ] != ' -1 ' else None ,
' feedback_post ' : row [ 16 ] [ i ] if row [ 16 ] [ i ] != ' -1 ' else None ,
' image_post ' : row [ 18 ] [ i ] if row [ 18 ] [ i ] != ' -1 ' else None ,
' dateinserted_post ' : row [ 8 ] ,
' postId ' : postId } )
def create_database ( cur , con ) :
try :
sql = " create table forums (forum_id integer NOT NULL, name_forum character varying(255) NOT NULL, url_forum " \
" character varying(255) NOT null, dateinserted_forum timestamp(6) with time zone NOT NULL, constraint " \
" forums_pk primary key (forum_id)) "
" character varying(255) NOT null, dateinserted_forum timestamp(6) with time zone NOT NULL, " \
" constraint forums_pk primary key (forum_id))"
cur . execute ( sql )
sql = " create unique index unique_forum ON forums USING btree (name_forum ASC NULLS LAST) "
@ -452,27 +481,29 @@ def create_database(cur, con):
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, " \
" interest_user character varying(5000) null, signature_user character varying(1000) null, " \
" dateinserted_user timestamp(6) with time zone NOT NULL, constraint users_pk primary key (user_id), " \
" image_user character varying(1000000) null, dateinserted_user timestamp(6) with time zone NOT NULL, " \
" constraint users_pk primary key (user_id), " \
" constraint users_forum_id_fkey foreign key (forum_id) references forums (forum_id)) "
cur . execute ( sql )
sql = " create unique index unique_user ON users USING btree (forum_id ASC NULLS LAST, name_user ASC NULLS LAST) "
cur . execute ( sql )
sql = " create table users_history(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, interest_user character varying(5000) null, signature_user character varying(1000) null, " \
" dateinserted_user timestamp(6) with time zone NOT NULL, constraint users_history_pk primary key ( " \
" user_id, dateinserted_user), constraint users_history_user_id_fkey foreign key (user_id) references " \
" users (user_id), constraint users_history_forum_id_fkey foreign key (forum_id) references forums ( " \
" forum_id)) "
sql = " create table users_history(user_id integer NOT NULL, version_user 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, interest_user character varying(5000) null, " \
" signature_user character varying(1000) null, image_user character varying(1000000) null, " \
" dateinserted_user timestamp(6) with time zone NOT NULL, " \
" constraint users_history_pk primary key (user_id, version_user), " \
" constraint users_history_user_id_fkey foreign key (user_id) references " \
" users (user_id), constraint users_history_forum_id_fkey foreign key (forum_id) references forums (forum_id)) "
cur . execute ( sql )
sql = " create table topics(topic_id integer NOT NULL, forum_id integer NOT NULL, author_id integer NOT NULL, " \
" title_topic character varying(255) NOT NULL, board_topic character varying(255) NOT NULL, views_topic integer null, " \
" posts_topic integer null, href_topic character varying(255) NOT null, dateadded_topic timestamp(6) with " \
" time zone null, dateinserted_topic timestamp(6) with time zone NOT NULL, classification_topic double " \
" precision NOT NULL, constraint topics_pk primary key (topic_id), constraint topics_author_id_fkey " \
" posts_topic integer null, href_topic character varying(255) NOT null, dateadded_topic timestamp(6) with time zone null, " \
" dateinserted_topic timestamp(6) with time zone NOT NULL, classification_topic double precision NOT NULL, " \
" constraint topics_pk primary key (topic_id), constraint topics_author_id_fkey " \
" foreign key (author_id) references users (user_id), constraint topics_forum_id_fkey foreign key ( " \
" forum_id) references forums (forum_id)) "
cur . execute ( sql )
@ -481,11 +512,12 @@ def create_database(cur, con):
" title_topic ASC NULLS LAST) "
cur . execute ( sql )
sql = " create table topics_history(topic_id integer NOT NULL, forum_id integer NOT NULL, author_id integer NOT NULL, " \
" title_topic character varying(255) NOT NULL, board_topic character varying(255) NOT NULL, views_topic integer " \
" null, posts_topic integer null, href_topic character varying(255) NOT null, dateadded_topic timestamp(6) " \
" with time zone null, dateinserted_topic timestamp(6) with time zone NOT NULL, classification_topic " \
" double precision NOT NULL, constraint topics_history_pk primary key (topic_id, dateinserted_topic), " \
sql = " create table topics_history(topic_id integer NOT NULL, version_topic integer not null, forum_id integer NOT NULL, " \
" author_id integer NOT NULL, title_topic character varying(255) NOT NULL, board_topic character varying(255) NOT NULL, " \
" views_topic integer null, posts_topic integer null, href_topic character varying(255) NOT null, " \
" dateadded_topic timestamp(6) with time zone null, dateinserted_topic timestamp(6) with time zone NOT NULL, " \
" classification_topic double precision NOT NULL, " \
" constraint topics_history_pk primary key (topic_id, version_topic), " \
" constraint topics_history_topic_id_fkey foreign key (topic_id) references topics (topic_id), " \
" constraint topics_history_author_id_fkey foreign key (author_id) references users (user_id), " \
" constraint topics_history_board_id_fkey foreign key (forum_id) references forums (forum_id)) "
@ -493,8 +525,9 @@ def create_database(cur, con):
sql = " create table posts(post_id integer NOT NULL, topic_id integer NOT NULL, " \
" user_id integer NOT NULL, content_post character varying(100000) NOT null, feedback_post integer null, " \
" dateadded_post timestamp(6) with time zone NOT NULL, dateinserted_post timestamp(6) with time zone NOT " \
" NULL, constraint posts_pk primary key (post_id), " \
" image_post character varying(1000000) null, dateadded_post timestamp(6) with time zone NOT NULL, " \
" dateinserted_post timestamp(6) with time zone NOT NULL, " \
" constraint posts_pk primary key (post_id), " \
" constraint posts_user_id_fkey foreign key (user_id) references users (user_id), constraint " \
" posts_topic_id_fkey foreign key (topic_id) references topics (topic_id)) "
cur . execute ( sql )
@ -503,10 +536,11 @@ def create_database(cur, con):
" dateadded_post ASC NULLS LAST) "
cur . execute ( sql )
sql = " create table posts_history(post_id integer NOT NULL, topic_id integer NOT NULL, " \
sql = " create table posts_history(post_id integer NOT NULL, version_post integer not null, topic_id integer NOT NULL, " \
" user_id integer NOT NULL, content_post character varying(100000) NOT null, feedback_post integer null, " \
" dateadded_post timestamp(6) with time zone NOT NULL, dateinserted_post timestamp(6) with time zone NOT " \
" NULL, constraint posts_history_pk primary key (post_id, dateinserted_post), " \
" image_post character varying(1000000) null, dateadded_post timestamp(6) with time zone NOT NULL, " \
" dateinserted_post timestamp(6) with time zone NOT NULL, " \
" constraint posts_history_pk primary key (post_id, version_post), " \
" constraint posts_history_user_id_fkey foreign key (user_id) references users (user_id), " \
" constraint posts_history_topic_id_fkey foreign key (topic_id) references topics (topic_id), " \
" constraint posts_history_post_id_fkey foreign key (post_id) references posts (post_id)) "