Created
May 26, 2021 04:57
-
-
Save NightJar/30c17f80e6b587dbe1dd32e2a9ef5965 to your computer and use it in GitHub Desktop.
Repair existing snapshots which have erroneously not recorded their author
This file contains hidden or 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
<?php | |
namespace App\Tests\Migrations\Stubs; | |
use SilverStripe\Dev\TestOnly; | |
use SilverStripe\ORM\DataObject; | |
class ContentBit extends DataObject implements TestOnly | |
{ | |
private static $table_name = 'BitOfContent'; | |
private static $has_one = ['Byte' => ContentByte::class]; | |
} |
This file contains hidden or 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
<?php | |
namespace App\Tests\Migrations\Stubs; | |
use SilverStripe\Dev\TestOnly; | |
class ContentBitVideo extends ContentBit implements TestOnly | |
{ | |
} |
This file contains hidden or 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
<?php | |
namespace App\Tests\Migrations\Stubs; | |
use SilverStripe\Dev\TestOnly; | |
use SilverStripe\ORM\DataObject; | |
class ContentByte extends DataObject implements TestOnly | |
{ | |
private static $table_name = 'ByteOfContent'; | |
private static $has_many = ['Bits' => ContentBit::class]; | |
private static $owns = ['Bits']; | |
} |
This file contains hidden or 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
<?php | |
namespace App\Tests\Migrations\Stubs; | |
use SilverStripe\Dev\TestOnly; | |
use SilverStripe\ORM\DataObject; | |
class ContentWord extends DataObject implements TestOnly | |
{ | |
private static $table_name = 'WordOfContent'; | |
private static $has_one = ['Byte' => ContentByte::class]; | |
private static $owns = ['Byte']; | |
} |
This file contains hidden or 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
<?php | |
namespace App\Tests\Migrations\Stubs; | |
use SilverStripe\Dev\TestOnly; | |
use SilverStripe\ORM\DataObject; | |
use SilverStripe\Security\Member; | |
class VersionBit extends DataObject implements TestOnly | |
{ | |
private static $table_name = 'BitOfContent_Versions'; | |
private static $db = [ | |
'Version' => 'Int', | |
'WasPublished' => 'Boolean', | |
'WasDeleted' => 'Boolean', | |
'WasDraft' => 'Boolean', | |
]; | |
private static $has_one = [ | |
'Record' => ContentBit::class, | |
'Author' => Member::class, | |
'Publisher' => Member::class, | |
'Byte' => ContentByte::class, | |
]; | |
} |
This file contains hidden or 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
<?php | |
namespace App\Tests\Migrations\Stubs; | |
use SilverStripe\Dev\TestOnly; | |
use SilverStripe\ORM\DataObject; | |
use SilverStripe\Security\Member; | |
class VersionByte extends DataObject implements TestOnly | |
{ | |
private static $table_name = 'ByteOfContent_Versions'; | |
private static $db = [ | |
'Version' => 'Int', | |
'WasPublished' => 'Boolean', | |
'WasDeleted' => 'Boolean', | |
'WasDraft' => 'Boolean', | |
]; | |
private static $has_one = [ | |
'Record' => ContentByte::class, | |
'Author' => Member::class, | |
'Publisher' => Member::class, | |
]; | |
} |
This file contains hidden or 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
<?php | |
namespace App\Tests\Migrations\Stubs; | |
use SilverStripe\Dev\TestOnly; | |
use SilverStripe\ORM\DataObject; | |
use SilverStripe\Security\Member; | |
class VersionWord extends DataObject implements TestOnly | |
{ | |
private static $table_name = 'WordOfContent_Versions'; | |
private static $db = [ | |
'Version' => 'Int', | |
'WasPublished' => 'Boolean', | |
'WasDeleted' => 'Boolean', | |
'WasDraft' => 'Boolean', | |
]; | |
private static $has_one = [ | |
'Record' => ContentWord::class, | |
'Author' => Member::class, | |
'Publisher' => Member::class, | |
'Byte' => ContentByte::class, | |
]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
c.f. silverstripe/silverstripe-versioned-snapshots#41
The folder structure was as follows (as hinted by namespaces):
Where composer.json: