CREATE TABLE messages (
id integer GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
from_user_id uuid NOT NULL REFERENCES users(user_id) ON DELETE CASCADE,
message text NOT NULL,
room_id integer NOT NULL REFERENCES rooms(id) ON DELETE CASCADE,
create_time timestamp with time zone NOT NULL DEFAULT now(),
message_id uuid NOT NULL UNIQUE
);
CREATE TABLE messages (
id integer GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
from_user_id uuid NOT NULL REFERENCES users(user_id) ON DELETE CASCADE,
message text NOT NULL,
room_id integer NOT NULL REFERENCES rooms(id) ON DELETE CASCADE,
create_time timestamp with time zone NOT NULL DEFAULT now(),
message_id uuid NOT NULL UNIQUE
);