Skip to content
This repository has been archived by the owner on Nov 8, 2021. It is now read-only.

Commit

Permalink
Temp. solution of realm/realm-java#3651
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenneth Geisshirt committed Jan 18, 2017
1 parent 4f66768 commit 4b1e3a4
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/object_store.cpp
Expand Up @@ -50,21 +50,26 @@ const size_t c_zeroRowIndex = 0;
const char c_object_table_prefix[] = "class_";

void create_metadata_tables(Group& group) {
TableRef table = group.get_or_add_table(c_primaryKeyTableName);
if (table->get_column_count() == 0) {
table->add_column(type_String, c_primaryKeyObjectClassColumnName);
table->add_column(type_String, c_primaryKeyPropertyNameColumnName);
}
table->add_search_index(table->get_column_index(c_primaryKeyObjectClassColumnName));

table = group.get_or_add_table(c_metadataTableName);
// FIXME: the order of the creation of the two tables seems to
// matter for some Android devices. The reason is unclear, and
// further investigation is required.
// See https://github.com/realm/realm-java/issues/3651

TableRef table = group.get_or_add_table(c_metadataTableName);
if (table->get_column_count() == 0) {
table->add_column(type_Int, c_versionColumnName);

// set initial version
table->add_empty_row();
table->set_int(c_versionColumnIndex, c_zeroRowIndex, ObjectStore::NotVersioned);
}

table = group.get_or_add_table(c_primaryKeyTableName);
if (table->get_column_count() == 0) {
table->add_column(type_String, c_primaryKeyObjectClassColumnName);
table->add_column(type_String, c_primaryKeyPropertyNameColumnName);
}
table->add_search_index(table->get_column_index(c_primaryKeyObjectClassColumnName));
}

void set_schema_version(Group& group, uint64_t version) {
Expand Down

0 comments on commit 4b1e3a4

Please sign in to comment.