Use composite primary key for DomainHistory (#767)

* Use composite primary key for DomainHistory

* Move History table's SequenceGenerator to orm.xml

* Rebase on HEAD and remove default value for key in History tables

* Use primitive type for id.

* Revert the cache change
This commit is contained in:
Shicong Huang 2020-09-03 10:21:23 -04:00 committed by GitHub
parent b177532d58
commit b34da92f42
10 changed files with 219 additions and 78 deletions

View file

@ -11,7 +11,7 @@
-- 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.
create sequence history_id_sequence start 1 increment 1;
create sequence history_id_sequence start 1 increment 50;
create table "AllocationToken" (
token text not null,
@ -286,7 +286,8 @@ create sequence history_id_sequence start 1 increment 1;
);
create table "DomainHistory" (
history_revision_id int8 not null,
domain_repo_id text not null,
history_revision_id int8 not null,
history_by_superuser boolean not null,
history_registrar_id text,
history_modification_time timestamptz not null,
@ -341,12 +342,12 @@ create sequence history_id_sequence start 1 increment 1;
last_epp_update_time timestamptz,
statuses text[],
update_timestamp timestamptz,
domain_repo_id text not null,
primary key (history_revision_id)
primary key (domain_repo_id, history_revision_id)
);
create table "DomainHistoryHost" (
domain_history_history_revision_id int8 not null,
domain_history_domain_repo_id text not null,
domain_history_history_revision_id int8 not null,
host_repo_id text
);
@ -644,8 +645,8 @@ create index spec11threatmatch_check_date_idx on "Spec11ThreatMatch" (check_date
references "ClaimsList";
alter table if exists "DomainHistoryHost"
add constraint FK378h8v3j8qd8xtjn2e0bcmrtj
foreign key (domain_history_history_revision_id)
add constraint FKa9woh3hu8gx5x0vly6bai327n
foreign key (domain_history_domain_repo_id, domain_history_history_revision_id)
references "DomainHistory";
alter table if exists "DomainHost"