Skip to content

Commit

Permalink
Fix sequence in DDL
Browse files Browse the repository at this point in the history
  • Loading branch information
kifj committed Feb 10, 2024
1 parent 5995123 commit 2ee6b65
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion etc/create-postgresql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ CREATE TABLE stocks.share (
CONSTRAINT share_pkey PRIMARY KEY (id)
);

CREATE SEQUENCE stocks.share_seq INCREMENT BY 50;

CREATE UNIQUE INDEX idx_key ON stocks.share (key);
CREATE INDEX idx_name ON stocks.share (name);
CREATE SEQUENCE stocks.hibernate_sequence;
4 changes: 2 additions & 2 deletions src/main/docker/x1-postgres-stomp-test/sql/ddl.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
CREATE SCHEMA stocks;

CREATE SEQUENCE stocks.hibernate_sequence;

CREATE TABLE stocks.share (
id bigint NOT NULL,
key character varying(25) NOT NULL,
Expand All @@ -10,5 +8,7 @@ CREATE TABLE stocks.share (
CONSTRAINT share_pkey PRIMARY KEY (id)
);

CREATE SEQUENCE stocks.share_seq INCREMENT BY 50;

CREATE UNIQUE INDEX idx_key ON stocks.share (key);
CREATE INDEX idx_name ON stocks.share (name);
2 changes: 1 addition & 1 deletion src/main/java/x1/stomp/model/Share.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public Share(@NotNull @Size(min = 1, max = 25) @Pattern(regexp = "[A-Z0-9.]*",
}

@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
@GeneratedValue(strategy = GenerationType.AUTO)
@JsonIgnore
@XmlTransient
private Long id;
Expand Down

0 comments on commit 2ee6b65

Please sign in to comment.