Skip to content

Commit 2de46c7

Browse files
authored
Merge pull request #26 from oxford-pharmacoepi/dev_mk
Adding TABLESPACE to HES curation files
2 parents be44e64 + d52383e commit 2de46c7

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

sql_scripts/1d_hesae_curation.sql

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ DROP TABLE IF EXISTS {SOURCE_NOK_SCHEMA}.hesae_patient CASCADE;
22

33

44
-- PATIENT - Move unacceptable patient from source_hesapc.patient to source_hesapc_nok.patient
5-
CREATE TABLE {SOURCE_NOK_SCHEMA}.hesae_patient (LIKE {SOURCE_SCHEMA}.hesae_patient);
5+
CREATE TABLE {SOURCE_NOK_SCHEMA}.hesae_patient (LIKE {SOURCE_SCHEMA}.hesae_patient) TABLESPACE pg_default;
66

77
WITH cte1 as (
88
SELECT patid FROM {SOURCE_SCHEMA}.hesae_patient
@@ -15,7 +15,7 @@ SELECT t1.*
1515
FROM {SOURCE_SCHEMA}.hesae_patient as t1
1616
INNER JOIN cte1 on cte1.patid = t1.patid;
1717

18-
alter table {SOURCE_NOK_SCHEMA}.hesae_patient add constraint pk_patient_nok primary key (patid);
18+
alter table {SOURCE_NOK_SCHEMA}.hesae_patient add constraint pk_patient_nok primary key (patid) USING INDEX TABLESPACE pg_default;
1919

2020
DELETE FROM {SOURCE_SCHEMA}.hesae_patient as t1
2121
USING {SOURCE_NOK_SCHEMA}.hesae_patient as t2

sql_scripts/1d_hesapc_curation.sql

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ DROP TABLE IF EXISTS {SOURCE_NOK_SCHEMA}.hes_primary_diag_hosp CASCADE;
1111
DROP TABLE IF EXISTS {SOURCE_NOK_SCHEMA}.hes_procedures_epi CASCADE;
1212

1313
-- PATIENT - Move unacceptable patient from source_hesapc.patient to source_hesapc_nok.patient
14-
CREATE TABLE {SOURCE_NOK_SCHEMA}.hes_patient (LIKE {SOURCE_SCHEMA}.hes_patient);
14+
CREATE TABLE {SOURCE_NOK_SCHEMA}.hes_patient (LIKE {SOURCE_SCHEMA}.hes_patient) TABLESPACE pg_default;
1515

1616
WITH cte1 as (
1717
SELECT patid FROM {SOURCE_SCHEMA}.hes_patient
@@ -24,7 +24,7 @@ SELECT t1.*
2424
FROM {SOURCE_SCHEMA}.hes_patient as t1
2525
INNER JOIN cte1 on cte1.patid = t1.patid;
2626

27-
alter table {SOURCE_NOK_SCHEMA}.hes_patient add constraint pk_patient_nok primary key (patid);
27+
alter table {SOURCE_NOK_SCHEMA}.hes_patient add constraint pk_patient_nok primary key (patid) USING INDEX TABLESPACE pg_default;
2828

2929
DELETE FROM {SOURCE_SCHEMA}.hes_patient as t1
3030
USING {SOURCE_NOK_SCHEMA}.hes_patient as t2

sql_scripts/1d_hesop_curation.sql

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ DROP TABLE IF EXISTS {SOURCE_NOK_SCHEMA}.hesop_appointment CASCADE;
33

44

55
-- PATIENT - Move unacceptable patient from source_hesapc.patient to source_hesapc_nok.patient
6-
CREATE TABLE {SOURCE_NOK_SCHEMA}.hesop_patient (LIKE {SOURCE_SCHEMA}.hesop_patient);
6+
CREATE TABLE {SOURCE_NOK_SCHEMA}.hesop_patient (LIKE {SOURCE_SCHEMA}.hesop_patient) TABLESPACE pg_default;
77

88
WITH cte1 as (
99
SELECT patid FROM {SOURCE_SCHEMA}.hesop_patient
@@ -16,7 +16,7 @@ SELECT t1.*
1616
FROM {SOURCE_SCHEMA}.hesop_patient as t1
1717
INNER JOIN cte1 on cte1.patid = t1.patid;
1818

19-
alter table {SOURCE_NOK_SCHEMA}.hesop_patient add constraint pk_patient_nok primary key (patid);
19+
alter table {SOURCE_NOK_SCHEMA}.hesop_patient add constraint pk_patient_nok primary key (patid) USING INDEX TABLESPACE pg_default;
2020

2121
DELETE FROM {SOURCE_SCHEMA}.hesop_patient as t1
2222
USING {SOURCE_NOK_SCHEMA}.hesop_patient as t2

0 commit comments

Comments
 (0)