Revisions
-
David Liu revised this gist
Jan 15, 2020 . No changes.There are no files selected for viewing
-
David Liu revised this gist
Jan 15, 2020 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,7 @@ -- Thank @sbengo to figure out foreign_keys constraints is defaults to false in sqlite -- Enable to delete logs by cascading delete PRAGMA foreign_keys = ON; WITH n_build_ids_per_repo as ( SELECT build_id FROM ( -
David Liu revised this gist
Sep 17, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,4 +12,4 @@ WITH n_build_ids_per_repo as ( DELETE FROM builds WHERE builds.build_id NOT IN (SELECT build_id FROM n_build_ids_per_repo); -
David Liu revised this gist
Aug 27, 2019 . No changes.There are no files selected for viewing
-
David Liu created this gist
Aug 27, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ WITH n_build_ids_per_repo as ( SELECT build_id FROM ( SELECT build_id, build_repo_id, DENSE_RANK() OVER (PARTITION BY build_repo_id ORDER BY build_id DESC) AS rank FROM builds ) AS t WHERE t.rank <= 1000 ) DELETE FROM builds WHERE builds.build_id NOT IN (SELECT build_id FROM n_build_ids_per_repo)