For MSSQL, several schema changes got merged trying to declare various columns as "unsigned". MSSQL, like PostgreSQL, does not support unsigned integer types (although its tinyint type is unsigned and cannot be made signed). Also for MSSQL, we need to rearrange the MCR tables so the targets of foreign key references are defined before the FKs themselves. And the MSSQL had a few naming errors. For Oracle, two schema changes were merged using incorrect syntax for adding and modifying columns. And there was a typo. Bug: T183486 Change-Id: I0511fb7fc9a59ab5a5eae7db810b3a52ddc8376b
25 lines
1,023 B
SQL
25 lines
1,023 B
SQL
--
|
|
-- Slots represent an n:m relation between revisions and content objects.
|
|
-- A content object can have a specific "role" in one or more revisions.
|
|
-- Each revision can have multiple content objects, each having a different role.
|
|
--
|
|
CREATE TABLE /*_*/slots (
|
|
|
|
-- reference to rev_id
|
|
slot_revision_id bigint NOT NULL,
|
|
|
|
-- reference to role_id
|
|
slot_role_id smallint NOT NULL CONSTRAINT FK_slots_slot_role FOREIGN KEY REFERENCES slot_roles(role_id),
|
|
|
|
-- reference to content_id
|
|
slot_content_id bigint NOT NULL CONSTRAINT FK_slots_content_id FOREIGN KEY REFERENCES content(content_id),
|
|
|
|
-- The revision ID of the revision that originated the slot's content.
|
|
-- To find revisions that changed slots, look for slot_origin = slot_revision_id.
|
|
slot_origin bigint NOT NULL,
|
|
|
|
CONSTRAINT PK_slots PRIMARY KEY (slot_revision_id, slot_role_id)
|
|
);
|
|
|
|
-- Index for finding revisions that modified a specific slot
|
|
CREATE INDEX /*i*/slot_revision_origin_role ON /*_*/slots (slot_revision_id, slot_origin, slot_role_id);
|