Skip to content

Commit 08c08b3

Browse files
committed
modified database deployment scripts to work with SQL Azure.
Also, updated FullTextSearchEntriesQuery to work with SQL Azure.
1 parent 409ddcb commit 08c08b3

File tree

7 files changed

+34
-16
lines changed

7 files changed

+34
-16
lines changed

src/FunnelWeb/DatabaseDeployer/Scripts/Script0001.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
create table $schema$.[SchemaVersions] (
2-
[SchemaVersionID] int identity(1,1) not null constraint [PK_SchemaVersions_SchemaVersionID] primary key nonclustered,
2+
[SchemaVersionID] int identity(1,1) not null constraint [PK_SchemaVersions_SchemaVersionID] primary key,
33
[VersionNumber] int not null,
44
[SourceIdentifier] nvarchar(255) not null,
55
[ScriptName] nvarchar(255) not null,

src/FunnelWeb/DatabaseDeployer/Scripts/Script0008.sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
declare @hasFullText bit
2-
select @hasFullText = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled')
1+
declare @hasFullText int
2+
select @hasFullText = convert(int, SERVERPROPERTY('IsFullTextInstalled'))
3+
34
if (@hasFullText = 1)
45
begin
56
begin try

src/FunnelWeb/DatabaseDeployer/Scripts/Script0010.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
declare @hasFullText bit
22
declare @hasFullTextIndex bit
3-
select @hasFullText = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled')
3+
select @hasFullText = convert(int, SERVERPROPERTY('IsFullTextInstalled'))
44
SELECT @hasFullTextIndex = OBJECTPROPERTY(OBJECT_ID('$schema$.[Entry]'), 'TableHasActiveFulltextIndex')
55
if (@hasFullText = 1 AND @hasFullTextIndex = 1)
66
begin

src/FunnelWeb/DatabaseDeployer/Scripts/Script0016.sql

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,17 @@ declare @str nvarchar(200)
8585
set @str = 'alter table $schema$.[Entry] drop constraint ' + @defaultConstraintName
8686
exec (@str)
8787

88-
if (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
88+
if (1 = convert(int, SERVERPROPERTY('IsFullTextInstalled')))
8989
begin
9090
begin try
91-
alter fulltext index on $schema$.[Entry] disable
92-
alter fulltext index on $schema$.[Entry] drop ([MetaKeywords])
93-
alter fulltext index on $schema$.[Entry] enable
91+
set @str = 'alter fulltext index on $schema$.[Entry] disable'
92+
exec (@str)
93+
94+
set @str = 'alter fulltext index on $schema$.[Entry] drop ([MetaKeywords])'
95+
exec (@str)
96+
97+
set @str = 'alter fulltext index on $schema$.[Entry] enable'
98+
exec (@str)
9499
end try
95100
begin catch
96101
--Full text not installed

src/FunnelWeb/DatabaseDeployer/Scripts/Script0022.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
declare @hasFullText bit
22
declare @hasFullTextIndex bit
3-
select @hasFullText = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled')
3+
select @hasFullText = convert(int, SERVERPROPERTY('IsFullTextInstalled'))
44
select @hasFullTextIndex = OBJECTPROPERTY(OBJECT_ID('$schema$.[Entry]'), 'TableHasActiveFulltextIndex')
55

66
if (@hasFullText = 1 AND @hasFullTextIndex = 1)

src/FunnelWeb/DatabaseDeployer/Scripts/Script0023.sql

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,21 +109,33 @@ alter table $schema$.[Comment ]
109109
on delete no action
110110
go
111111

112-
alter table $schema$.[Comment] set (lock_escalation = table)
113-
go
112+
declare @engineEdition int
113+
select @engineEdition = convert(int, SERVERPROPERTY('EngineEdition'))
114+
115+
declare @str nvarchar(200)
116+
117+
if @engineEdition <> 5
118+
begin
119+
set @str = 'alter table $schema$.[Comment] set (lock_escalation = table)'
120+
exec(@str)
121+
end
114122

115123
alter table $schema$.[Revision]
116124
add constraint [FK_Revision_Entry] foreign key ([EntryId])
117125
references $schema$.[Entry] ([Id])
118126
on update no action
119127
on delete no action
120-
go
121128

122-
alter table $schema$.[Revision] set (lock_escalation = table)
123-
go
129+
130+
if @engineEdition <> 5
131+
begin
132+
set @str = 'alter table $schema$.[Revision] set (lock_escalation = table)'
133+
exec (@str)
134+
end
135+
124136

125137
declare @hasFullText bit
126-
select @hasFullText = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled')
138+
select @hasFullText = convert(int, SERVERPROPERTY('IsFullTextInstalled'))
127139
if (@hasFullText = 1)
128140
begin
129141
begin try

src/FunnelWeb/Repositories/Queries/FullTextSearchEntriesQuery.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public PagedResult<EntryRevision> Execute(ISession session, IDatabaseProvider da
3737
var entityPersister = session.SessionFactory.GetClassMetadata(typeof(Entry)) as NHibernate.Persister.Entity.AbstractEntityPersister;
3838

3939
var isFullTextEnabled = session.CreateSQLQuery(
40-
(String.Format("SELECT FullTextServiceProperty('IsFullTextInstalled') + OBJECTPROPERTY(OBJECT_ID('{0}'), 'TableFullTextChangeTrackingOn')", entityPersister.TableName)))
40+
(String.Format("SELECT convert(int, SERVERPROPERTY('IsFullTextInstalled')) + OBJECTPROPERTY(OBJECT_ID('{0}'), 'TableFullTextChangeTrackingOn')", entityPersister.TableName)))
4141
.List()[0];
4242

4343
if ((int)isFullTextEnabled != 2)

0 commit comments

Comments
 (0)