question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

create new Table on new version of application

See original GitHub issue

when i try to have some new table on application i increase app version and i expectation to create new table, but i get error such as:

no such table: UserChannelInformation (code 1): , while compiling: INSERT INTO UserChannelInformation(channelId) VALUES (?)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
abiemanncommented, Jul 18, 2018

I can confirm that if you add a new table and don’t increase the database version, then you’ll see

Caused by: android.database.sqlite.SQLiteException: no such table: … etc

When you increase the DB version, it’ll work without needing to specifically add migration code (CREATE TABLE)

1reaction
abiemanncommented, May 11, 2018

Mahdi, below is how I’ve done it. I assume a CREATE TABLE sqlite command is not needed - I haven’ tried adding a completely new table yet.

@Migration(version = 3, database = AppDatabase.class)
public class MigrateTo03 extends BaseMigration {
    @Override
    public void migrate(@NonNull DatabaseWrapper database) {
        database.execSQL("ALTER TABLE `Person` ADD COLUMN `birthState` TEXT;");
        database.execSQL("ALTER TABLE `Person` ADD COLUMN `birthCountry` TEXT;");
        //database.execSQL("CREATE TABLE `HealthTopic` ... etc... ;"); not needed ?
        Timber.i("Upgraded Database to version 3");
    }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating new Table on updating existing app - Stack Overflow
Currently my app version for eg 1.1 it has only one table. which i create inside onCreate() method of my data helper class....
Read more >
Create a custom table (contains video) - Power Apps
Section Column Description Required columns Display name (Primary Name Column) Required columns Enable attachments Collaboration Support mail merge Allows people to use this table w...
Read more >
Creating a new application on existing tables - YouTube
Creating a new application on existing tables · Key moments. View all · Key moments · Description · Key moments. View all ·...
Read more >
Create a table - ServiceNow Docs
Create a table · Navigate to All > System Definition > Tables. · Click New and complete the form. · In the Columns...
Read more >
Step 2: Create and set up a Table app in Awesome Table
Click Open to open your selected spreadsheet in a new tab · Click Select to choose a different spreadsheet as your data source...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found