我想使用 liquibase 在数据库中创建表,但他没有出现,我收到关于缺少表的错误。有人能告诉我我做错了什么吗?
在 application.yml 我有 spring.jpa.hibernate.ddl-auto=validate
创建活动表.xml:
<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 http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">
<changeSet author="Damian Malicki" id="create-activities-table.xml">
<createTable tableName="activity">
<column name="id" type="varchar(255)">
<constraints primaryKey="true" nullable="false" />
</column>
<column name="description" type="varchar(255)">
<constraints nullable="false" />
</column>
<column name="created_by_id" type="varchar(255)">
<constraints nullable="false" />
</column>
<column name="type" type="varchar(255)">
<constraints nullable="false" />
</column>
<column name="created_on" type="datetime">
<constraints nullable="false" />
</column>
</createTable>
</changeSet>
</databaseChangeLog>
数据库变更日志:
databaseChangeLog:
- include:
file: classpath:db/changelog/activities/create-activities-table.xml
活动实体:
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "activity")
public class ActivityEntity {
@Id
@Column(name = "id")
private String id;
@Column(name = "description")
private String description;
@Column(name = "created_by_id")
private String createdById;
@Column(name = "type")
private ActivityType type;
@Column(name = "created_on")
private LocalDateTime createdOn;
// @OneToMany(mappedBy = "activitiesId")
// private List<ActivityParamEntity> activityParamEntityList;
}
我已经尝试重写代码,重写它并没有任何改变。
当我尝试 liquibase 更新时出现:
liquibase : The term 'liquibase' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, veri
fy that the path is correct and try again.
At line:1 char:1
+ liquibase update
+ ~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (liquibase:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException