Skip to content
Snippets Groups Projects
Commit b73c0e38 authored by ha848myco's avatar ha848myco Committed by Sebastian Kehr
Browse files

refs #16251 [fid_adlr] Adlr specific script to prepare the migration from VUFIND1 data to VUFIND5

* Set the password fields to default value for all rows.
* remove update on missing table column pass_hash
* Note:
** This script contains statements to handle the specific adaptions of the tables for Adlr.
** This script ensures the proper execution of the common migration script migrateData_Vufind1ToVufind5_Common.sql stored in folder module/finc/sql/migrations/mysql.
** First run this Adlr script then run the Common script!
** The scripts have to be executed within a mysql session on the related database.

Co-authored-by: default avatarRobert Lange <robert.lange@uni-leipzig.de>
parent 30960294
No related merge requests found
-- Transform VUFIND1 data tables into the structures of the vufind2 resp. VUFIND5 tables, #16251, HR
-- Part "First_Adlr": Base statements for Adlr based on the common structure of a VUFIND1 database
-- The statements are necessary to let the Common script run properly.
-- Please note:
-- This script only contains the base handling of the Adlr specific structure.
-- First run this Adlr part, then run the Common part (script migrateData_Vufind1ToVufind5_Common.sql in module/finc/sql/migrations/mysql.
-- Written for mysql statements. It should be compatible with MariaDB statements.
-- Run the following table changes on a dump of a VUFIND1 database (e.g. "2019-03-31-vufind_adlr-mysql.sql").
-- Example for import data statements:
-- The dump is imported into database "vufind" by running the following command within a Terminal Window:
-- sudo mysql -h localhost -u root -p -vvf vufind < 2019-03-31-vufind_adlr-mysql.sql
-- Example for running the script:
-- Within a mysql session type
-- source migrateData_Vufind1ToVufind5_First_Adlr.sql
-- - only necessary for an Adlr database dump
-- - for other databases with additinal structure features write a new script for the special things
-- source migrateData_Vufind1ToVufind5_Common.sql
start transaction;
begin;
-- Drop views
-- View "pda_view"
DROP VIEW pda_view;
-- View "registration_view"
DROP VIEW registration_view;
-- View "subito_view"
DROP VIEW subito_view;
-- View "user_view"
DROP VIEW user_view;
-- Drop tables
-- Table "pda"
DROP TABLE pda;
-- Table "registration"
DROP TABLE registration;
-- Table "subito"
DROP TABLE subito;
-- Adapt some default data values to new default values in VUFIND5
UPDATE resource SET source = 'Solr' WHERE source = 'VuFind';
set session sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
UPDATE user SET created = str_to_date('2000-01-01 00:00:00', '%Y-%m-%d %H:%i:%s') WHERE created = '0000-00-00 00:00:00';
UPDATE user_list SET created = str_to_date('2000-01-01 00:00:00', '%Y-%m-%d %H:%i:%s') WHERE created = '0000-00-00 00:00:00';
UPDATE search SET created = str_to_date('2000-01-01 00:00:00', '%Y-%m-%d %H:%i:%s') WHERE created = '0000-00-00 00:00:00';
UPDATE comments SET created = str_to_date('2000-01-01 00:00:00', '%Y-%m-%d %H:%i:%s') WHERE created = '0000-00-00 00:00:00';
UPDATE session SET created = str_to_date('2000-01-01 00:00:00', '%Y-%m-%d %H:%i:%s') WHERE created = '0000-00-00 00:00:00';
UPDATE oai_resumption SET expires = str_to_date('2000-01-01 00:00:00', '%Y-%m-%d %H:%i:%s') WHERE expires = '0000-00-00 00:00:00';
SET session sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,NO_ZERO_IN_DATE,NO_ZERO_DATE';
-- Adapt some tables
-- Table "user"
-- Ensure that the statements will work
ALTER TABLE user
MODIFY COLUMN expiry_date datetime NOT NULL DEFAULT '2000-01-01 00:00:00',
MODIFY COLUMN created datetime NOT NULL DEFAULT '2000-01-01 00:00:00';
-- Drop columns which are not part of the vufind5 structure anymore
ALTER TABLE user
DROP COLUMN liberoid,
DROP COLUMN attention,
DROP COLUMN business_phone,
DROP COLUMN dob,
DROP COLUMN expiry_date,
DROP COLUMN newsletter,
DROP COLUMN occupation,
DROP COLUMN title,
DROP COLUMN postal_address_1,
DROP COLUMN postal_address_2,
DROP COLUMN postal_address_zip,
DROP COLUMN postal_address_city,
DROP COLUMN postal_address_country,
DROP COLUMN residen_address_1,
DROP COLUMN residen_address_2,
DROP COLUMN residen_address_zip,
DROP COLUMN residen_address_city,
DROP COLUMN residen_address_country,
DROP COLUMN check_residen,
DROP COLUMN gender,
DROP COLUMN shibb_verify,
DROP COLUMN blocked,
DROP COLUMN bibid,
DROP COLUMN updated;
-- Fill column "username" with content of column "id"
UPDATE user SET username=id;
-- Set the password columns to default values for all rows
UPDATE user SET password='';
UPDATE user SET cat_password=NULL;
-- Table "search"
-- Clear the table, delete all data.
TRUNCATE search;
-- Table "resource"
-- There is nothing to do.
-- Table "comments"
-- There is nothing to do.
-- Table "change_tracker"
-- There is nothing to do.
-- Table "oai_resumption"
-- There is nothing to do.
-- Table "resource_tags"
-- There is nothing to do.
-- Table "session"
-- There is nothing to do.
-- Table "tags"
-- There is nothing to do.
-- Table "user_list"
-- There is nothing to do.
-- Table "user_resource"
-- There is nothing to do.
commit;
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment