@@ -118,7 +118,7 @@ impl Schema {
118118 workspace_snapshot
119119 . add_edge (
120120 schema_category_index_id,
121- EdgeWeight :: new ( change_set, EdgeWeightKind :: use_not_as_default ( ) ) ?,
121+ EdgeWeight :: new ( change_set, EdgeWeightKind :: new_use ( ) ) ?,
122122 id,
123123 )
124124 . await ?;
@@ -136,7 +136,7 @@ impl Schema {
136136 workspace_snapshot. edges_directed ( self . id , Outgoing ) . await ?;
137137
138138 for ( edge_weight, _, target_index) in default_schema_variant_node_indicies {
139- if * edge_weight. kind ( ) == EdgeWeightKind :: use_as_default ( ) {
139+ if * edge_weight. kind ( ) == EdgeWeightKind :: new_use_default ( ) {
140140 return Ok ( Some (
141141 workspace_snapshot
142142 . get_node_weight ( target_index)
@@ -164,19 +164,23 @@ impl Schema {
164164 ) ;
165165
166166 // Our system will have edges as follows:
167- // Schema -> Uses -> Schema Variant
168- // In order to make a schema variant the default for a schema, we need to update the
169- // correct edge from Use to Default:
170- // Schema -> Default -> Schema Variant
171- // Therefore, when we are setting a default schema variant we need to find any existing
172- // Default edges and convert them back to uses AND we need to find the existing Use edge
173- // between our nodes and change that to be a Default
174-
167+ //
168+ // Schema -> Use -> Schema Variant
169+ //
170+ // In order to make a schema variant the default for a schema, we need
171+ // to update the correct edge from Use to the default variant of Use,
172+ //
173+ // Schema -> Use {is_default = true} -> Schema Variant
174+ //
175+ // Therefore, when we are setting a default schema variant we need to
176+ // find any existing default Use edges and convert them back to uses AND we
177+ // need to find the existing Use edge between our nodes and change that
178+ // to be a default Use
175179 for ( edge_weight, source_index, target_index) in workspace_snapshot
176180 . edges_directed_for_edge_weight_kind (
177181 self . id ,
178182 Outgoing ,
179- EdgeWeightKind :: use_as_default ( ) . into ( ) ,
183+ EdgeWeightKind :: new_use_default ( ) . into ( ) ,
180184 )
181185 . await ?
182186 {
@@ -194,10 +198,7 @@ impl Schema {
194198 workspace_snapshot
195199 . add_edge (
196200 self . id ,
197- EdgeWeight :: new (
198- ctx. change_set_pointer ( ) ?,
199- EdgeWeightKind :: use_not_as_default ( ) ,
200- ) ?,
201+ EdgeWeight :: new ( ctx. change_set_pointer ( ) ?, EdgeWeightKind :: new_use ( ) ) ?,
201202 schema_variant_id,
202203 )
203204 . await ?;
@@ -207,7 +208,7 @@ impl Schema {
207208 . edges_directed_for_edge_weight_kind (
208209 self . id ,
209210 Outgoing ,
210- EdgeWeightKind :: use_not_as_default ( ) . into ( ) ,
211+ EdgeWeightKind :: new_use ( ) . into ( ) ,
211212 )
212213 . await ?
213214 {
@@ -225,7 +226,7 @@ impl Schema {
225226 workspace_snapshot
226227 . add_edge (
227228 self . id ,
228- EdgeWeight :: new ( ctx. change_set_pointer ( ) ?, EdgeWeightKind :: use_as_default ( ) ) ?,
229+ EdgeWeight :: new ( ctx. change_set_pointer ( ) ?, EdgeWeightKind :: new_use_default ( ) ) ?,
229230 schema_variant_id,
230231 )
231232 . await ?;
0 commit comments