lemmy/migrations/2024-11-18-012113_custom_migration_runner/up.sql

13 lines
273 B
MySQL
Raw Normal View History

Add custom migration runner, forbid some `diesel migration` commands, fix old migrations (#4673) * Update schema.rs * rename * stuff * finish new implementation of schema_setup::run (not including revert, test, etc.) * fmt * refactor * fix sql * migriation run command * use trigger on migrations table * add Options with disable_migrations field for test * rename to enable_forbid_diesel_cli_trigger * fix * fix merge * diff_checker (partial) * Revert "diff_checker (partial)" This reverts commit 6709882e148ceff48d6f097895af18d13fbdf4bf. * Revert "Revert "diff_checker (partial)"" This reverts commit d4bdda5d11216f4acd13b9585d2392ca8c252a73. * diff check * improve schema diff * timestamp replacement * ignore column order * remove fedi_name default * stuff * improve diff * stuff * attempt parallel pg_dump * attempt 2 * Revert "attempt 2" This reverts commit a909d2d6438d0b53382f762cf916ee92286a9965. * Revert "attempt parallel pg_dump" This reverts commit 592a12795428000ab15b572f89cbd9c6e25fb76c. * improve diff check * finish fixing migrations * stuff * use advisory lock * stuff * Update lib.rs * fmt * fmt * clippy * Update diff_check.rs * Update .woodpecker.yml * Update lib.rs * Update lib.rs * Update lib.rs * Update .woodpecker.yml * Update .woodpecker.yml * Update lib.rs * re-run ci * fmt * fmt * Update .woodpecker.yml * Update .woodpecker.yml * create separate database in ci * Update .woodpecker.yml * Update .woodpecker.yml * Update .woodpecker.yml * Update .woodpecker.yml * try to fix env var * Update diff_check.rs * Remove condition that's not needed anymore * clippy * exclude views and fast tables * revert some migration changes * fix * fmt * re-attempt checking character after skipped trigger name, and make code less confusing * fmt * fix * rerun ci * rerun ci * fix strip_prefix order * fix weird big Cargo.lock change by running `git checkout upstream/main Cargo.lock` then letting it auto update again * fix * remove installation commands that were removed in main branch * Revert "remove installation commands that were removed in main branch" This reverts commit fd65234a760b8b1bb42bc5b59b0ec972b08ded13. * move create_database_user woodpecker step to make diff less weird * fix clippy * Make diff check work just like before * Move new migrations to the end * Revert changes to old migrations * don't assume that migrations are already sorted * retry CI * fix merge * find migrations dir in debug mode using CARGO_MANIFEST_DIR variable instead of current working directory * always use embedded migrations * improve doc comments for migration subcommand * clippy fix * move cfg(test) attribute to diff_check.rs * copy `o` variable instead of calling `o` function * use chrono::TimeDelta Display implementation to show migration duration
2025-01-08 10:07:32 +00:00
DROP SCHEMA IF EXISTS r CASCADE;
CREATE TABLE previously_run_sql (
-- For compatibility with Diesel
id boolean PRIMARY KEY,
-- Too big to be used as primary key
content text NOT NULL
);
INSERT INTO previously_run_sql (id, content)
VALUES (TRUE, '');