Skip to content

Commit

Permalink
[Persistence]: Bump Data Version to 2 due to MaterialSubject to DbDom…
Browse files Browse the repository at this point in the history
…ainObject Switch
  • Loading branch information
seandenigris committed Oct 7, 2023
1 parent 88d5b22 commit 8dacdbd
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions src/Dynabook-Persistence/DynabookDB.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,18 @@ DynabookDB class >> backupDirectoryParent [
^ FileLocator dynabookData / 'Dynabook'
]

{ #category : #accessing }
DynabookDB class >> dataVersion [

^ 2
]

{ #category : #accessing }
DynabookDB class >> metadata [

^ {
#gitCommit -> self package peIceRepository workingCopy referenceCommit id
} asDictionary
^ super metadata
at: #gitCommit put: self package peIceRepository workingCopy referenceCommit id;
yourself
]

{ #category : #'loading/saving' }
Expand All @@ -35,3 +41,23 @@ DynabookDB class >> schema [
VirtualStashDB.
}
]

{ #category : #migrations }
DynabookDB class >> version2Migration [
<dataMigration>

| copyMaterials |
copyMaterials := [ :inst |
inst supportMaterials: (inst instVarNamed: #supportMaterials) ].

^ SpDataMigration new
dataVersion: 2;
preMaterialize: [
PpEvent addInstVarNamed: #supportMaterials.
PpValue addInstVarNamed: #supportMaterials ];
postMaterialize: [
PpEvent allSubInstances do: copyMaterials.
PpValue allSubInstances do: copyMaterials.
PpEvent removeInstVarNamed: #supportMaterials.
PpValue removeInstVarNamed: #supportMaterials ]
]

0 comments on commit 8dacdbd

Please sign in to comment.