add btype data for legacy builds

This commit is contained in:
Mike McLean 2016-08-31 16:59:22 -04:00
parent 2ed308ff3e
commit dc33a0e679
2 changed files with 22 additions and 3 deletions

View file

@ -28,6 +28,22 @@ INSERT INTO btype(name) VALUES ('image');
SELECT statement_timestamp(), 'Altering archiveinfo table' as msg;
ALTER TABLE archiveinfo ADD COLUMN btype_id INTEGER REFERENCES btype(id);
-- fill in legacy types
SELECT statement_timestamp(), 'Adding legacy btypes to builds' as msg;
INSERT INTO build_types(btype_id, build_id)
SELECT btype.id, maven_builds.build_id FROM btype JOIN maven_builds ON btype.name='maven';
INSERT INTO build_types(btype_id, build_id)
SELECT btype.id, win_builds.build_id FROM btype JOIN win_builds ON btype.name='win';
INSERT INTO build_types(btype_id, build_id)
SELECT btype.id, image_builds.build_id FROM btype JOIN image_builds ON btype.name='image';
SELECT statement_timestamp(), 'Adding legacy btypes to archiveinfo' as msg;
UPDATE archiveinfo SET btype_id=(SELECT id FROM btype WHERE name='maven' LIMIT 1)
WHERE (SELECT archive_id FROM maven_archives WHERE archive_id=archiveinfo.id) IS NOT NULL;
UPDATE archiveinfo SET btype_id=(SELECT id FROM btype WHERE name='win' LIMIT 1)
WHERE (SELECT archive_id FROM win_archives WHERE archive_id=archiveinfo.id) IS NOT NULL;
UPDATE archiveinfo SET btype_id=(SELECT id FROM btype WHERE name='image' LIMIT 1)
WHERE (SELECT archive_id FROM image_archives WHERE archive_id=archiveinfo.id) IS NOT NULL;
-- new component tables
SELECT statement_timestamp(), 'Creating new component tables' as msg;

View file

@ -5546,7 +5546,8 @@ def new_maven_build(build, maven_info):
data = dslice(maven_info, ['build_id', 'group_id', 'artifact_id', 'version'])
insert = InsertProcessor('maven_builds', data=data)
insert.execute()
# note: for the moment, we are not adding build_types entries for the legacy types
# also add build_types entry
new_typed_build(build['id'], 'maven')
def new_win_build(build_info, win_info):
"""
@ -5566,7 +5567,8 @@ def new_win_build(build_info, win_info):
insert.set(build_id=build_id)
insert.set(platform=win_info['platform'])
insert.execute()
# note: for the moment, we are not adding build_types entries for the legacy types
# also add build_types entry
new_typed_build(build_info['id'], 'win')
def new_image_build(build_info):
"""
@ -5584,7 +5586,8 @@ def new_image_build(build_info):
insert = InsertProcessor('image_builds')
insert.set(build_id=build_info['id'])
insert.execute()
# note: for the moment, we are not adding build_types entries for the legacy types
# also add build_types entry
new_typed_build(build_info['id'], 'maven')
def new_typed_build(build_info, btype):