-
Notifications
You must be signed in to change notification settings - Fork 37
Add a new Model to FluxC
Andrey edited this page Dec 15, 2023
·
5 revisions
- A model can be created in
org.wordpress.android.fluxc.persistence.entity
. - The model has to be registered in
org.wordpress.android.fluxc.persistence::WCAndroidDatabase
. - Make sure to add either manual or auto migration with a test in
MigrationTests
- Create a new class in
org.wordpress.android.fluxc.model
, this new class should implementsIdentifiable
, minimum Model sample:
@Table
public class TestModel implements Identifiable {
@PrimaryKey
@Column private int mId;
// Post format attributes
@Column private String mName;
public int getId() {
return mId;
}
public void setId(int id) {
mId = id;
}
public String getName() {
return mName;
}
public void setName(String name) {
mName = name;
}
}
-
Edit the
WellSqlConfig
class, and add a migration step for the new table (see otherCREATE TABLE ...
entries in theonUpgrade()
method -
If you add any test, make sure the WellSqlConfig is used in the test setup or create the new table yourself.