-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
69 changes: 69 additions & 0 deletions
69
src/main/java/ca/gc/aafc/seqdb/api/entities/QualityControl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package ca.gc.aafc.seqdb.api.entities; | ||
|
||
import java.time.OffsetDateTime; | ||
import java.util.UUID; | ||
import javax.persistence.Column; | ||
import javax.persistence.Entity; | ||
import javax.persistence.FetchType; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import javax.persistence.JoinColumn; | ||
import javax.persistence.ManyToOne; | ||
import javax.persistence.Table; | ||
import javax.validation.constraints.NotBlank; | ||
import javax.validation.constraints.NotNull; | ||
import javax.validation.constraints.Size; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
|
||
import org.hibernate.annotations.Generated; | ||
import org.hibernate.annotations.GenerationTime; | ||
import org.hibernate.annotations.NaturalId; | ||
|
||
import ca.gc.aafc.dina.entity.DinaEntity; | ||
|
||
@Getter | ||
@Entity | ||
@Builder | ||
@Setter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Table(name = "quality_control") | ||
public class QualityControl implements DinaEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Integer id; | ||
|
||
@NotNull | ||
@NaturalId | ||
private UUID uuid; | ||
|
||
@NotBlank | ||
@Column(name = "created_by", updatable = false) | ||
private String createdBy; | ||
|
||
@Column(name = "created_on", insertable = false, updatable = false) | ||
@Generated(value = GenerationTime.INSERT) | ||
private OffsetDateTime createdOn; | ||
|
||
@Column(name = "_group") | ||
private String group; | ||
|
||
@NotBlank | ||
@Size(max = 100) | ||
private String name; | ||
|
||
@NotBlank | ||
@Size(max = 50) | ||
private String qcType; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "molecular_analysis_run_item_id") | ||
private MolecularAnalysisRunItem molecularAnalysisRunItem; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/main/resources/db/changelog/migrations/57-Add_quality_control_table.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?xml version="1.1" encoding="UTF-8" standalone="no"?> | ||
<databaseChangeLog | ||
xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://local.xsd/dbchangelog-4.4.xsd" | ||
objectQuotingStrategy="QUOTE_ONLY_RESERVED_WORDS"> | ||
|
||
<changeSet id="57-Add_quality_control_table" context="schema-change" author="cgendreau"> | ||
<createTable tableName="quality_control"> | ||
<column autoIncrement="true" name="id" type="SERIAL"> | ||
<constraints primaryKey="true" primaryKeyName="pk_quality_control_id" /> | ||
</column> | ||
<column name="uuid" type="uuid"> | ||
<constraints nullable="false" unique="true" /> | ||
</column> | ||
<column name="created_by" type="VARCHAR(250)"> | ||
<constraints nullable="false"/> | ||
</column> | ||
<column name="_group" type="VARCHAR(50)"> | ||
<constraints nullable="false"/> | ||
</column> | ||
<column name="created_on" type="timestamptz" defaultValueComputed="current_timestamp"/> | ||
|
||
<column name="name" type="VARCHAR(100)"> | ||
<constraints nullable="false"/> | ||
</column> | ||
|
||
<column name="qc_type" type="VARCHAR(50)"> | ||
<constraints nullable="false"/> | ||
</column> | ||
|
||
<column name="molecular_analysis_run_item_id" type="integer"> | ||
<constraints foreignKeyName="fk_quality_control_to_molecular_analysis_run_item_id" references="molecular_analysis_run_item(id)"/> | ||
</column> | ||
|
||
</createTable> | ||
</changeSet> | ||
</databaseChangeLog> |