Fix datatypes and drop unused duplicate index.

This commit is contained in:
Kavin 2023-08-13 23:54:42 +01:00
parent d81bb969c7
commit 8f6a954cca
No known key found for this signature in database
GPG Key ID: 6E4598CA5C92C41F
2 changed files with 11 additions and 8 deletions

View File

@ -8,9 +8,10 @@ import java.util.Set;
import java.util.UUID;
@Entity
@Table(name = "users", indexes = {@Index(columnList = "id", name = "users_id_idx"),
@Table(name = "users", indexes = {
@Index(columnList = "username", name = "username_idx"),
@Index(columnList = "session_id", name = "users_session_id_idx")})
@Index(columnList = "session_id", name = "users_session_id_idx")
})
public class User implements Serializable {
private static final long serialVersionUID = 1L;

View File

@ -1,11 +1,13 @@
CREATE TABLE IF NOT EXISTS users (
id SERIAL NOT NULL,
password STRING NULL,
session_id STRING(36) NULL,
username STRING(24) NULL UNIQUE,
CONSTRAINT users_pkey PRIMARY KEY (id ASC),
INDEX users_id_idx (id ASC),
INDEX username_idx (username ASC)
password TEXT NULL,
session_id VARCHAR(36) NULL,
username VARCHAR(24) NULL UNIQUE,
CONSTRAINT users_pkey PRIMARY KEY (id)
);
DROP INDEX IF EXISTS users_id_idx;
CREATE INDEX IF NOT EXISTS username_idx ON users (username ASC);
--rollback DROP TABLE IF EXISTS users;