timescaledb/test/sql/updates/setup.constraints.sql
Rob Kiefer 005813da21 Make update tests more composable.
This removes a lot of duplicated code across the two versions of
update tests (one with testing of constraints vs one without) and
potentially allows for further additions more easily. Also, this
splits Travis testing of updates into two jobs so they can run
concurrently and reduce the amount of turnaround time for PRs.
Finally, added versions since 0.8.0 that were not previously being
tested.
2018-08-03 10:07:09 -04:00

17 lines
467 B
SQL

-- Secondary devices table to test foreign keys in "two_Partitions"
CREATE TABLE devices (
id TEXT PRIMARY KEY,
floor INTEGER
);
INSERT INTO devices(id,floor) VALUES
('dev1', 1),
('dev2', 2),
('dev3', 3);
-- Setup "two_Partitions" to use foreign key constraints
ALTER TABLE "two_Partitions" ADD COLUMN device_id_2 TEXT NOT NULL;
ALTER TABLE "two_Partitions" ADD CONSTRAINT two_Partitions_device_id_2_fkey
FOREIGN KEY (device_id_2) REFERENCES devices(id);