Skip to content

Latest commit

 

History

History
94 lines (66 loc) · 2.69 KB

SQL-Alter-Type.adoc

File metadata and controls

94 lines (66 loc) · 2.69 KB

SQL - ALTER TYPE

edit

Change a type defined in the schema. The change is persistent.

Syntax

ALTER TYPE <type> [<attribute-name> <attribute-value>] [CUSTOM <custom-key> = <custom-value>]
  • <type> Defines the type you want to change.

  • <attribute-name> Defines the attribute you want to change. For a list of supported attributes, see the table below.

  • <attribute-value> Defines the value you want to set.

  • <custom-key> Name of the custom property to set.

  • <custom-value> Value for the custom property. All data types are supported as values.

Examples

  • Add Person to the super types:

ArcadeDB> ALTER TYPE Employee SUPERTYPE +Person
  • Remove a super-type:

ArcadeDB> ALTER TYPE Employee SUPERTYPE -Person
  • Add the "account2" bucket to the type Account.

ArcadeDB> ALTER TYPE Account BUCKET +account2

In the event that the bucket does not exist, it automatically creates it.

  • Remove a bucket from the type Account with the ID 34:

ArcadeDB> ALTER TYPE Account BUCKET -34
  • Modify the bucket selection strategy to partitioned selecting the property id as partition key:

ArcadeDB> ALTER TYPE Account BucketSelectionStrategy `partitioned('id')`
  • Set the custom value with key 'description':

ArcadeDB> ALTER TYPE Account CUSTOM description = 'All users'
  • Set the custom nested value with key 'meta':

ArcadeDB> ALTER TYPE Account CUSTOM meta = { abool: true, alist: [1,2,3,4,5]};
  • Change the type name from 'Account' to 'Client':

ArcadeDB> ALTER TYPE Account NAME Client;

For more information, see:

Supported Attributes

Attribute Type Support Description

NAME

Identifier

Changes the type name.

SUPERTYPE

Identifier

Defines a super-type for the type. Use NULL to remove a super-type assignment. It supports multiple inheritances. To set or add a new type, you can use the syntax +<type>, to remove it use -<type>.

BUCKET

Identifier or Integer

+ to add a bucket and - to remove it from the type. If the bucket doesn’t exist, it creates a physical bucket. Adding buckets to a type is also useful in storing records in distributed servers.

BUCKETSELECTIONSTRATEGY

Identifier

Change the selection of the bucket when new records are created. Using partitioned() is reccomended when your have a unique id