Skip to content

Commit 3259400

Browse files
committed
rename files for consistency, added seed data for authors and books
1 parent a0f836b commit 3259400

File tree

4 files changed

+72
-1
lines changed

4 files changed

+72
-1
lines changed

src/main/resources/db/changelog/01-create-books-and-author-schema.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
77
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
88

9-
<changeSet id="1" author="hhimanshu">
9+
<changeSet id="01" author="hhimanshu">
1010
<createTable tableName="books"
1111
remarks="A table to contain all books">
1212
<column name="id" type="int">
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<databaseChangeLog
4+
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
5+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6+
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
7+
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
8+
9+
<changeSet id="02" author="hhimanshu">
10+
<comment>Inserting Authors</comment>
11+
<insert tableName="authors">
12+
<column name="id" valueNumeric="1"/>
13+
<column name="name" value="author_01"/>
14+
</insert>
15+
<insert tableName="authors">
16+
<column name="id" valueNumeric="2"/>
17+
<column name="name" value="author_02"/>
18+
</insert>
19+
<insert tableName="authors">
20+
<column name="id" valueNumeric="3"/>
21+
<column name="name" value="author_03"/>
22+
</insert>
23+
<insert tableName="authors">
24+
<column name="id" valueNumeric="4"/>
25+
<column name="name" value="author_04"/>
26+
</insert>
27+
<insert tableName="authors">
28+
<column name="id" valueNumeric="5"/>
29+
<column name="name" value="author_05"/>
30+
</insert>
31+
</changeSet>
32+
</databaseChangeLog>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<databaseChangeLog
4+
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
5+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6+
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
7+
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
8+
9+
<changeSet id="03" author="hhimanshu">
10+
<comment>Inserting Books</comment>
11+
<insert tableName="books">
12+
<column name="id" valueNumeric="1"/>
13+
<column name="name" value="book_01_a_01"/>
14+
<column name="author" valueNumeric="01"/>
15+
</insert>
16+
<insert tableName="books">
17+
<column name="id" valueNumeric="2"/>
18+
<column name="name" value="book_02_a_02"/>
19+
<column name="author" valueNumeric="02"/>
20+
</insert>
21+
<insert tableName="books">
22+
<column name="id" valueNumeric="3"/>
23+
<column name="name" value="book_01_a_03"/>
24+
<column name="author" valueNumeric="03"/>
25+
</insert>
26+
<insert tableName="books">
27+
<column name="id" valueNumeric="4"/>
28+
<column name="name" value="book_01_a_04"/>
29+
<column name="author" valueNumeric="04"/>
30+
</insert>
31+
<insert tableName="books">
32+
<column name="id" valueNumeric="5"/>
33+
<column name="name" value="book_01_a_05"/>
34+
<column name="author" valueNumeric="05"/>
35+
</insert>
36+
</changeSet>
37+
</databaseChangeLog>

src/main/resources/db/liquibase-changelog.xml

+2
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@
77
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
88

99
<include file="changelog/01-create-books-and-author-schema.xml" relativeToChangelogFile="true"/>
10+
<include file="changelog/02-insert-data-authors.xml" relativeToChangelogFile="true"/>
11+
<include file="changelog/02-insert-data-books.xml" relativeToChangelogFile="true"/>
1012
</databaseChangeLog>

0 commit comments

Comments
 (0)