@@ -14,4 +14,54 @@ CREATE TABLE IF NOT EXISTS member
1414 UNIQUE KEY uk_social_user (social_type, social_id),
1515 INDEX idx_email (email),
1616 INDEX idx_deleted_at (deleted_at)
17+ );
18+
19+ CREATE TABLE IF NOT EXISTS gathering
20+ (
21+ id BIGINT AUTO_INCREMENT PRIMARY KEY ,
22+ gathering_name VARCHAR (255 ) NOT NULL ,
23+ member_id BIGINT NOT NULL ,
24+ first_gathering_date DATE NOT NULL ,
25+ last_gathering_date DATE NOT NULL ,
26+ interval_days BIGINT NOT NULL ,
27+ tags JSON NULL ,
28+ created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
29+ updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
30+ deleted_at TIMESTAMP NULL ,
31+
32+ INDEX idx_deleted_at (deleted_at),
33+
34+ CONSTRAINT fk_gathering_member FOREIGN KEY (member_id) REFERENCES member(id)
35+ );
36+
37+ CREATE TABLE IF NOT EXISTS gathering_member
38+ (
39+ id BIGINT AUTO_INCREMENT PRIMARY KEY ,
40+ gathering_id BIGINT NOT NULL ,
41+ member_id BIGINT NOT NULL ,
42+ is_host BIT NOT NULL ,
43+ created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
44+ updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
45+ deleted_at TIMESTAMP NULL ,
46+
47+ CONSTRAINT fk_gathering_member_gathering_id FOREIGN KEY (gathering_id) REFERENCES gathering(id),
48+ CONSTRAINT fk_gathering_member_member_id FOREIGN KEY (member_id) REFERENCES member(id),
49+ INDEX idx_gathering_member (gathering_id, member_id),
50+ INDEX idx_deleted_at (deleted_at)
51+ );
52+
53+ CREATE TABLE IF NOT EXISTS invitation
54+ (
55+ id BIGINT AUTO_INCREMENT PRIMARY KEY ,
56+ gathering_id BIGINT NOT NULL ,
57+ member_id BIGINT NOT NULL ,
58+ purpose VARCHAR (255 ) NOT NULL ,
59+ created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
60+ updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
61+ deleted_at TIMESTAMP NULL ,
62+
63+ CONSTRAINT fk_invitation_gathering_id FOREIGN KEY (gathering_id) REFERENCES gathering(id),
64+ CONSTRAINT fk_invitation_member_id FOREIGN KEY (member_id) REFERENCES member(id),
65+ INDEX idx_gathering_member (gathering_id, member_id),
66+ INDEX idx_deleted_at (deleted_at)
1767);
0 commit comments