-
Notifications
You must be signed in to change notification settings - Fork 1k
Open
Description
I want add new table Products into current DB.
I have performed the following steps:
Step 1: Change files AndroidManifest.xml
<meta-data
android:name="AA_DB_VERSION"
android:value="2" />
Step 2: Create new file 2.sql in folder assets/migrations
DROP TABLE IF EXISTS "Products";
CREATE TABLE IF NOT EXISTS "Products" ("Id" INTEGER,"p_name" TEXT,"p_des" TEXT,"p_price" TEXT);
Step 3: Create new file Products.java
@Table(name = "Products")
public class Products extends Model implements Serializable {
@Column(name = "Id")
public Integer Id;
@Column(name = "p_name")
public String p_name;
@Column(name = "p_des")
public String p_des;
@Column(name = "p_price")
public String p_price;
public Products() {
super();
}
}
When I update the version app, I get the following error:
SQLiteLog: (1) duplicate column name: Id in "CREATE TABLE IF NOT EXISTS Products (Id INTEGER PRIMARY KEY AUTOINCREMENT, Id INTEGER PRIMARY KEY AUTOINCREMENT, p_name TEXT, p_des TEXT, p_price TEXT);"
Metadata
Metadata
Assignees
Labels
No labels