Added SQL statements for the new tables containing Program related data.
Updated entity mappings with explicit columns/table names.
This commit is contained in:
parent
f92f61dba8
commit
37acd38340
core/src/main/java/se/su/dsv/scipro/data/dataobjects
resources/db_update_scripts
@ -3,25 +3,24 @@ package se.su.dsv.scipro.data.dataobjects;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@Table(name = "Program")
|
||||
public class Program extends DomainObject {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@Column(name = "id")
|
||||
private Long id;
|
||||
|
||||
@Basic
|
||||
@Column(name = "externalId")
|
||||
private Long externalId;
|
||||
|
||||
@Basic(optional = false)
|
||||
@Column(name = "name")
|
||||
@NotNull
|
||||
private String name;
|
||||
|
||||
|
@ -29,6 +29,9 @@ public class Student extends Role {
|
||||
private Set<ApplicationPeriodExemption> applicationPeriodExemptions = new HashSet<ApplicationPeriodExemption>();
|
||||
|
||||
@ManyToMany
|
||||
@JoinTable(name = "role_Program",
|
||||
joinColumns = @JoinColumn(name = "role_id"),
|
||||
inverseJoinColumns = @JoinColumn(name = "programs_id"))
|
||||
private Set<Program> programs = new HashSet<Program>();
|
||||
|
||||
@Override
|
||||
|
@ -69,3 +69,23 @@ DROP TABLE string_resource;
|
||||
DROP TABLE weights;
|
||||
|
||||
ALTER TABLE `comment` CHANGE `id` `id` BIGINT(20) NOT NULL AUTO_INCREMENT;
|
||||
|
||||
CREATE TABLE `Program` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`dateCreated` datetime NOT NULL,
|
||||
`lastModified` datetime NOT NULL,
|
||||
`version` int(11) NOT NULL,
|
||||
`externalId` bigint(20) DEFAULT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
CREATE TABLE `role_Program` (
|
||||
`role_id` bigint(20) NOT NULL,
|
||||
`programs_id` bigint(20) NOT NULL,
|
||||
PRIMARY KEY (`role_id`,`programs_id`),
|
||||
KEY `FK_i1i38rcos28p2hu4xgel3ftcw` (`programs_id`),
|
||||
KEY `FK_90cvbm5wx89wvlqnkq3vusner` (`role_id`),
|
||||
CONSTRAINT `FK_90cvbm5wx89wvlqnkq3vusner` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`),
|
||||
CONSTRAINT `FK_i1i38rcos28p2hu4xgel3ftcw` FOREIGN KEY (`programs_id`) REFERENCES `Program` (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user