                            FOREIGN KEY (table_id)
                              REFERENCES pcr_tables (id)
 ) AUTO_INCREMENT=1 COMMENT 'represents the transaction log of all core table entries';
-
-CREATE TABLE pcr_tables (
-                          id bigint  AUTO_INCREMENT PRIMARY KEY,
-                          table_name VARCHAR(255)
-) COMMENT ''
-
-
-
 
 CREATE TABLE patient_address (
                                id int NOT NULL,

                       owning_organisation_id int COMMENT 'refers to the organisation that owns/manages the event',
                       status_concept_id bigint NOT NULL COMMENT 'refers to information model, giving the event status (e.g. active, final, pending, amended, corrected, deleted)',
                       is_confidential boolean NOT NULL COMMENT 'indicates this is a confidential event',
                       original_code varchar(20) COLLATE utf8_bin DEFAULT NULL,
                       original_concept varchar(1000) DEFAULT NULL,
                       original_code_scheme varchar(20) DEFAULT NULL,
                       substance_concept_id bigint COMMENT 'concept representing the substance (as opposed to the allergy code, which is on the observation table)',
                       manifestation_concept_id bigint COMMENT 'concept stating how this allergy manifests itself (e.g. rash, anaphylactic shock)',
                       manifestation_free_text_id bigint COMMENT 'links to free text record to give textual description of the manifestation',
                       is_consent boolean NOT NULL COMMENT 'whether consent or dissent',


                       PRIMARY KEY (patient_id, id),
                       CONSTRAINT allergy_manifestation_free_text_id
                         FOREIGN KEY (patient_id, manifestation_free_text_id)

                                owning_organisation_id int COMMENT 'refers to the organisation that owns/manages the event',
                                status_concept_id bigint NOT NULL COMMENT 'refers to information model, giving the event status (e.g. active, final, pending, amended, corrected, deleted)',
                                is_confidential boolean NOT NULL COMMENT 'indicates this is a confidential event',
	                            original_code varchar(20) COLLATE utf8_bin DEFAULT NULL,
    	                       original_term varchar(1000) DEFAULT NULL,
        	                   original_code_scheme tinyint DEFAULT NULL COMMENT 'Original code scheme - 0=READ2, 1=READ3, 2=SnomedCT, 3=ICD-10, 4=OPCS-4, 5=MILLENNIUM',
            	               original_system tinyint DEFAULT NULL COMMENT 'Original system - 0=EMIS, 1=TPP, 2=VISION, 3=CERNER',
                               type_concept_id bigint NOT NULL COMMENT 'refers to information model to give the prescription type (e.g. Acute, Repeat, RepeatDispensing)',
                                medication_statement_id bigint COMMENT 'refers to the medication_statement table',
                                medication_amount_id bigint COMMENT 'refers to the medication_amount table for the dose and quantity',
                                patient_instructions_free_text_id bigint COMMENT 'links to free text entry giving additional patient instructions',
