Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#4667 Fix Sqlsrv Setup #4668

Closed
wants to merge 13 commits into from
Closed
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@
/tests/clover.xml
/tests/coverage
/vendor/
/.vs
/webtrees.phpproj
/webtrees.phpproj.user
/webtrees.sln
/.gitignore
1 change: 0 additions & 1 deletion app/Schema/Migration44.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ public function upgrade(): void
->insertUsing(['id', 'parent_id', 'place', 'latitude', 'longitude'], $select2);
}
}

DB::schema()->drop('placelocation');
}

Expand Down
7 changes: 7 additions & 0 deletions app/Schema/SeedGedcomTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,17 @@ class SeedGedcomTable implements SeedInterface
public function run(): void
{
// Add a "default" tree, to store default settings
$setIdentityCmd = 'SET IDENTITY_INSERT [' . DB::connection()->getTablePrefix() . 'gedcom] ';
if (DB::connection()->getDriverName() === 'sqlsrv') {
DB::unprepared($setIdentityCmd . 'ON');
}
DB::table('gedcom')->updateOrInsert([
'gedcom_id' => -1,
], [
'gedcom_name' => 'DEFAULT_TREE',
]);
if (DB::connection()->getDriverName() === 'sqlsrv') {
DB::unprepared($setIdentityCmd . 'OFF');
}
}
}
7 changes: 7 additions & 0 deletions app/Schema/SeedUserTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ class SeedUserTable implements SeedInterface
public function run(): void
{
// Add a "default" user, to store default settings
$setIdentityCmd = 'SET IDENTITY_INSERT [' . DB::connection()->getTablePrefix() . 'user] ';
if (DB::connection()->getDriverName() === 'sqlsrv') {
DB::unprepared($setIdentityCmd . 'ON');
}
DB::table('user')->updateOrInsert([
'user_id' => -1,
], [
Expand All @@ -42,5 +46,8 @@ public function run(): void
'email' => 'DEFAULT_USER',
'password' => 'DEFAULT_USER',
]);
if (DB::connection()->getDriverName() === 'sqlsrv') {
DB::unprepared($setIdentityCmd . 'OFF');
}
}
}
2 changes: 2 additions & 0 deletions app/Services/ServerCheckService.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ private function databaseDriverErrors(string $driver): Collection
return Collection::make([
$this->checkPhpExtension('pdo'),
$this->checkPhpExtension('pdo_odbc'),
$this->checkPhpExtension('pdo_sqlsrv'),

]);

default:
Expand Down