-- add metadata field table changes
ALTER TABLE MetadataFields
    ADD Editable INT DEFAULT 1,
    ADD Owner TEXT,
    ADD EnableOnOwnerReturn INT,
    ADD Label TEXT;

-- add owners to some default fields
UPDATE MetadataFields
    SET Owner = 'CWISCore'
    WHERE FieldName = 'Release Flag'
    OR FieldName = 'Cumulative Rating'
    OR FieldName = 'Added By Id'
    OR FieldName = 'Date Of Record Release'
    OR FieldName = 'Date Record Checked'
    OR FieldName = 'Date Last Modified'
    OR FieldName = 'Last Modified By Id'
    OR FieldName = 'Date Of Record Creation';

-- make some default fields uneditable
UPDATE MetadataFields
    SET Editable = 0
    WHERE FieldName = 'Cumulative Rating'
    OR FieldName = 'Added By Id'
    OR FieldName = 'Date Of Record Release'
    OR FieldName = 'Date Last Modified'
    OR FieldName = 'Last Modified By Id'
    OR FieldName = 'Date Of Record Creation';
