Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic data migrations #383

Merged
merged 12 commits into from
Apr 28, 2016
Merged

Basic data migrations #383

merged 12 commits into from
Apr 28, 2016

Conversation

alazier
Copy link
Contributor

@alazier alazier commented Apr 11, 2016

Closes #333

Allows manual copying/renaming of properties without having to do an extra migrations. Design also supports stepwise migrations.

I think we should consider shipping this improvement without full support for property renames or schema access during migrations, as this eliminates the biggest pain points and current limitations.

@alazier alazier force-pushed the al-migration branch 2 times, most recently from 869174c to 8f07cd8 Compare April 18, 2016 22:27
@alazier alazier changed the title [WIP] Basic data migrations Basic data migrations Apr 28, 2016
@alazier
Copy link
Contributor Author

alazier commented Apr 28, 2016

@appden ready for review now.

@@ -243,11 +245,12 @@ inline typename T::Function Realm<T>::create_constructor(ContextType ctx) {
}

template<typename T>
void Realm<T>::constructor(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[]) {
void Realm<T>::constructor(ContextType ctx, ObjectType this_object, size_t argc, const ValueType arguments[]) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accidental whitespace added

@@ -363,6 +378,12 @@ void Realm<T>::get_schema_version(ContextType ctx, ObjectType object, ReturnValu
}

template<typename T>
void Realm<T>::get_schema(ContextType ctx, ObjectType object, ReturnValue &return_value) {
auto schema = get_internal<T, RealmClass<T>>(object)->get()->config().schema.get();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't really matter, but I don't think the ->get() part is necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is necessary

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get it now, since it's a pointer to a shared_ptr


static const String type_string = "type";
const std::string type = property.type != PropertyTypeArray ? string_for_property_type(property.type) : "list";
Object::set_property(ctx, object, type_string, Value::from_string(ctx, type));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer if the type be the objectType for type == "object", since we encourage that usage in our documentation to avoid confusion caused by objectType meaning two possible things.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes code that is evaluating the schema much nastier - what you suggest would make it very difficult to check if something is an object type.

@appden
Copy link
Contributor

appden commented Apr 28, 2016

Looks good 👍

@alazier alazier merged commit a2ed550 into master Apr 28, 2016
@alazier alazier removed the S:Review label Apr 28, 2016
@fealebenpae fealebenpae deleted the al-migration branch June 20, 2017 11:11
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants