我目前正在尝试使用PersistenceJS的迁移插件对现有数据库进行更改.我可以添加/编辑/删除数据库中的项目 - 但是......
如何更改现有(!)列的类型,例如从"text"更改为"integer"?
These changes should retain currently existing data.
可悲的是,文档有点稀缺,也许你可以帮忙吗?
这是当前的工作设置:
persistence.store.websql.config(persistence, 'tododatabase', 'todos are fun', 5*1024*1024);
var Todo = persistence.define('Todo', {
task: 'TEXT',
priority: 'INT',
done: 'BOOL'
});
persistence.schemaSync();
function addTodo( item ){
var todo = new Todo();
todo.task = item.task;
todo.priority = item.priority;
todo.done = item.done;
persistence.add(todo);
persistence.flush();
};
function deleteTodo( item, callback ){
// item.id was created automatically by calling "new Todo()"
Todo.all().filter('id','=', item.id ).destroyAll( function(){
persistence.flush( callback );
});
};
Run Code Online (Sandbox Code Playgroud)
有点 …