File tree 4 files changed +6
-6
lines changed
4 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ module.exports = class extends BaseGenerator {
41
41
this . configOptions . basePath = this . options [ 'base-path' ] ;
42
42
this . configOptions . entityName = this . options . entityName ;
43
43
this . configOptions . entityVarName = _ . camelCase ( this . options . entityName ) ;
44
- this . configOptions . tableName = _ . lowerCase ( this . options . entityName ) + 's' ;
44
+ this . configOptions . tableName = _ . snakeCase ( this . options . entityName ) + 's' ;
45
45
this . configOptions . supportDatabaseSequences =
46
46
this . configOptions . databaseType === 'h2'
47
47
|| this . configOptions . databaseType === 'postgresql' ;
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ public class <%= entityName %> {
28
28
@ GeneratedValue (strategy = GenerationType .SEQUENCE , generator = "<%= entityVarName %>_id_generator" )
29
29
@ SequenceGenerator (
30
30
name = "<%= entityVarName %>_id_generator" ,
31
- sequenceName = "<%= entityVarName %>_id_seq" ,
31
+ sequenceName = "<%= tableName %>_id_seq" ,
32
32
allocationSize = 100 )
33
33
<%_ } _%>
34
34
<%_ if (!supportDatabaseSequences ) { _%>
Original file line number Diff line number Diff line change 1
- create sequence < %= entityVarName %> _id_seq start with 1 increment by 100 ;
1
+ create sequence < %= tableName %> _id_seq start with 1 increment by 100 ;
2
2
3
3
create table < %= tableName %> (
4
- id bigint DEFAULT nextval(' <%= entityVarName %>_id_seq' ) not null ,
4
+ id bigint DEFAULT nextval(' <%= tableName %>_id_seq' ) not null ,
5
5
text varchar (1024 ) not null ,
6
6
primary key (id)
7
7
);
Original file line number Diff line number Diff line change 6
6
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd" >
7
7
<changeSet author =" sivalabs" id =" createTable-<%= tableName %>" >
8
8
<createSequence
9
- sequenceName =" <%= entityVarName %>_id_seq"
9
+ sequenceName =" <%= tableName %>_id_seq"
10
10
incrementBy =" 100"
11
11
startValue =" 1"
12
12
/>
13
13
<createTable tableName =" <%= tableName %>" >
14
- <column name =" id" type =" bigint" defaultValueSequenceNext =" <%= entityVarName %>_id_seq" >
14
+ <column name =" id" type =" bigint" defaultValueSequenceNext =" <%= tableName %>_id_seq" >
15
15
<constraints primaryKey =" true" nullable =" false" />
16
16
</column >
17
17
<column name =" text" type =" varchar(1024)" >
You can’t perform that action at this time.
0 commit comments