问题
I have created an entity called "event" using command yo jhipster:entity event while creating I forgot add one column let's say "event_title" so, I have added this(event_tile) column manually in liquibase changelog xml. Now how to update event table with newly added column?
回答1:
You need to include the new changelog file in your src/main/resources/config/liquibase/master.xml
file.
<include file="classpath:config/liquibase/changelog/my_new_changelog.xml"
relativeToChangelogFile="false"/>
Next time you run the app, changes will be applied.
You can also update the database with the following maven task :
mvn liquibase:update
.
Here is the doc about using jhipster in development.
回答2:
I created a file on
src/main/resources/config/liquibase
Ex:
<?xml version="1.0" encoding="utf-8"?>
<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="lazaro" id="altertable-02">
<addColumn catalogName="mySchema"
schemaName="public"
tableName="myTableName">
<column name="atributeName" type="bigint"/>
</addColumn>
</changeSet>
And added on
src/main/resources/config/liquibase/master.xml
A include tag:
<include file="classpath:config/liquibase/changelog/add_column_quantity_entity_Item.xml" relativeToChangelogFile="false"/>
来源:https://stackoverflow.com/questions/30004755/how-to-update-existing-table-jhipster-sample-app