Comments (2)
@mrsum It's possible to create an edge collection by providing an options object instead of a string in the return array of collections()
. I updated the README, added another test to confirm this behavior, updated the example repository and also published a new version 1.5.1
.
Please do let me know if there's any other questions or issues.
import { CollectionType } from 'arangojs'
const migration = {
description: 'Simple migration',
async collections () {
// All collections used in this migration must be defined here. A string or an options object can be used.
return [
'todo',
'user',
{
collectionName: 'user_todo_edge',
options: {
type: CollectionType.EDGE_COLLECTION
}
}]
},
async up (db, step) {
// Using the `step` function, add a new document to the collection as part of this migration's transaction.
await step(async () => await db.collection('todo').save({
_key: '1',
name: 'Buy milk'
}))
await step(async () => await db.collection('user').save({
_key: '1',
name: 'John Doe'
}))
await step(async () => await db.collection('user_todo_edge').save({
_from: 'user/1',
_to: 'todo/1'
}))
}
}
export default migration
from arango-migrate.
Its possible over
const collections = ['todo_collection']
const edges = ['todo_edges_collection'];
const migration = {
description: '01. Create Collections and Edges',
async collections() {
return [...collections, ...edges];
},
async up(db, step) {
await step(async () =>
edges.map(edgeCollectionName => db?.createEdgeCollection(edgeCollectionName))
);
}
};
but maybe migration tool should have function like that
async edges() {
return ['todo_edges_collection']
}
from arango-migrate.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arango-migrate.