32 lines
716 B
Transact-SQL
32 lines
716 B
Transact-SQL
use EnVisage
|
|
|
|
begin tran
|
|
|
|
if not exists (select 1 from sys.all_columns where name like 'IsRevenueGenerating' and object_id = OBJECT_ID('Project'))
|
|
begin
|
|
alter table project
|
|
add IsRevenueGenerating bit
|
|
CONSTRAINT revenuedefault DEFAULT (0) NOT NULL
|
|
alter table project
|
|
drop constraint revenuedefault
|
|
end
|
|
go
|
|
|
|
if exists (select 1 from sys.all_columns where name like 'IsRevenueGenerating' and object_id = OBJECT_ID('Type'))
|
|
begin
|
|
update p set p.IsRevenueGenerating = isnull (t.IsRevenueGenerating, 0)
|
|
from Project p
|
|
left join [Type] t on t.Id = p.TypeId
|
|
|
|
alter table [Type]
|
|
drop constraint DF__Type__IsRevenueG__09746778
|
|
|
|
alter table [Type]
|
|
drop column IsRevenueGenerating
|
|
end
|
|
go
|
|
|
|
|
|
commit tran
|
|
|