rust_forum/migrations/20241215002127_user_contact.up.sql
Ahmet Kaan GÜMÜŞ 11f101638e feat: post and comment length limit
fix: 🚑 user extraction from url
2025-01-29 17:01:56 +03:00

13 lines
519 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)
);
INSERT INTO "user_contact"(user_id, contact_id, contact_value)
VALUES (0, 0, 'builder@rust_forum.com')
ON CONFLICT(user_id, contact_id) DO UPDATE SET
"contact_value" = 'builder@rust_forum.com';