how to add another table in existing realm android -


i have database few tables. need add table existing database, don't find ways in migration class.

  table persontable = realm.gettable(person.class);         table pettable = realm.gettable(pet.class);         pettable.addcolumn(columntype.string, "name");         pettable.addcolumn(columntype.string, "type");         long petsindex = persontable.addcolumnlink(columntype.link_list, "pets", pettable);         long fullnameindex = getindexforproperty(persontable, "fullname");           (int = 0; < persontable.size(); i++) {             if (persontable.getstring(fullnameindex, i).equals("jp mcdonald")) {                 persontable.getuncheckedrow(i).getlinklist(petsindex).add(pettable.add("jimbo", "dog"));             }          }          version++;     }  

the example gave above has that

table pettable = realm.gettable(pet.class); pettable.addcolumn(columntype.string, "name"); pettable.addcolumn(columntype.string, "type"); long petsindex = persontable.addcolumnlink(columntype.link_list, "pets", pettable); 

note in example, version 1 doesn't have pet table until version 2.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -