Commits

Juan Carlos Picado Herrera  committed 3d7293f

Updated HSQLDBENCUESTAME-342

  • Participants
  • Parent commits 4e91855

Comments (0)

Files changed (3)

File encuestame-business/src/main/resources/org/encuestame/business/sqlscripts/hsqldb/install/alter.sql

+alter table access_rate add constraint FKC2760EDB546D76C9 foreign key (comments_commentId) references comments
+alter table access_rate add constraint FKC2760EDB63976E9 foreign key (poll_poll_id) references poll
+alter table access_rate add constraint FKC2760EDBE4669675 foreign key (user_uid) references userAccount
+alter table access_rate add constraint FKC2760EDB51153812 foreign key (survey_sid) references surveys
+alter table access_rate add constraint FKC2760EDB953C854B foreign key (tweetPoll_tweet_poll_id) references tweetPoll
 alter table application add constraint FK5CA405505ECE45A2 foreign key (account_uid) references account
 alter table application_connection add constraint FK73D5D2D27E933D7 foreign key (account_uid) references userAccount
 alter table application_connection add constraint FK73D5D2D4402BE26 foreign key (application_application_id) references application
 alter table groups add constraint FKB63DD9D45ECE45A2 foreign key (account_uid) references account
 alter table groups_permission add constraint FK7F1951A45895AFF foreign key (sec_id_group) references groups
 alter table groups_permission add constraint FK7F1951A43ADB63D foreign key (sec_id_permission) references permission
-alter table hash_tags_hits add constraint FK58554DB538A08F1 foreign key (hits_user_account) references userAccount
-alter table hash_tags_hits add constraint FK58554DB519AA125 foreign key (hashTag_hash_tag_id) references hash_tags
+alter table hits add constraint FK30DF4019AA125 foreign key (hashTag_hash_tag_id) references hash_tags
+alter table hits add constraint FK30DF4063976E9 foreign key (poll_poll_id) references poll
+alter table hits add constraint FK30DF4051153812 foreign key (survey_sid) references surveys
+alter table hits add constraint FK30DF40953C854B foreign key (tweetPoll_tweet_poll_id) references tweetPoll
 alter table notification add constraint FK237A88EB2B2A6AB4 foreign key (uid) references account
-alter table poll add constraint FK3497BFF44558E9 foreign key (uid) references userAccount
 alter table poll add constraint FK3497BF89452CCA foreign key (poll_folder) references poll_folder
 alter table poll add constraint FK3497BF50FE71F5 foreign key (qid) references questions
 alter table poll add constraint FK3497BFA64FB606 foreign key (editor) references userAccount
+alter table poll add constraint FK3497BF8E4A448B foreign key (owner_id) references account
 alter table poll_folder add constraint FKC5911CEE2B2A6AB4 foreign key (uid) references account
 alter table poll_folder add constraint FKC5911CEE6EF241E9 foreign key (createdBy_uid) references userAccount
+alter table poll_hashtags add constraint FK9D199EA7DA98FFE1 foreign key (hastag_id) references hash_tags
+alter table poll_hashtags add constraint FK9D199EA7F0ED6769 foreign key (poll_id) references poll
+alter table poll_hashtags add constraint FK9D199EA761842F44 foreign key (poll_id) references surveys
 alter table poll_result add constraint FKD981C89DDDD118B5 foreign key (q_answer_id) references questions_answers
 alter table poll_result add constraint FKD981C89DF0ED6769 foreign key (poll_id) references poll
 alter table project add constraint FKED904B19514C1986 foreign key (lead_uid) references userAccount
 alter table question_relations add constraint FK217954DE893521DA foreign key (id_q_colection) references question_collection
 alter table question_relations add constraint FK217954DE8A76A0BD foreign key (question_id) references questions
 alter table questions add constraint FK95C5414D2B2A6AB4 foreign key (uid) references account
+alter table questions add constraint FK95C5414D39E97991 foreign key (section_ssid) references survey_section
 alter table questions add constraint FK95C5414D84133D82 foreign key (id_question_pattern) references questions_pattern
 alter table questions_answers add constraint FK539703837E6C7BBC foreign key (id_question_answer) references questions
 alter table questions_dependencies add constraint FK92E86ADBDDD118B5 foreign key (q_answer_id) references questions_answers
 alter table survey_group_project add constraint FKFD028D34B75F3482 foreign key (id_sid_format) references survey_group
 alter table survey_pagination add constraint FKBEC9A99F793D9E77 foreign key (sid) references surveys
 alter table survey_pagination add constraint FKBEC9A99F1359B877 foreign key (ssid) references survey_section
-alter table survey_result add constraint FK92EA04A2EB8D35C9 foreign key (survey_id) references surveys
-alter table survey_section_questions add constraint FK12354ECE11057E56 foreign key (survey_section_ssid) references survey_section
-alter table survey_section_questions add constraint FK12354ECE4E3A9DF5 foreign key (questionSection_qid) references questions
-alter table surveys add constraint FK919144592B2A6AB4 foreign key (uid) references account
+alter table survey_result add constraint FK92EA04A246BF7A1C foreign key (question_qid) references questions
+alter table survey_result add constraint FK92EA04A2496009B4 foreign key (answer_q_answer_id) references questions_answers
+alter table survey_result add constraint FK92EA04A251153812 foreign key (survey_sid) references surveys
+alter table survey_section add constraint FKFE5AD30051153812 foreign key (survey_sid) references surveys
 alter table surveys add constraint FK91914459A3C7A06A foreign key (survey_folder) references survey_folder
-alter table surveys add constraint FK91914459B1A6912C foreign key (id_sid_format) references survey_format
+alter table surveys add constraint FK9191445973FF13B foreign key (project_project_id) references project
 alter table surveys add constraint FK91914459A64FB606 foreign key (editor) references userAccount
+alter table surveys add constraint FK919144598E4A448B foreign key (owner_id) references account
 alter table tweetPoll add constraint FKA65B1D02B2A6AB4 foreign key (uid) references account
 alter table tweetPoll add constraint FKA65B1D0D9BA7E54 foreign key (tweetPollFolderId) references tweetPoll_Folder
 alter table tweetPoll add constraint FKA65B1D050FE71F5 foreign key (qid) references questions
 alter table tweetPoll_Folder add constraint FKA027A9DD2B2A6AB4 foreign key (uid) references account
 alter table tweetPoll_Folder add constraint FKA027A9DD6EF241E9 foreign key (createdBy_uid) references userAccount
 alter table tweetPoll_save_published_status add constraint FKD499A4B65239D117 foreign key (socialAccount_social_account_id) references social_account
+alter table tweetPoll_save_published_status add constraint FKD499A4B663976E9 foreign key (poll_poll_id) references poll
+alter table tweetPoll_save_published_status add constraint FKD499A4B651153812 foreign key (survey_sid) references surveys
 alter table tweetPoll_save_published_status add constraint FKD499A4B6953C854B foreign key (tweetPoll_tweet_poll_id) references tweetPoll
 alter table tweetpoll_hashtags add constraint FKF8C717D6286705D7 foreign key (tweetpoll_id) references tweetPoll
 alter table tweetpoll_hashtags add constraint FKF8C717D6DA98FFE1 foreign key (hastag_id) references hash_tags
 alter table tweetpoll_result add constraint FK8749C18CB9D39F98 foreign key (tweetpoll_switch_id) references tweetpoll_switch
 alter table tweetpoll_switch add constraint FK89F7B0A3550299A foreign key (tweet_poll_id) references tweetPoll
 alter table tweetpoll_switch add constraint FK89F7B0A3DDD118B5 foreign key (q_answer_id) references questions_answers
-create index emailIndex on userAccount (email)
-create index usernameIndex on userAccount (username)
 alter table userAccount add constraint FKA7D56BE25ECE45A2 foreign key (account_uid) references account
 alter table userAccount add constraint FKA7D56BE2B8EB1450 foreign key (groupId) references groups
 alter table userAccount_followers add constraint FK7F1957F8F44558E9 foreign key (uid) references userAccount

File encuestame-business/src/main/resources/org/encuestame/business/sqlscripts/hsqldb/install/index.sql

+create index emailIndex on userAccount (email)
+create index usernameIndex on userAccount (username)

File encuestame-business/src/main/resources/org/encuestame/business/sqlscripts/hsqldb/install/tables.sql

+create table access_rate (rateId bigint generated by default as identity (start with 1), ipAddress varchar(255) not null, rate bit, created_at date, comments_commentId bigint, poll_poll_id bigint, survey_sid bigint, tweetPoll_tweet_poll_id bigint, user_uid bigint, primary key (rateId), unique (rateId))
 create table account (uid bigint generated by default as identity (start with 1), account_created_date timestamp not null, account_enabled bit, primary key (uid), unique (uid))
 create table application (application_id bigint generated by default as identity (start with 1), api_key varchar(255), callback_url varchar(255), description varchar(255), icon_url varchar(255), name varchar(255), secret varchar(255), slug varchar(255), account_uid bigint, primary key (application_id), unique (application_id))
 create table application_connection (connection_id bigint generated by default as identity (start with 1), access_token varchar(255), api_key varchar(255), secret varchar(255), account_uid bigint, application_application_id bigint, primary key (connection_id), unique (connection_id))
 create table groups (group_id bigint generated by default as identity (start with 1), des_info varchar(255), name varchar(50), type varchar(255), id_state bigint, account_uid bigint, primary key (group_id), unique (group_id))
 create table groups_permission (sec_id_group bigint not null, sec_id_permission bigint not null, primary key (sec_id_group, sec_id_permission))
 create table hash_tags (hash_tag_id bigint generated by default as identity (start with 1), tag varchar(255), hits bigint, size bigint, hashtag_updated_date timestamp, primary key (hash_tag_id), unique (hash_tag_id))
-create table hash_tags_hits (hashtag_hits_id bigint generated by default as identity (start with 1), hits_date timestamp not null, hits_ip_address varchar(100) not null, hashTag_hash_tag_id bigint, hits_user_account bigint, primary key (hashtag_hits_id), unique (hashtag_hits_id))
+create table hits (hit_id bigint generated by default as identity (start with 1), created_at date, hits_ip_address varchar(100) not null, hashTag_hash_tag_id bigint, poll_poll_id bigint, survey_sid bigint, tweetPoll_tweet_poll_id bigint, primary key (hit_id), unique (hit_id))
 create table notification (notification_id bigint generated by default as identity (start with 1), additional_description varchar(255) not null, created timestamp not null, description varchar(255) not null, group_notification bit, readed bit not null, reference varchar(255), uid bigint not null, primary key (notification_id), unique (notification_id))
 create table permission (id_permission bigint generated by default as identity (start with 1), permission varchar(255), description varchar(255), primary key (id_permission), unique (id_permission))
-create table poll (poll_id bigint generated by default as identity (start with 1), lat float, lng float, additionalInfo varchar(255), closeAfterDate bit, close_after_quota bit, close_date timestamp, closed_quota integer, custom_final_message integer, custom_message bit, custom_start_message varchar(255), hits integer, ip_protection varchar(255), ip_restrictions bit, multiple_response integer, name varchar(255), notifications bit, numbervotes integer, optional_title varchar(255), password_protection varchar(255), password_restrictions bit, showAdditionalInfo bit, showComments integer, show_progress_bar bit, showResults bit, close_notification bit, created_at timestamp not null, end_date timestamp, poll_completed bit not null, poll_hash varchar(255) not null, publish_poll bit, poll_show_results bit, update_date timestamp, editor bigint, poll_folder bigint, uid bigint not null, qid bigint not null, primary key (poll_id), unique (poll_id), unique (poll_hash))
+create table poll (poll_id bigint generated by default as identity (start with 1), lat float, lng float, additional_info varchar(255), closeAfterDate bit, close_after_quota bit, close_date timestamp, closed_quota integer, created_at timestamp, custom_final_message integer, custom_message bit, custom_start_message varchar(255), dislike_vote bigint, end_date timestamp, favorites bit, hits bigint, ip_protection varchar(255), ip_restrictions bit, like_vote bigint, multiple_response integer, name varchar(255), notifications bit, number_votes bigint, optional_title varchar(255), password_protection varchar(255), password_restrictions bit, relevance bigint, showAdditionalInfo bit, comment_option integer, show_results bit, update_date timestamp, poll_completed bit not null, poll_hash varchar(255) not null, publish_poll bit, editor bigint, owner_id bigint, poll_folder bigint, qid bigint not null, primary key (poll_id), unique (poll_id), unique (poll_hash))
 create table poll_folder (pollFolderId bigint generated by default as identity (start with 1), created_at date, folderName varchar(255) not null, folder_status integer, createdBy_uid bigint, uid bigint not null, primary key (pollFolderId), unique (pollFolderId))
+create table poll_hashtags (poll_id bigint not null, hastag_id bigint not null, primary key (poll_id, hastag_id))
 create table poll_result (poll_resultId bigint generated by default as identity (start with 1), ip_address varchar(255) not null, votation_date timestamp not null, q_answer_id bigint not null, poll_id bigint not null, primary key (poll_resultId), unique (poll_resultId))
 create table project (project_id bigint generated by default as identity (start with 1), hide_project bit, notify_members bit, priority varchar(255), date_finish timestamp not null, date_start timestamp not null, description varchar(600), project_info longvarchar, project_name varchar(255) not null, project_status varchar(255), published bit, lead_uid bigint, users_uid bigint, primary key (project_id), unique (project_id))
 create table project_geoPoint (cat_id_project bigint not null, cat_id_loc bigint not null, primary key (cat_id_project, cat_id_loc))
 create table question_collection (id_q_colection bigint generated by default as identity (start with 1), creation_date timestamp not null, des_coleccion varchar(255) not null, uid bigint not null, primary key (id_q_colection), unique (id_q_colection))
 create table question_dependence_survey (question_dependence_survey bigint generated by default as identity (start with 1), sid bigint not null, primary key (question_dependence_survey), unique (question_dependence_survey))
 create table question_relations (question_id bigint not null, id_q_colection bigint not null, primary key (question_id, id_q_colection))
-create table questions (qid bigint generated by default as identity (start with 1), question_created_date timestamp, question_hits bigint, qid_key varchar(255), question varchar(255) not null, shared_question bit, question_slug varchar(255) not null, uid bigint not null, id_question_pattern bigint, primary key (qid), unique (qid))
+create table questions (qid bigint generated by default as identity (start with 1), question_created_date timestamp, question_hits bigint, qid_key varchar(255), question varchar(255) not null, shared_question bit, question_slug varchar(255) not null, uid bigint not null, id_question_pattern bigint, section_ssid bigint, primary key (qid), unique (qid))
 create table questions_answers (q_answer_id bigint generated by default as identity (start with 1), answer varchar(255) not null, answerType integer, color varchar(255) not null, created_date timestamp, short_url_provider integer, answer_hash varchar(255), answer_url varchar(255), id_question_answer bigint not null, primary key (q_answer_id), unique (q_answer_id))
 create table questions_dependencies (question_dependenceId bigint generated by default as identity (start with 1), descriptionDependence varchar(255) not null, questionId_from bigint not null, questionId_to bigint not null, q_answer_id bigint not null, primary key (question_dependenceId), unique (questionId_to), unique (questionId_from), unique (descriptionDependence), unique (question_dependenceId))
 create table questions_pattern (pattenr_id bigint generated by default as identity (start with 1), des_qid varchar(255), finallity_patter varchar(255), label_qid varchar(255) not null, level_patter integer, template_patron varchar(255), type_pattern varchar(255), primary key (pattenr_id), unique (pattenr_id))
 create table survey_group_format (sg_id bigint not null, id_sid_format bigint not null, primary key (id_sid_format, sg_id))
 create table survey_group_project (id_sid_format bigint not null, cat_id_project bigint not null, primary key (cat_id_project, id_sid_format))
 create table survey_pagination (pagination_id bigint generated by default as identity (start with 1), pageNumber integer, sid bigint not null, ssid bigint not null, primary key (pagination_id), unique (pagination_id))
-create table survey_result (rid bigint generated by default as identity (start with 1), resp varchar(255) not null, survey_id bigint not null, primary key (rid), unique (rid))
-create table survey_section (ssid bigint generated by default as identity (start with 1), desc_section varchar(255), primary key (ssid), unique (ssid))
-create table survey_section_questions (survey_section_ssid bigint not null, questionSection_qid bigint not null, primary key (survey_section_ssid, questionSection_qid))
-create table surveys (sid bigint generated by default as identity (start with 1), lat float, lng float, additionalInfo varchar(255), closeAfterDate bit, close_after_quota bit, close_date timestamp, closed_quota integer, custom_final_message integer, custom_message bit, custom_start_message varchar(255), hits integer, ip_protection varchar(255), ip_restrictions bit, multiple_response integer, name varchar(255), notifications bit, numbervotes integer, optional_title varchar(255), password_protection varchar(255), password_restrictions bit, showAdditionalInfo bit, showComments integer, show_progress_bar bit, showResults bit, complete varchar(2), date_interview date, end_date timestamp not null, start_date timestamp not null, ticket integer not null, editor bigint, uid bigint not null, id_sid_format bigint not null, survey_folder bigint, primary key (sid), unique (sid))
-create table tweetPoll (tweet_poll_id bigint generated by default as identity (start with 1), lat float, lng float, allow_live_results bit, allow_repeated_votes bit, captcha bit, close_notification bit, completed bit not null, create_date timestamp, limit_with_date bit, date_limited timestamp, favourite bit, hits integer, limit_votes integer, limits_votes_enabled bit, max_repeated_votes integer, numberVotes integer, publish bit, result_notification bit, resume_live_results bit, resume_tweetpoll_dashboard bit, schedule_date_tweet timestamp, schedule bit, last_date_updated timestamp, editor bigint, qid bigint not null, uid bigint not null, tweetPollFolderId bigint, primary key (tweet_poll_id), unique (tweet_poll_id))
+create table survey_result (rid bigint generated by default as identity (start with 1), answer_q_answer_id bigint, question_qid bigint, survey_sid bigint, primary key (rid), unique (rid))
+create table survey_section (ssid bigint generated by default as identity (start with 1), desc_section varchar(255), survey_sid bigint, primary key (ssid), unique (ssid))
+create table surveys (sid bigint generated by default as identity (start with 1), lat float, lng float, additional_info varchar(255), closeAfterDate bit, close_after_quota bit, close_date timestamp, closed_quota integer, created_at timestamp, custom_final_message integer, custom_message bit, custom_start_message varchar(255), dislike_vote bigint, end_date timestamp, favorites bit, hits bigint, ip_protection varchar(255), ip_restrictions bit, like_vote bigint, multiple_response integer, name varchar(255), notifications bit, number_votes bigint, optional_title varchar(255), password_protection varchar(255), password_restrictions bit, relevance bigint, showAdditionalInfo bit, comment_option integer, show_results bit, update_date timestamp, complete varchar(2), date_interview date, schedule_date_survey timestamp, is_Schedule bit, show_progress_bar bit, start_date timestamp, survey_slug_name varchar(255), ticket integer, editor bigint, owner_id bigint, project_project_id bigint, survey_folder bigint, primary key (sid), unique (sid))
+create table tweetPoll (tweet_poll_id bigint generated by default as identity (start with 1), lat float, lng float, allow_live_results bit, allow_repeated_votes bit, captcha bit, close_notification bit, completed bit not null, create_date timestamp, limit_with_date bit, date_limited timestamp, dislikeVote bigint, favourite bit, hits bigint, likeVote bigint, limit_votes integer, limits_votes_enabled bit, max_repeated_votes integer, numberVotes bigint, publish bit, relevance bigint, result_notification bit, resume_live_results bit, resume_tweetpoll_dashboard bit, schedule_date_tweet timestamp, schedule bit, last_date_updated timestamp, editor bigint, qid bigint not null, uid bigint not null, tweetPollFolderId bigint, primary key (tweet_poll_id), unique (tweet_poll_id))
 create table tweetPoll_Folder (tweetPollFolderId bigint generated by default as identity (start with 1), created_at date, folderName varchar(255) not null, folder_status integer, createdBy_uid bigint, uid bigint not null, primary key (tweetPollFolderId), unique (tweetPollFolderId))
-create table tweetPoll_save_published_status (status_save_poll_id bigint generated by default as identity (start with 1), type varchar(255), status_description varchar(255), publication_date_tweet timestamp, status integer, tweet_content varchar(255), tweet_id varchar(255), socialAccount_social_account_id bigint, tweetPoll_tweet_poll_id bigint, primary key (status_save_poll_id), unique (status_save_poll_id))
+create table tweetPoll_save_published_status (status_save_poll_id bigint generated by default as identity (start with 1), type varchar(255), status_description varchar(255), publication_date_tweet timestamp, status integer, tweet_content varchar(255), tweet_id varchar(255), poll_poll_id bigint, socialAccount_social_account_id bigint, survey_sid bigint, tweetPoll_tweet_poll_id bigint, primary key (status_save_poll_id), unique (status_save_poll_id))
 create table tweetpoll_hashtags (tweetpoll_id bigint not null, hastag_id bigint not null, primary key (hastag_id, tweetpoll_id))
 create table tweetpoll_result (tweetpoll_resultId bigint generated by default as identity (start with 1), lat float, lng float, ip_vote varchar(100) not null, tweet_date_response timestamp not null, tweetpoll_switch_id bigint not null, primary key (tweetpoll_resultId), unique (tweetpoll_resultId))
 create table tweetpoll_switch (tweetpoll_switch_id bigint generated by default as identity (start with 1), tweet_code varchar(255) not null, last_date_updated timestamp not null, short_url varchar(255), q_answer_id bigint not null, tweet_poll_id bigint not null, primary key (tweetpoll_switch_id), unique (tweet_code), unique (tweetpoll_switch_id))
 create table userAccount (uid bigint generated by default as identity (start with 1), lat float, lng float, name varchar(50), date_new timestamp, invite_code varchar(255), last_ip_logged varchar(255), last_time_logged timestamp, password varchar(255) not null, picture_source integer, shared_profile bit, email varchar(150) not null, userProfilePicture varchar(255), status bit, username varchar(30) not null, account_uid bigint, groupId bigint, primary key (uid), unique (username), unique (uid), unique (email), unique (username, email))
 create table userAccount_followers (uid bigint not null, uid_follower bigint not null, primary key (uid, uid_follower))
 create table userAccount_permission (sec_id_secondary bigint not null, sec_id_permission bigint not null, primary key (sec_id_permission, sec_id_secondary))
-create table userAccount_project (sec_id_secondary bigint not null, cat_id_project bigint not null, primary key (cat_id_project, sec_id_secondary))
+create table userAccount_project (sec_id_secondary bigint not null, cat_id_project bigint not null, primary key (cat_id_project, sec_id_secondary))