second way link tables

This commit is contained in:
uPagge 2021-03-08 16:55:54 +03:00
parent e1d2a0a210
commit 66b87d8014
No known key found for this signature in database
GPG Key ID: 964B40928E4C9088

View File

@ -27,10 +27,12 @@
<constraints nullable="false" primaryKey="true"/> <constraints nullable="false" primaryKey="true"/>
</column> </column>
<column name="name" type="varchar(64)"/> <column name="name" type="varchar(64)"/>
<column name="author_id" type="int"> <column name="author_id" type="int"/>
<constraints foreignKeyName="book_author_id_person_id" references="person(id)" deleteCascade="true"/>
</column>
</createTable> </createTable>
<addForeignKeyConstraint baseTableName="book" baseColumnNames="author_id"
constraintName="book_author_id_person_id"
referencedTableName="person" referencedColumnNames="id" onUpdate="CASCADE"/>
</changeSet> </changeSet>
</databaseChangeLog> </databaseChangeLog>