if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[cmRolePropertiesDigitalAsset]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
DROP TABLE cmRolePropertiesDigitalAsset;

CREATE TABLE cmRolePropertiesDigitalAsset (
  rolePropertiesDigitalAssetId [int] IDENTITY (1, 1) NOT NULL,
  rolePropertiesId integer NOT NULL default '0',
  digitalAssetId integer NOT NULL default '0',
  PRIMARY KEY  (rolePropertiesDigitalAssetId)
)

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[cmUserPropertiesDigitalAsset]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
DROP TABLE cmUserPropertiesDigitalAsset;

CREATE TABLE cmUserPropertiesDigitalAsset (
  userPropertiesDigitalAssetId [int] IDENTITY (1, 1) NOT NULL,
  userPropertiesId integer NOT NULL default '0',
  digitalAssetId integer NOT NULL default '0',
  PRIMARY KEY  (userPropertiesDigitalAssetId)
)

ALTER TABLE cmRepositoryLanguage ADD sortOrder integer default 0 NOT NULL;

CREATE INDEX contentTypeDefinitionId ON cmContent(contentTypeDefinitionId);