How to resolve the duplicate column name error in Room Db migration

Published

I added below cade for adding column to the ‘SithluBody’ table wen migration.

static final Migration MIGRATION_3_4 = new Migration(3, 4) {
    @Override
    public void migrate(SupportSQLiteDatabase database) {
        database.execSQL("ALTER TABLE SithaluBody ADD COLUMN has_thumb INTEGER NOT NULL 
        DEFAULT 0");
        database.execSQL("ALTER TABLE SithaluBody ADD COLUMN reacts TEXT");
    }
};

but I got the error ==> Fatal Exception: android.database.sqlite.SQLiteException
duplicate column name: has_thumb (code 1 SQLITE_ERROR). How can I fix it? please help me.

Source: Android Questions

Published
Categorized as android, android-room

Answers

Leave a Reply

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq