From 59db7cfc857cfa687f804706140c7464529dd8a1 Mon Sep 17 00:00:00 2001 From: markus Date: Sat, 30 Jan 2021 16:51:21 +0100 Subject: [PATCH] fix: rename postgresql constraints --- .../ddl/6_constraint_fk_humidities_sensor_id.down.sql | 9 +++++++++ .../ddl/6_constraint_fk_humidities_sensor_id.up.sql | 9 +++++++++ .../ddl/7_constraint_fk_pressures_sensor_id.down.sql | 9 +++++++++ .../ddl/7_constraint_fk_pressures_sensor_id.up.sql | 9 +++++++++ 4 files changed, 36 insertions(+) create mode 100644 pkg/repository/db/postgres/ddl/6_constraint_fk_humidities_sensor_id.down.sql create mode 100644 pkg/repository/db/postgres/ddl/6_constraint_fk_humidities_sensor_id.up.sql create mode 100644 pkg/repository/db/postgres/ddl/7_constraint_fk_pressures_sensor_id.down.sql create mode 100644 pkg/repository/db/postgres/ddl/7_constraint_fk_pressures_sensor_id.up.sql diff --git a/pkg/repository/db/postgres/ddl/6_constraint_fk_humidities_sensor_id.down.sql b/pkg/repository/db/postgres/ddl/6_constraint_fk_humidities_sensor_id.down.sql new file mode 100644 index 0000000..a4d1353 --- /dev/null +++ b/pkg/repository/db/postgres/ddl/6_constraint_fk_humidities_sensor_id.down.sql @@ -0,0 +1,9 @@ +ALTER TABLE humidities +DROP CONSTRAINT fk_humidites_sensor_id; + +ALTER TABLE humidities +ADD CONSTRAINT pk_humidites_sensor_id +FOREIGN KEY (sensor_id) +REFERENCES sensors(sensor_id) +ON DELETE CASCADE +ON UPDATE CASCADE; \ No newline at end of file diff --git a/pkg/repository/db/postgres/ddl/6_constraint_fk_humidities_sensor_id.up.sql b/pkg/repository/db/postgres/ddl/6_constraint_fk_humidities_sensor_id.up.sql new file mode 100644 index 0000000..999e793 --- /dev/null +++ b/pkg/repository/db/postgres/ddl/6_constraint_fk_humidities_sensor_id.up.sql @@ -0,0 +1,9 @@ +ALTER TABLE humidities +DROP CONSTRAINT pk_humidites_sensor_id; + +ALTER TABLE humidities +ADD CONSTRAINT fk_humidites_sensor_id +FOREIGN KEY (sensor_id) +REFERENCES sensors(sensor_id) +ON DELETE CASCADE +ON UPDATE CASCADE; \ No newline at end of file diff --git a/pkg/repository/db/postgres/ddl/7_constraint_fk_pressures_sensor_id.down.sql b/pkg/repository/db/postgres/ddl/7_constraint_fk_pressures_sensor_id.down.sql new file mode 100644 index 0000000..fa7c7a4 --- /dev/null +++ b/pkg/repository/db/postgres/ddl/7_constraint_fk_pressures_sensor_id.down.sql @@ -0,0 +1,9 @@ +ALTER TABLE pressures +DROP CONSTRAINT fk_pressures_sensor_id; + +ALTER TABLE pressures +ADD CONSTRAINT pk_pressures_sensor_id +FOREIGN KEY (sensor_id) +REFERENCES sensors(sensor_id) +ON DELETE CASCADE +ON UPDATE CASCADE; \ No newline at end of file diff --git a/pkg/repository/db/postgres/ddl/7_constraint_fk_pressures_sensor_id.up.sql b/pkg/repository/db/postgres/ddl/7_constraint_fk_pressures_sensor_id.up.sql new file mode 100644 index 0000000..3460754 --- /dev/null +++ b/pkg/repository/db/postgres/ddl/7_constraint_fk_pressures_sensor_id.up.sql @@ -0,0 +1,9 @@ +ALTER TABLE pressures +DROP CONSTRAINT pk_pressures_sensor_id; + +ALTER TABLE pressures +ADD CONSTRAINT fk_pressures_sensor_id +FOREIGN KEY (sensor_id) +REFERENCES sensors(sensor_id) +ON DELETE CASCADE +ON UPDATE CASCADE; \ No newline at end of file