Open dalssoft opened 2 years ago
Would be great if we improve the behavior of herbs update for cases when entities have relationship with other entities.
herbs update
entity('ToDoList', { id: field(Number), items: field(Item),
This should create a migration with:
return knex.schema .createTable('ToDoList', function (table) { table.string('id').primary() table.string('itemId').references('id').inTable('Item') })
entity('ToDoList', { id: field(Number), items: field([Item]),
return knex.schema .createTable('ToDoList', function (table) { table.string('id').primary() ... }) .alterTable('Item', function (table) { table.string('itemId').references('id').inTable('ToDoList') ... })
@endersoncosta is working on it PR: https://github.com/herbsjs/herbs-cli/pull/144
Would be great if we improve the behavior of
herbs update
for cases when entities have relationship with other entities.one-to-one
This should create a migration with:
one-to-many
This should create a migration with: