pardom-zz / ActiveAndroid

Active record style SQLite persistence for Android
http://www.activeandroid.com
4.7k stars 1.03k forks source link

FOREIGN KEY constraint failed (code 787) #438

Open markymc opened 8 years ago

markymc commented 8 years ago

Hi all! I've just updated my app from to use AA 3.1.0-SNAPSHOT via Gradle from a library version from late 2012 (without making any edits to my models or the config) and I'm suddenly getting loads of FOREIGN KEY constraint failed (code 787) errors being thrown.

I can't seem to find any documentation referring to this. What should I do to my models to fix this without having to change any of my non-model code?

Any help would be greatly appreciated!

Here is an example model if it helps:

@Table(name = "subproducts")
public class ContentItem extends Model implements Serializable {

    @Column(name = "subproduct_id", unique = true, onUniqueConflict = ConflictAction.REPLACE)
    public Long id;

    @Column(name = "title_en")
    public String title_en;

    @Column(name = "content")
    public String content;

    @Column(name = "url")
    public String url;

    @Column(name = "title_ja")
    public String title_ja;

    @Column(name = "number")
    public int number;

    @Column(name = "sl_product_id")
    public long sl_product_id;

    @Column(name = "product_id")
    public Product product;

    @Column(name = "description_en")
    public String description_en;

    @Column(name = "description_ja")
    public String description_ja;

    @Column(name = "is_not_new")
    private boolean is_not_new;

    @Column(name = "p_order")
    public int order;

    @Column(name = "cover_image")
    public Image cover_image;

    @Column(name = "details_image")
    public Image details_image;

    @Column(name = "banner_image")
    public BannerImage banner_image;

    @Column(name = "type")
    public String type;
}

Thanks!