<commit_before>USE subscriber_transform_???? -- db name varies

DROP TABLE IF EXISTS enterprise_id_map;
DROP TABLE IF EXISTS enterprise_organisation_id_map;
DROP TABLE IF EXISTS household_id_map;
DROP TABLE IF EXISTS pseudo_id_map;
DROP TABLE IF EXISTS enterprise_age;
DROP TABLE IF EXISTS enterprise_person_id_map;
DROP TABLE IF EXISTS enterprise_person_update_history;
DROP TABLE IF EXISTS exchange_batch_extra_resources;
DROP TABLE IF EXISTS enterprise_instance_map;
DROP TABLE IF EXISTS vitru_care_patient_id_map;

CREATE TABLE enterprise_id_map
(
  resource_type varchar(50) NOT NULL,
  resource_id char(36) NOT NULL,
  enterprise_id bigint NOT NULL,
  CONSTRAINT pk_enterprise_id_map PRIMARY KEY (resource_id, resource_type)
);

-- this unique index is required to make the column auto-increment
CREATE UNIQUE INDEX uix_enterprise_id_map_auto_increment
ON enterprise_id_map (enterprise_id);

ALTER TABLE enterprise_id_map MODIFY COLUMN enterprise_id INT auto_increment;



CREATE TABLE enterprise_organisation_id_map
(
  service_id char(36) NOT NULL,
  enterprise_id bigint NOT NULL,
  CONSTRAINT pk_enterprise_organisation_id_map PRIMARY KEY (service_id)
);


CREATE TABLE household_id_map
(
  postcode char(8) NOT NULL,
  line_1 varchar(255) NOT NULL,
  line_2 varchar(255) NOT NULL,
  household_id bigint NOT NULL,
  CONSTRAINT pk_household_id_map PRIMARY KEY (postcode, line_1, line_2)
);

-- this unique index is required to make the column auto-increment
CREATE UNIQUE INDEX uix_household_id_map_auto_increment
ON household_id_map (household_id);

ALTER TABLE household_id_map MODIFY COLUMN household_id INT auto_increment;


CREATE TABLE pseudo_id_map
(
  patient_id char(36) NOT NULL PRIMARY KEY,
  pseudo_id varchar(255) NOT NULL
);

create index ix_pseudo_id_map_pseudo_id on subscriber_transform_pseudo.pseudo_id_map(pseudo_id);

CREATE TABLE enterprise_age
(
  enterprise_patient_id bigint NOT NULL PRIMARY KEY,<commit_msg>Fix to db SQL file<commit_after>USE subscriber_transform_???? -- db name varies

DROP TABLE IF EXISTS enterprise_id_map;
DROP TABLE IF EXISTS enterprise_organisation_id_map;
DROP TABLE IF EXISTS household_id_map;
DROP TABLE IF EXISTS pseudo_id_map;
DROP TABLE IF EXISTS enterprise_age;
DROP TABLE IF EXISTS enterprise_person_id_map;
DROP TABLE IF EXISTS enterprise_person_update_history;
DROP TABLE IF EXISTS exchange_batch_extra_resources;
DROP TABLE IF EXISTS enterprise_instance_map;
DROP TABLE IF EXISTS vitru_care_patient_id_map;

CREATE TABLE enterprise_id_map
(
  resource_type varchar(50) NOT NULL,
  resource_id char(36) NOT NULL,
  enterprise_id bigint NOT NULL,
  CONSTRAINT pk_enterprise_id_map PRIMARY KEY (resource_id, resource_type)
);

-- this unique index is required to make the column auto-increment
CREATE UNIQUE INDEX uix_enterprise_id_map_auto_increment
ON enterprise_id_map (enterprise_id);

ALTER TABLE enterprise_id_map MODIFY COLUMN enterprise_id INT auto_increment;



CREATE TABLE enterprise_organisation_id_map
(
  service_id char(36) NOT NULL,
  enterprise_id bigint NOT NULL,
  CONSTRAINT pk_enterprise_organisation_id_map PRIMARY KEY (service_id)
);


CREATE TABLE household_id_map
(
  postcode char(8) NOT NULL,
  line_1 varchar(255) NOT NULL,
  line_2 varchar(255) NOT NULL,
  household_id bigint NOT NULL,
  CONSTRAINT pk_household_id_map PRIMARY KEY (postcode, line_1, line_2)
);

-- this unique index is required to make the column auto-increment
CREATE UNIQUE INDEX uix_household_id_map_auto_increment
ON household_id_map (household_id);

ALTER TABLE household_id_map MODIFY COLUMN household_id INT auto_increment;


CREATE TABLE pseudo_id_map
(
  patient_id char(36) NOT NULL PRIMARY KEY,
  pseudo_id varchar(255) NOT NULL
);

create index ix_pseudo_id_map_pseudo_id on pseudo_id_map(pseudo_id);

CREATE TABLE enterprise_age
(
  enterprise_patient_id bigint NOT NULL PRIMARY KEY,
{'fraction_non_alphanumeric': 0.04431199792692407, 'fraction_numerical': 0.011401917595231926, 'mean_word_length': 6.366412213740458, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2010904', 'n_tokens_mistral': 1336, 'n_tokens_neox': 1270, 'n_words': 393}