Здравствуйте, осваиваю Play Framework Из таблицы исчезают поля created_at и updated_at, когда я накатываю эволюцию. Причем проблема проявляется только на тестовой базе данных, при обычном запуске в dev mod все нормально, поля на месте.
Вот код создания таблицы:
create table if not exists cash_services (
id serial PRIMARY KEY,
percent_value numeric,
calculation_type int4 not null,
constant_value numeric,
direction int4 not null,
owner_type int4 not null,
finance_event_id int4 not null,
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT clock_timestamp(),
updated_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT clock_timestamp()
);
Вот код ксласса Cash_services:
package entities;
import entities.base.OwnerType;
import entities.base.PersistenceEntity;
import exceptions.FinanceEventException;
import io.ebean.Finder;
import modules.db_convertations.DatabaseAmount;
import play.data.validation.Constraints;
import play.data.validation.Constraints.Required;
import javax.persistence.*;
import javax.validation.Valid;
import java.math.BigInteger;
import static play.data.validation.Constraints.*;
@Validate
@Entity
@Table(name = "cash_services")
public class CashService implements PersistenceEntity, Validatable<String> {
public static final Finder<Integer, CashService> finder = new Finder<>(CashService.class);
public enum Direction {
FROM,
TO
}
public enum CalculationType {
PERCENT_PLUS,
PERCENT_MINUS
}
@Id
@SequenceGenerator(name="cash_services_id_seq",
sequenceName="cash_services_id_seq",
allocationSize=1)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "cash_services_id_seq")
private int id;
@Column(name = "percent_value")
private DatabaseAmount percentValue;
@Enumerated(EnumType.ORDINAL)
@Column(name = "calculation_type")
private CalculationType calculationType;
@Column(name = "constant_value")
private DatabaseAmount constantValue;
@Column(name = "fix_value")
private DatabaseAmount fixValue;
@Required
@Enumerated(EnumType.ORDINAL)
private Direction direction;
@Required
@Enumerated(EnumType.ORDINAL)
@Column(name = "owner_type")
private OwnerType ownerType;
@OneToOne(optional = false)
@JoinColumn(name = "finance_event_id", referencedColumnName = "id")
private FinanceEvent createdEvent;
public void setId(int id) {
this.id = id;
}
public void setPercentValue(DatabaseAmount percentValue) {
this.percentValue = percentValue;
}
public void setCalculationType(CalculationType calculationType) {
this.calculationType = calculationType;
}
public void setConstantValue(DatabaseAmount constantValue) {
this.constantValue = constantValue;
}
public void setDirection(Direction direction) {
this.direction = direction;
}
public void setOwnerType(OwnerType ownerType) {
this.ownerType = ownerType;
}
public void setCreatedEvent(FinanceEvent createdEvent) {
this.createdEvent = createdEvent;
}
public void setFixValue(DatabaseAmount fixValue) {
this.fixValue = fixValue;
}
public int getId() {
return id;
}
public DatabaseAmount getPercentValue() {
return percentValue;
}
public CalculationType getCalculationType() {
return calculationType;
}
public DatabaseAmount getConstantValue() {
return constantValue;
}
public Direction getDirection() {
return direction;
}
public OwnerType getOwnerType() {
return ownerType;
}
public FinanceEvent getCreatedEvent() {
return createdEvent;
}
public DatabaseAmount getFixValue() {
return fixValue;
}
@Override
public String validate() {
//Код валидации
return null;
}
}
Как видите в классе этих полей нет, т.к. они пока не нужны. Возможно, проблема в этом? Существует ли в Play механизм модификации таблиц по классам. Если да, то как его отключить?