diff --git a/store/datastore/ddl/sqlite/files/013_add_column_repo_seq.sql b/store/datastore/ddl/sqlite/files/013_add_column_repo_seq.sql new file mode 100644 index 000000000..ed04c9848 --- /dev/null +++ b/store/datastore/ddl/sqlite/files/013_add_column_repo_seq.sql @@ -0,0 +1,11 @@ +-- name: alter-table-add-repo-seq + +ALTER TABLE repos ADD COLUMN repo_counter INTEGER; + +-- name: update-table-set-repo-seq + +UPDATE repos SET repo_counter = ( + SELECT max(build_number) + FROM builds + WHERE builds.build_repo_id = repos.repo_id +)