diff --git a/core/src/main/java/se/su/dsv/scipro/finalthesis/FinalThesis.java b/core/src/main/java/se/su/dsv/scipro/finalthesis/FinalThesis.java index c238089a33..818bfc2b0c 100644 --- a/core/src/main/java/se/su/dsv/scipro/finalthesis/FinalThesis.java +++ b/core/src/main/java/se/su/dsv/scipro/finalthesis/FinalThesis.java @@ -36,12 +36,12 @@ public class FinalThesis extends DomainObject { private Long id; @Basic - @Column(name = "english_title") - private String englishTitle; + @Column(name = "title_sv") + private String swedishTitle; @Basic - @Column(name = "swedish_title") - private String swedishTitle; + @Column(name = "title_en") + private String englishTitle; @Basic @Column(name = "status") diff --git a/core/src/main/java/se/su/dsv/scipro/report/GradingCriterion.java b/core/src/main/java/se/su/dsv/scipro/report/GradingCriterion.java index 5c7ab98ca4..10ea7059b0 100644 --- a/core/src/main/java/se/su/dsv/scipro/report/GradingCriterion.java +++ b/core/src/main/java/se/su/dsv/scipro/report/GradingCriterion.java @@ -18,9 +18,9 @@ import java.util.List; import java.util.Objects; @Entity -@DiscriminatorColumn(name = "type") -@Inheritance(strategy = InheritanceType.SINGLE_TABLE) @Table(name = "grading_criterion") +@Inheritance(strategy = InheritanceType.SINGLE_TABLE) +@DiscriminatorColumn(name = "type") public abstract class GradingCriterion extends AbstractGradingCriterion { public static final int FEEDBACK_LENGTH = 2000; diff --git a/core/src/main/resources/db/migration/V390__harmonize_table_attribute_name.sql b/core/src/main/resources/db/migration/V390__harmonize_table_attribute_name.sql index b6cbe5a000..b17571b149 100644 --- a/core/src/main/resources/db/migration/V390__harmonize_table_attribute_name.sql +++ b/core/src/main/resources/db/migration/V390__harmonize_table_attribute_name.sql @@ -1535,7 +1535,7 @@ alter table `idea_keyword` -- table: keyword -alter table `keyword` drop key `deleted_index`; +alter table `Keyword` drop key `deleted_index`; rename table `Keyword` to `keyword`; @@ -1635,6 +1635,8 @@ alter table `idea` drop key `FK6E051897C1813915`; alter table `idea` drop key `FK6E051897B9431B73`; alter table `idea` drop key `FK6E051897E44F4DBE`; +alter table `idea` drop key `UK_only_one_idea_per_project`; + alter table `idea` change `published` `published` bit(1) not null default b'1' after `type`; alter table `idea` change `cachedStatus` `cached_status` varchar(255) default null after `published`; alter table `idea` change `inactive` `inactive` tinyint(1) not null default 0 after `cached_status`; @@ -2321,11 +2323,6 @@ alter table `GradingCriterion` change `gradingReport_id` `grading_report_id` big rename table `GradingCriterion` to `grading_criterion`; -alter table `grading_criterion` - add constraint fk_grading_criterion_grading_report_id - foreign key (grading_report_id) references grading_report (id) - on delete cascade on update cascade; - -- add foreign key reference from grading_criterion_point to grading_criterion alter table `grading_criterion_point` @@ -2690,9 +2687,9 @@ alter table FinalThesis drop key `FK_final_thesis_project`; rename table FinalThesis to `final_thesis`; -alter table `final_thesis` change `englishTitle` `english_title` varchar(255) default null after `version`; -alter table `final_thesis` change `swedishTitle` `swedish_title` varchar(255) default null after `english_title`; -alter table `final_thesis` change `status` `status` varchar(32) not null after `swedish_title`; +alter table `final_thesis` change `swedishTitle` `title_sv` longtext default null after `version`; +alter table `final_thesis` change `englishTitle` `title_en` longtext default null after `title_sv`; +alter table `final_thesis` change `status` `status` varchar(32) not null after `title_en`; alter table `final_thesis` change `dateApproved` `date_approved` date default null after `status`; alter table `final_thesis` change `dateRejected` `date_rejected` date default null after `date_approved`; alter table `final_thesis` change `rejection_comment` `rejection_comment` text default null after `date_rejected`; @@ -3230,47 +3227,3 @@ alter table `forum_notification` add constraint fk_forum_notification_notification_data_id foreign key (notification_data_id) references notification_data (id) on delete cascade on update cascade; - --- todo: NotificationEvent, JPA-mapping - -/* Useful SQL - ->>> SQL query for FK-to: - -select table_name, column_name, referenced_table_name, referenced_column_name - from information_schema.key_column_usage - where table_schema = 'tozh4728' and referenced_table_name = 'ProjectType'; - ->>> SQL query for FK-to count: - - select referenced_table_name, count(*) as c - from information_schema.key_column_usage - where table_schema = 'tozh4728' and referenced_table_name is not null - group by referenced_table_name order by c desc; - ->>> SQL Query for FK-from - - select table_name, column_name, referenced_table_name, referenced_column_name - from information_schema.key_column_usage - where referenced_table_name is not null and table_name = 'user' -order by table_name; - ->>> Show foreign keys - - -- show foreign keys for a simple table - select table_name, column_name, constraint_name, referenced_table_name, referenced_column_name - from information_schema.key_column_usage - where table_schema = 'tozh4728' and - table_name = 'grade' and - constraint_name != 'PRIMARY'; - - -- show foreign keys for all tables - select table_name, column_name, constraint_name, referenced_table_name, referenced_column_name - from information_schema.key_column_usage - where table_schema = 'tozh4728' and - constraint_name != 'PRIMARY' - order by table_name collate utf8_nopad_bin, constraint_name collate utf8_nopad_bin; - ->>> Show collation; - -*/ \ No newline at end of file