diff --git a/api/src/main/java/org/openmrs/FieldType.java b/api/src/main/java/org/openmrs/FieldType.java index 31c4d4506dd..041f7f9aa35 100644 --- a/api/src/main/java/org/openmrs/FieldType.java +++ b/api/src/main/java/org/openmrs/FieldType.java @@ -9,20 +9,49 @@ */ package org.openmrs; +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; import org.hibernate.envers.Audited; +import javax.persistence.AttributeOverride; +import javax.persistence.AttributeOverrides; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + /** * FieldType */ +@Entity +@Table(name = "field_type") @Audited +@AttributeOverrides(value = { + @AttributeOverride(name = "name", column = @Column(name = "name", length = 50, nullable = false)), + @AttributeOverride(name = "retired", column = @Column(name = "retired", columnDefinition = "boolean default false")) +}) public class FieldType extends BaseChangeableOpenmrsMetadata { - + + /** + * The constant serialVersionUID. + */ public static final long serialVersionUID = 35467L; // Fields - + + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "field_type_id_seq") + @GenericGenerator( + name = "field_type_id_seq", + strategy = "native", + parameters = @Parameter(name = "sequence", value = "field_type_id_field_type_id_seq") + ) + @Column(name = "field_type_id", nullable = false) private Integer fieldTypeId; + @Column(name = "is_set", length = 1, nullable = false) private Boolean isSet = false; // Constructors diff --git a/api/src/main/resources/hibernate.cfg.xml b/api/src/main/resources/hibernate.cfg.xml index 2bd3c6ad8dc..9fbf5cd64d0 100644 --- a/api/src/main/resources/hibernate.cfg.xml +++ b/api/src/main/resources/hibernate.cfg.xml @@ -45,7 +45,6 @@ - diff --git a/api/src/main/resources/org/openmrs/api/db/hibernate/FieldType.hbm.xml b/api/src/main/resources/org/openmrs/api/db/hibernate/FieldType.hbm.xml deleted file mode 100644 index 9d25829eb4c..00000000000 --- a/api/src/main/resources/org/openmrs/api/db/hibernate/FieldType.hbm.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - field_type_field_type_id_seq - - - - - - - - - - - - - - - - - diff --git a/api/src/main/resources/org/openmrs/liquibase/updates/liquibase-update-to-latest-2.7.x.xml b/api/src/main/resources/org/openmrs/liquibase/updates/liquibase-update-to-latest-2.7.x.xml index 5911cc7ef82..aa654ac2cb9 100644 --- a/api/src/main/resources/org/openmrs/liquibase/updates/liquibase-update-to-latest-2.7.x.xml +++ b/api/src/main/resources/org/openmrs/liquibase/updates/liquibase-update-to-latest-2.7.x.xml @@ -169,5 +169,131 @@ referencedTableName="obs" referencedColumnNames="obs_id"/> + + + + + + + + + + + adding date change column + + + + + + + + + + + + + + + adding retired_by column + + + + + + + + + + + + + + + adding retired_by column + + + + + + + + + + + + + + + adding retire_reason column + + + + + + + + + + + + + + + adding creator column + + + + + + + + + + + + + + + + + adding date_created column + + + + + + + + + + + + + + + + + adding changed_by column + + + + + + + + + + + + + + + adding retired column + + + + + + diff --git a/api/src/test/java/org/openmrs/api/OrderServiceTest.java b/api/src/test/java/org/openmrs/api/OrderServiceTest.java index 6d553c03825..4412250d21e 100644 --- a/api/src/test/java/org/openmrs/api/OrderServiceTest.java +++ b/api/src/test/java/org/openmrs/api/OrderServiceTest.java @@ -35,6 +35,7 @@ import org.openmrs.DrugIngredient; import org.openmrs.DrugOrder; import org.openmrs.Encounter; +import org.openmrs.FieldType; import org.openmrs.FreeTextDosingInstructions; import org.openmrs.GlobalProperty; import org.openmrs.Location; @@ -2737,6 +2738,7 @@ public void saveOrder_shouldFailIfTheJavaTypeOfThePreviousOrderDoesNotMatch() th .addAnnotatedClass(DrugIngredient.class) .addAnnotatedClass(AlertRecipient.class) .addAnnotatedClass(PatientIdentifierType.class) + .addAnnotatedClass(FieldType.class) .addAnnotatedClass(ProgramAttributeType.class) .addAnnotatedClass(HL7InError.class) .addAnnotatedClass(OrderType.class) diff --git a/api/src/test/java/org/openmrs/util/DatabaseUpdaterDatabaseIT.java b/api/src/test/java/org/openmrs/util/DatabaseUpdaterDatabaseIT.java index fb7616ac9cd..db05677f228 100644 --- a/api/src/test/java/org/openmrs/util/DatabaseUpdaterDatabaseIT.java +++ b/api/src/test/java/org/openmrs/util/DatabaseUpdaterDatabaseIT.java @@ -30,7 +30,7 @@ public class DatabaseUpdaterDatabaseIT extends DatabaseIT { * This constant needs to be updated when adding new Liquibase update files to openmrs-core. */ - private static final int CHANGE_SET_COUNT_FOR_GREATER_THAN_2_1_X = 899; + private static final int CHANGE_SET_COUNT_FOR_GREATER_THAN_2_1_X = 907; private static final int CHANGE_SET_COUNT_FOR_2_1_X = 870;