Pandora-IsoMemo / iso-data

ETL for IsoMemo Database
https://pandora-isomemo.github.io/iso-data/
GNU General Public License v3.0
1 stars 0 forks source link

Add new column to tables #7

Closed arunge closed 1 year ago

arunge commented 1 year ago

@jan-abel-inwt As discussed, we need one new column in several tables on the server. Please add a new first column

`mappingId` varchar(50) NOT NULL

to following tables: extraCharacter, extraNumeric, mapping, updated, warning. For all rows the value of this column should be "IsoMemo" as it is used within the app right now:

image

Additionally, can you already now make a copy of the table data with the new name "IsoMemo_data". Then I can update the ETL respectively.

Can you check if the tables mentioned above are all that you can see on the server? That is, if we have not overseen something? Thanks!

I will add respective entries to the schema.sql in the repo.

Originally posted by @arunge in https://github.com/Pandora-IsoMemo/iso-data/issues/4#issuecomment-1448096134

jan-abel-inwt commented 1 year ago

Add new column

# Add new column
ALTER TABLE mpiIso.extraCharacter
ADD `mappingId` varchar(50) NOT NULL;

ALTER TABLE mpiIso.extraNumeric
ADD `mappingId` varchar(50) NOT NULL;

ALTER TABLE mpiIso.mapping
ADD `mappingId` varchar(50) NOT NULL;

ALTER TABLE mpiIso.updated
ADD `mappingId` varchar(50) NOT NULL;

ALTER TABLE mpiIso.warning
ADD `mappingId` varchar(50) NOT NULL;

# Fill new column with key value
UPDATE mpiIso.extraCharacter
SET mappingId = "IsoMemo";

UPDATE mpiIso.extraNumeric 
SET mappingId = "IsoMemo";

UPDATE mpiIso.mapping 
SET mappingId = "IsoMemo";

UPDATE mpiIso.updated 
SET mappingId = "IsoMemo";

UPDATE mpiIso.warning 
SET mappingId = "IsoMemo";

copy data table

USE mpiIso;

# Empty table with same structure
CREATE TABLE IsoMemo_data LIKE mpiIso.data;

# Copy data
INSERT INTO IsoMemo_data
SELECT *
FROM data;