Skip to content

Commit 968ca79

Browse files
using OOTB location of liquibase (#50)
* using OOTB location of liquibase * revert loc in sync with saperation of concerns * fixes issue with npm tests
1 parent 6f17db0 commit 968ca79

File tree

9 files changed

+14
-25
lines changed

9 files changed

+14
-25
lines changed

generators/controller/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ module.exports = class extends BaseGenerator {
119119
"01-new_table_with_seq.xml" : "01-new_table_no_seq.xml";
120120
this.fs.copyTpl(
121121
this.templatePath('app/src/main/resources/db/migration/liquibase/changelog/'+scriptTemplate),
122-
this.destinationPath('src/main/resources/db/migration/changelog/0'+counter+'-create_'+configOptions.tableName+'_table.xml'),
122+
this.destinationPath('src/main/resources/db/changelog/migration/0'+counter+'-create_'+configOptions.tableName+'_table.xml'),
123123
configOptions
124124
);
125125
const liquibaseMigrantCounter = {

generators/controller/templates/app/src/main/resources/db/migration/liquibase/changelog/01-new_table_no_seq.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
44
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
55
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
6-
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
7-
<changeSet author="sivalabs" id="createTable-<%= tableName %>">
6+
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.2.xsd">
7+
<changeSet author="app" id="createTable-<%= tableName %>">
88

99
<createTable tableName="<%= tableName %>">
1010
<column name="id" type="bigint" autoIncrement="true">

generators/controller/templates/app/src/main/resources/db/migration/liquibase/changelog/01-new_table_with_seq.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
44
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
55
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
6-
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
7-
<changeSet author="sivalabs" id="createTable-<%= tableName %>">
6+
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.2.xsd">
7+
<changeSet author="app" id="createTable-<%= tableName %>">
88
<createSequence
99
sequenceName="<%= tableName %>_id_seq"
1010
incrementBy="100"

generators/server/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@ module.exports = class extends BaseGenerator {
244244

245245
if(configOptions.dbMigrationTool === 'liquibase') {
246246
const resTemplates = [
247-
{src: 'db/migration/liquibase/liquibase-changelog.xml', dest: 'db/migration/liquibase-changelog.xml'},
248-
{src: 'db/migration/liquibase/changelog/01-init.xml', dest: 'db/migration/changelog/01-init.xml'},
247+
{src: 'db/migration/liquibase/changelog/db.changelog-master.yaml', dest: 'db/changelog/db.changelog-master.yaml'},
248+
{src: 'db/migration/liquibase/changelog/01-init.xml', dest: 'db/changelog/migration/01-init.xml'},
249249

250250
];
251251
this.generateFiles(configOptions, resTemplates, 'app/','src/main/resources/');

generators/server/templates/app/src/main/resources/application.properties

-4
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@ spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
4242
<%_ if (dbMigrationTool === 'flywaydb') { _%>
4343
spring.flyway.locations=classpath:/db/migration/{vendor}
4444
<%_ } _%>
45-
<%_ if (dbMigrationTool === 'liquibase') { _%>
46-
spring.liquibase.change-log=classpath:/db/migration/liquibase-changelog.xml
47-
<%_ } _%>
48-
4945
<%_ if (features.includes('elk')) { _%>
5046
application.logstash-host=localhost
5147
<%_ } _%>

generators/server/templates/app/src/main/resources/db/migration/liquibase/changelog/01-init.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
44
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
55
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
6-
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
6+
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.2.xsd">
77

88
</databaseChangeLog>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
databaseChangeLog:
2+
- includeAll:
3+
path: migration/
4+
errorIfMissingOrEmpty: true
5+
relativeToChangelogFile: true

generators/server/templates/app/src/main/resources/db/migration/liquibase/liquibase-changelog.xml

-12
This file was deleted.

test/controller.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ describe('SpringBoot Generator', () => {
4444
assert.file('src/main/java/com/mycompany/myservice/repositories/CustomerRepository.java');
4545
assert.file('src/main/java/com/mycompany/myservice/services/CustomerService.java');
4646
assert.file('src/main/java/com/mycompany/myservice/web/controllers/CustomerController.java');
47-
assert.file('src/main/resources/db/migration/changelog/02-create_customers_table.xml');
47+
assert.file('src/main/resources/db/changelog/migration/02-create_customers_table.xml');
4848
});
4949
});
5050
});

0 commit comments

Comments
 (0)