I have done a code change in a domain class(JPA). I added an ElementCollection to an entity:
@ElementCollection(targetClass = String.class)
@CollectionTable(name = "T_NETWORK_STATE", joinColumns = {@JoinColumn(name = "NETWORK_ID")})
@Column(name = "STATE")
private Set<String> states = new HashSet<>();
Now I want to write a flyway update db script for this change. I need the SQL DDL for the table T_NETWORK_STATE.
I am new to writing sql queries. any help will be appreciated!
CREATE TABLE T_NETWORK_STATE (
NETWORK_ID INT,
STATE VARCHAR(100),
UNIQUE INDEX (NETWORK_ID, STATE),
FOREIGN KEY (NETWORK_ID) REFERENCES NETWORK(NETWORK_ID)
);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.