-- add metadata field table changes
ALTER TABLE MetadataFields ADD COLUMN Editable INT DEFAULT 1;
ALTER TABLE MetadataFields ADD COLUMN Owner TEXT;
ALTER TABLE MetadataFields ADD COLUMN EnableOnOwnerReturn INT;
ALTER TABLE MetadataFields ADD COLUMN 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';
