Giter Club home page Giter Club logo

Comments (3)

gaojunquan avatar gaojunquan commented on August 26, 2024

此部分目前只有两个接口, 关于迁移, 后续会完善
/**
增加新字段, 在建表后还想新增字段,可以在原建表model或新model中新增对应属性,然后传入即可新增该字段,该操作已在事务中执行

@param tableName 表的名称
@param parameters 如果传Model:数据库新增字段为建表时model所没有的属性,如果传dictionary格式为@{@"newname":@"TEXT"}
@param nameArr 不允许生成字段的属性名的数组
@return 是否成功
*/

  • (BOOL)jq_alterTable:(NSString *)tableName dicOrModel:(id)parameters excludeName:(NSArray *)nameArr;
  • (BOOL)jq_alterTable:(NSString *)tableName dicOrModel:(id)parameters;

from jqfmdb.

woniuwuyu avatar woniuwuyu commented on August 26, 2024

[db jq_inDatabase:^{
if (![db jq_isExistTable:tablename]) {
[db jq_createTable:tablename dicOrModel:model];
}
else
{
[db jq_alterTable:tablename dicOrModel:model];
}
这么写会报错 大神该在哪里调用啊

from jqfmdb.

gaojunquan avatar gaojunquan commented on August 26, 2024

报错的原因是因为死锁, alter不要在block内调用(jq_inDatabase:^), 因为新增字段已经在事务里处理了

from jqfmdb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.