type_bridge.migration.simple_migration¶
simple_migration
¶
Migration manager for TypeDB schema migrations.
MigrationManager
¶
Manager for schema migrations.
Initialize migration manager.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
db
|
Database
|
Database connection |
required |
Source code in type_bridge/migration/simple_migration.py
add_migration
¶
Add a migration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Migration name |
required |
schema
|
str
|
TypeQL schema definition |
required |
Source code in type_bridge/migration/simple_migration.py
apply_migrations
¶
Apply all pending migrations.
Source code in type_bridge/migration/simple_migration.py
create_attribute_migration
¶
Create a migration to add an attribute.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
attr_name
|
str
|
Attribute name |
required |
value_type
|
str
|
Value type |
required |
Returns:
| Type | Description |
|---|---|
str
|
TypeQL migration |
Source code in type_bridge/migration/simple_migration.py
create_entity_migration
¶
Create a migration to add an entity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entity_name
|
str
|
Entity name |
required |
attributes
|
list[str]
|
List of attribute names |
required |
Returns:
| Type | Description |
|---|---|
str
|
TypeQL migration |
Source code in type_bridge/migration/simple_migration.py
create_relation_migration
¶
Create a migration to add a relation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
relation_name
|
str
|
Relation name |
required |
roles
|
list[tuple[str, str]]
|
List of (role_name, player_type) tuples |
required |
attributes
|
list[str] | None
|
Optional list of attribute names |
None
|
Returns:
| Type | Description |
|---|---|
str
|
TypeQL migration |