-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Add a GOG-slug naming scheme and make it the default (#49)
- Loading branch information
1 parent
1fd1ac8
commit 4469f94
Showing
14 changed files
with
103 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,4 +29,9 @@ public function hasUpdates(): bool | |
{ | ||
return false; | ||
} | ||
|
||
public function getSlug(): string | ||
{ | ||
return ''; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace App\Enum; | ||
|
||
enum NamingConvention: string | ||
{ | ||
case Custom = 'custom'; | ||
case GogSlug = 'gog-slug'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace App\Migration; | ||
|
||
use App\Enum\NamingConvention; | ||
use App\Enum\Setting; | ||
use PDO; | ||
|
||
final readonly class Migration4 implements Migration | ||
{ | ||
|
||
public function migrate(PDO $pdo): void | ||
{ | ||
$pdo->exec('alter table games add column slug text default null'); | ||
// delete duplicate settings | ||
$pdo->exec('delete from settings where id in (select max(id) from settings group by setting having count(setting) > 1)'); | ||
$pdo->exec("alter table settings rename to old_settings"); | ||
$pdo->exec('create table settings (id integer primary key autoincrement, setting text, value text, constraint setting_name unique (setting))'); | ||
$pdo->exec('insert into settings (setting, value) select setting, value from old_settings'); | ||
$pdo->exec('drop table old_settings'); | ||
|
||
// A new default value has been retroactively added to Migration1. | ||
// The original naming convention is being set here if there isn't one. | ||
// This effectively means that all new installations have the new value while everyone who used the app before | ||
// has the original one. | ||
$pdo->prepare('insert into settings (setting, value) values (?, ?) on conflict(setting) do nothing')->execute([ | ||
Setting::NamingConvention->value, | ||
json_encode(NamingConvention::Custom->value), | ||
]); | ||
} | ||
|
||
public function getVersion(): int | ||
{ | ||
return 4; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters