Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to create table #99

Open
tianxin1989 opened this issue Jul 12, 2018 · 5 comments
Open

Failed to create table #99

tianxin1989 opened this issue Jul 12, 2018 · 5 comments

Comments

@tianxin1989
Copy link

Hello,
I want to use SharkORM to create a chat history table. I created two objects, a NLMessageModel and a NLChatSessionModel. When I log in with A account, I receive a message store that is normal.But when I switch the B account, the message store reports an error.
for example
error msg = 'no such table: NLMessageModel'
Any ideas ? Many thanks in advance

@editfmah
Copy link
Owner

What do you mean log in with A/B account? are you talking about closing a database and opening another one?

@tianxin1989
Copy link
Author

Hello,

  • (void)loginUser:(uint64_t)uid {
    // 先关闭
    [self close];

    // 开启新的数据库
    [SharkORM setDelegate:self];
    [SharkORM openDatabaseNamed:DB_NAME];
    // 手动创建表
    // [SharkORM setupTablesFromClasses:[NLChatSessionModel class], nil];
    [SharkORM setupTablesFromClasses:[NLMessageModel class], nil];
    }

@tianxin1989
Copy link
Author

  • (void)close {
    if (self.dataBaseOpened) {
    [SharkORM closeDatabaseNamed:DB_NAME];
    [SharkORM setDelegate:nil];
    self.dataBaseOpened = NO;
    }
    }

@editfmah
Copy link
Owner

There will be a new release within the next couple of days which should address this issue. Sorry for any inconvenience, this is a relatively unused part of the ORM.

@cityfantom
Copy link

Is the solve this issue? I am make IM app, when turn the account needs recreate the database file and the tables of the entities.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants