i want match_history to be array of foregin keys to connect between a user and his matches. mySQL dont support array types so i thought to do a string looks like array but i dont know how to connect his ids with the matches with foregin keys.
CREATE TABLE users (
user_id INT NOT NULL AUTO_INCREMENT,
username varchar(255) NOT NULL UNIQUE,
encrypted_password VARCHAR(255) NOT NULL,
points INT NOT NULL DEFAULT 0,
**match_history TEXT DEFAULT '[]',**
PRIMARY KEY (user_id)
);
CREATE TABLE matches (
match_id INT NOT NULL AUTO_INCREMENT,
player1_id INT NOT NULL,
player2_id INT NOT NULL,
game_status INT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (match_id),
FOREIGN KEY (player1_id) REFERENCES users(user_id),
FOREIGN KEY (player2_id) REFERENCES users(user_id)
);