@itwin/schema-upgrade-custom-attributes-schema 0.0.0-stage → 1.0.1-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# MIT License
|
|
2
|
+
|
|
3
|
+
Copyright © 2017-2026 Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# @itwin/schema-upgrade-custom-attributes-schema
|
|
2
|
+
|
|
3
|
+
Copyright © Bentley Systems, Incorporated. All rights reserved. See [LICENSE.md](./LICENSE.md) for license terms and full copyright notice.
|
|
4
|
+
|
|
5
|
+
[iTwin.js](http://itwinjs.org) is an open source platform for creating, querying, modifying, and displaying Infrastructure Digital Twins.
|
|
6
|
+
|
|
7
|
+
## BIS Schemas
|
|
8
|
+
|
|
9
|
+
The acronym “BIS” stands for “Base Infrastructure Schemas”. BIS is an “open” and extensible family of schemas that is modularized into Domains. Please go to [iTwinjs.org](https://www.itwinjs.org/bis/) for more information.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"$schema":"https://dev.bentley.com/json_schemas/ec/32/ecschema","name":"SchemaUpgradeCustomAttributes","version":"01.00.01","alias":"SchemaUpgradeCA","description":"Custom Attributes to control schema upgrade behavior.","items":{"AllowUnitChange":{"schemaItemType":"CustomAttributeClass","label":"AllowUnitChange","description":"Applied to a property to enable the persistence unit to be changed.","modifier":"Sealed","properties":[{"name":"From","type":"PrimitiveProperty","description":"Full Name of the old persistence unit.","typeName":"string"},{"name":"To","type":"PrimitiveProperty","description":"Full Name of the new persistence unit.","typeName":"string"}],"appliesTo":"PrimitiveProperty, ArrayProperty"}}}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!-- ==================================================================================
|
|
3
|
+
| * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
| * See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
======================================================================================= -->
|
|
6
|
+
<ECSchema schemaName="SchemaUpgradeCustomAttributes" alias="SchemaUpgradeCA" version="01.00.01" description="Custom Attributes to control schema upgrade behavior." xmlns="http://www.bentley.com/schemas/Bentley.ECXML.3.2">
|
|
7
|
+
<ECCustomAttributeClass typeName="AllowUnitChange" description="Applied to a property to enable the persistence unit to be changed." displayLabel="AllowUnitChange" appliesTo="PrimitiveProperty,ArrayProperty" modifier="Sealed">
|
|
8
|
+
<ECProperty propertyName="From" typeName="string" description="Full Name of the old persistence unit." />
|
|
9
|
+
<ECProperty propertyName="To" typeName="string" description="Full Name of the new persistence unit." />
|
|
10
|
+
</ECCustomAttributeClass>
|
|
11
|
+
</ECSchema>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
noEditThisPage: true
|
|
3
|
+
remarksTarget: SchemaUpgradeCustomAttributes.ecschema.md
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# SchemaUpgradeCustomAttributes
|
|
7
|
+
|
|
8
|
+
## AllowUnitChange
|
|
9
|
+
|
|
10
|
+
Allows a persistence unit to be changed during a schema upgrade if applied to the property whose unit is being changed. The persisted values for the modified property are not changed during the schema upgrade.
|
|
11
|
+
|
|
12
|
+
|Change|Is Allowed|
|
|
13
|
+
|-|-|
|
|
14
|
+
|KindOfQuantity added to a property that previously had none|Allowed without `AllowUnitChange` custom attribute|
|
|
15
|
+
|Changing the KindOfQuantity applied to a property that does NOT change persistence unit|Allowed without `AllowUnitChange` custom attribute|
|
|
16
|
+
|Changing the KindOfQuantity applied to a property that changes the persistence unit|Requires `AllowUnitChange` custom attribute. Use Option # 1|
|
|
17
|
+
|Removing a KindOfQuantity from a property that previously had one|Requires `AllowUnitChange` custom attribute. Use Option # 2|
|
|
18
|
+
|
|
19
|
+
**The `AllowUnitChange` Custom attribute will be ignored if it is malformed, it is malformed if:**
|
|
20
|
+
|
|
21
|
+
1. The From or To properties do not match the fully qualified name of the persistence unit of the old (from) or new (to) KindOfQuantity.
|
|
22
|
+
1. The From or To properties are not set, they may be set to null or empty if appropriate.
|
|
23
|
+
|
|
24
|
+
Usage:
|
|
25
|
+
|
|
26
|
+
**Option 1:** To change the KindOfQuantity of a ECProperty to one having a different persistence unit, add custom attribute to ECProperty as follow:
|
|
27
|
+
|
|
28
|
+
```xml
|
|
29
|
+
<ECProperty propertyName='propName' typeName='double' kindOfQuantity='newKoqName'>
|
|
30
|
+
<ECCustomAttributes>
|
|
31
|
+
<AllowUnitChange xmlns="SchemaUpgradeCustomAttributes.01.00.00">
|
|
32
|
+
<From>u:CM</From>
|
|
33
|
+
<To>u:M</To>
|
|
34
|
+
</AllowUnitChange>
|
|
35
|
+
</ECCustomAttributes>
|
|
36
|
+
</ECProperty>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The From value (in this case `u:CM`) is the persistence unit of the old KindOfQuantity and the To value (in this case `u:M`) is the persistence unit of the new KindOfQuantity.
|
|
40
|
+
|
|
41
|
+
**Option 2:** To remove kind of quantity from a property, add custom attribute to ECProperty as follows:
|
|
42
|
+
|
|
43
|
+
```xml
|
|
44
|
+
<ECProperty propertyName='propName' typeName='double'>
|
|
45
|
+
<ECCustomAttributes>
|
|
46
|
+
<AllowUnitChange xmlns="SchemaUpgradeCustomAttributes.01.00.00">
|
|
47
|
+
<From>u:CM</From>
|
|
48
|
+
<To></To>
|
|
49
|
+
</AllowUnitChange>
|
|
50
|
+
</ECCustomAttributes>
|
|
51
|
+
</ECProperty>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The From value (in this case `u:CM`) must match the persistence unit of the old KindOfQuantity and the To value must be empty. Omitting the To tag will be considered malformed and the Custom Attribute will be ignored.
|
package/package.json
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@itwin/schema-upgrade-custom-attributes-schema",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@itwin/schema-upgrade-custom-attributes-schema",
|
|
3
|
+
"license": "MIT",
|
|
4
|
+
"version": "1.0.1-dev.1",
|
|
5
|
+
"homepage": "https://www.itwinjs.org/",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/iTwin/bis-schemas"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"Bentley",
|
|
12
|
+
"BIS",
|
|
13
|
+
"iModel"
|
|
14
|
+
],
|
|
15
|
+
"description": "SchemaUpgradeCustomAttributes BIS Domains",
|
|
16
|
+
"author": {
|
|
17
|
+
"name": "Bentley Systems, Inc.",
|
|
18
|
+
"url": "http://www.bentley.com"
|
|
19
|
+
},
|
|
20
|
+
"exports" : {
|
|
21
|
+
"./SchemaUpgradeCustomAttributes.ecschema.xml": "./SchemaUpgradeCustomAttributes.ecschema.xml",
|
|
22
|
+
"./SchemaUpgradeCustomAttributes.ecschema.json": "./SchemaUpgradeCustomAttributes.ecschema.json"
|
|
23
|
+
}
|
|
24
|
+
}
|