Cinevoraces / cinevoraces

3 stars 1 forks source link

Migration handler #180

Closed BenoitSafari closed 7 months ago

BenoitSafari commented 7 months ago

Database source of truth is now handled by the API. Whenever the Rest API start, migrations are checked, if they does not already exists in DB they are executed.

⚠️ Before updating production, the following query must be set:

CREATE TABLE IF NOT EXISTS migration (name TEXT PRIMARY KEY);

INSERT INTO migration(name) VALUES
    ('2024-10-02-V01_init_database'),
    ('2024-11-02-V02_new_movie_function'),
    ('2024-11-02-V03_new_season_function'),
    ('2024-11-02-V04_fill_updated_at_function'),
    ('2024-11-02-V05_create_indexes'),
    ('2024-11-02-V06_metricsView'),
    ('2024-11-02-V07_userView'),
    ('2024-11-02-V08_reviewView'),
    ('2024-11-02-V09_movieView'),
    ('2024-11-02-V10_seasonView'),
    ('2024-11-02-V11_documentUpdate'),
    ('2024-11-02-V12_generate_unique_username_function')
;

Related to https://github.com/Cinevoraces/cinevoraces/issues/169