-- Applications
create table t_applications
(
    applicants_users_id int unsigned not null,
    offers_id           int unsigned not null,
    application_date    timestamp    null,
    primary key (applicants_users_id, offers_id)
)
    charset = utf8;

create index application_date
    on t_applications (application_date);

create index offers_id
    on t_applications (offers_id);

INSERT INTO t_applications (applicants_users_id, offers_id, application_date) VALUES (2, 1, '2022-01-04 00:00:00');
INSERT INTO t_applications (applicants_users_id, offers_id, application_date) VALUES (2, 2, '2022-01-04 00:00:00');
INSERT INTO t_applications (applicants_users_id, offers_id, application_date) VALUES (2, 3, '2022-01-04 00:00:00');
INSERT INTO t_applications (applicants_users_id, offers_id, application_date) VALUES (3, 2, '2022-01-04 00:00:00');
INSERT INTO t_applications (applicants_users_id, offers_id, application_date) VALUES (4, 3, '2022-01-04 00:00:00');


-- User
create table t_user
(
    id                          int unsigned auto_increment primary key
)
    charset = utf8;

INSERT INTO t_user (id) VALUES (1);
INSERT INTO t_user (id) VALUES (2);
INSERT INTO t_user (id) VALUES (3);
INSERT INTO t_user (id) VALUES (4);

-- Missions
create table t_missions
(
    id                       int unsigned auto_increment primary key,
    offers_id                int unsigned                                       not null,
    mission_status           tinyint(1) unsigned                                null
)
    charset = utf8;

create index idx_mission_status
    on t_missions (mission_status);

create index offers_id
    on t_missions (offers_id);

INSERT INTO t_missions (id, offers_id, mission_status) VALUES (1, 1, 2);
INSERT INTO t_missions (id, offers_id, mission_status) VALUES (2, 2, 2);
INSERT INTO t_missions (id, offers_id, mission_status) VALUES (3, 3, 2);