rust_forum/migrations/20241215002127_user_contact.up.sql
2025-01-28 22:38:14 +03:00

8 lines
324 B
SQL

-- Add up migration script here
CREATE TABLE IF NOT EXISTS "user_contact"(
user_id BIGSERIAL NOT NULL REFERENCES "user"(user_id),
contact_id BIGSERIAL NOT NULL REFERENCES "contact"(contact_id),
contact_value VARCHAR(256) NOT NULL,
PRIMARY KEY (user_id, contact_id),
UNIQUE (contact_id, contact_value)
);