File tree Expand file tree Collapse file tree 3 files changed +39
-18
lines changed
Expand file tree Collapse file tree 3 files changed +39
-18
lines changed Original file line number Diff line number Diff line change @@ -39,24 +39,6 @@ return new class extends Migration {
3939 ],
4040 'handle' => 'content',
4141 ],
42- [
43- 'field' => [
44- 'type' => 'users',
45- 'display' => 'Author',
46- 'default' => 'current',
47- 'localizable' => true,
48- 'max_items' => 1,
49- ],
50- 'handle' => 'author',
51- ],
52- [
53- 'field' => [
54- 'type' => 'template',
55- 'display' => 'Template',
56- 'localizable' => true,
57- ],
58- 'handle' => 'template',
59- ],
6042 ],
6143 ]);
6244 } catch (\JsonException $e) {
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ class ServiceProvider extends AddonServiceProvider
4242 protected $ updateScripts = [
4343 \Statamic \Eloquent \Updates \AddOrderToEntriesTable::class,
4444 \Statamic \Eloquent \Updates \AddBlueprintToEntriesTable::class,
45+ \Statamic \Eloquent \Updates \ChangeDefaultBlueprint::class,
4546 \Statamic \Eloquent \Updates \DropForeignKeysOnEntriesAndForms::class,
4647 ];
4748
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Statamic \Eloquent \Updates ;
4+
5+ use Statamic \Eloquent \Fields \BlueprintModel ;
6+ use Statamic \UpdateScripts \UpdateScript ;
7+
8+ class ChangeDefaultBlueprint extends UpdateScript
9+ {
10+ public function shouldUpdate ($ newVersion , $ oldVersion )
11+ {
12+ return $ this ->isUpdatingTo ('2.3.0 ' );
13+ }
14+
15+ public function update ()
16+ {
17+ $ model = BlueprintModel::where ('handle ' , 'default ' )->first ();
18+
19+ if ($ model ) {
20+ $ model ->data = [
21+ 'fields ' => [
22+ [
23+ 'field ' => [
24+ 'type ' => 'markdown ' ,
25+ 'display ' => 'Content ' ,
26+ 'localizable ' => true ,
27+ ],
28+ 'handle ' => 'content ' ,
29+ ],
30+ ],
31+ ];
32+
33+ $ model ->save ();
34+
35+ $ this ->console ()->info ('Successfully updated the default blueprint ' );
36+ }
37+ }
38+ }
You can’t perform that action at this time.
0 commit comments