mirror of
https://github.com/google/nomulus.git
synced 2025-05-01 12:37:52 +02:00
It is important to get at least this one commit in before the public Nomulus release so that none of our public users will have to go through this data migration (although we will have to). The migration strategy is as follows: 1. Dual-write to non-ReferenceUnion fields in addition to the current ReferenceUnion fields in use, and add new indexes (this commit). Deploy. 2. Run the ResaveAllEppResourcesAction backfill []. 3. Switch all code over to using the new fields. Dual-write is still in effect, except it is now copying over the values of the new fields to the old fields. Switch over all BigQuery reporting scripts to use the new fields. Deploy. 4. Remove all of the old code and indexes. Deploy. 5. (Optional, at our leisure) Re-run the ResaveAllEppResourcesAction backfill [] to delete the old obsolete fields. Note that this migration strategy is rollback-safe at every step -- new data is not read until it has already been written out in the previous step, and old data is not removed immediately following a step in which it was still being read, so the previous step is safe to roll back to. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=136196988
46 lines
1.5 KiB
Java
46 lines
1.5 KiB
Java
// Copyright 2016 The Nomulus Authors. All Rights Reserved.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
package google.registry.model.domain;
|
|
|
|
import com.googlecode.objectify.Key;
|
|
import com.googlecode.objectify.annotation.Embed;
|
|
import com.googlecode.objectify.annotation.Index;
|
|
import google.registry.model.EppResource;
|
|
import google.registry.model.ImmutableObject;
|
|
|
|
/**
|
|
* Legacy shell of a "union" type to represent referenced objects as either a foreign key or as a
|
|
* link to another object in the datastore. In its current form it merely wraps a {@link Key}.
|
|
*
|
|
* @param <T> the type being referenced
|
|
*/
|
|
// TODO(b/28713909): Delete ReferenceUnion entirely.
|
|
@Embed
|
|
@Deprecated
|
|
public class ReferenceUnion<T extends EppResource> extends ImmutableObject {
|
|
|
|
@Index
|
|
Key<T> linked;
|
|
|
|
public Key<T> getLinked() {
|
|
return linked;
|
|
}
|
|
|
|
public static <T extends EppResource> ReferenceUnion<T> create(Key<T> linked) {
|
|
ReferenceUnion<T> instance = new ReferenceUnion<>();
|
|
instance.linked = linked;
|
|
return instance;
|
|
}
|
|
}
|