-
Notifications
You must be signed in to change notification settings - Fork 447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update upgrade process to support churchinfo 1.3.1 #6896
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,2 @@ | ||
IF NOT EXISTS ( | ||
SELECT NULL | ||
FROM INFORMATION_SCHEMA.COLUMNS | ||
WHERE | ||
table_name = 'events_event' AND | ||
column_name = 'event_publicly_visible' | ||
) THEN | ||
ALTER TABLE `events_event` | ||
ADD COLUMN `event_publicly_visible` BOOLEAN DEFAULT FALSE AFTER `event_grpid`; | ||
END IF; | ||
ALTER TABLE events_event | ||
ADD COLUMN event_publicly_visible BOOLEAN DEFAULT FALSE AFTER event_grpid; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,30 +4,9 @@ MODIFY `cfg_type` ENUM('text','number','date','boolean','textarea','json','choic | |
INSERT IGNORE INTO `config_cfg` (`cfg_id`, `cfg_name`, `cfg_value`, `cfg_type`, `cfg_default`, `cfg_tooltip`, `cfg_section`) VALUES | ||
(1047, 'sChurchCountry', 'United States', 'country', '', 'Church Country', 'ChurchInfoReport'); | ||
|
||
/* make drop column if exists procedure */ | ||
DROP PROCEDURE IF EXISTS DropColumnIfExists; | ||
CREATE PROCEDURE DropColumnIfExists(IN tableName VARCHAR(255), IN columnName VARCHAR(255)) | ||
BEGIN | ||
DECLARE columnExists INT; | ||
|
||
-- Check if the column exists | ||
SELECT COUNT(*) | ||
INTO columnExists | ||
FROM INFORMATION_SCHEMA.COLUMNS | ||
WHERE table_name = tableName AND column_name = columnName; | ||
|
||
-- Drop the column if it exists | ||
IF columnExists > 0 THEN | ||
SET @dropColumnQuery = CONCAT('ALTER TABLE `', tableName, '` DROP COLUMN `', columnName, '`'); | ||
PREPARE stmt FROM @dropColumnQuery; | ||
EXECUTE stmt; | ||
DEALLOCATE PREPARE stmt; | ||
END IF; | ||
END; | ||
|
||
CALL DropColumnIfExists('user_usr', 'usr_BaseFontSize'); | ||
CALL DropColumnIfExists('user_usr', 'usr_Communication'); | ||
CALL DropColumnIfExists('user_usr', 'usr_Workspacewidth'); | ||
alter table user_usr drop column `usr_BaseFontSize`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why was this edited? |
||
alter table user_usr drop column `usr_Communication`; | ||
alter table user_usr drop column `usr_Workspacewidth`; | ||
|
||
ALTER TABLE `user_usr` | ||
CHANGE COLUMN `usr_NeedPasswordChange` `usr_NeedPasswordChange` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1' COMMENT '' , | ||
|
@@ -41,4 +20,3 @@ CHANGE COLUMN `usr_ManageGroups` `usr_ManageGroups` TINYINT(1) UNSIGNED NOT NULL | |
CHANGE COLUMN `usr_Finance` `usr_Finance` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT '' , | ||
CHANGE COLUMN `usr_Admin` `usr_Admin` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT '' ; | ||
|
||
DROP PROCEDURE IF EXISTS DropColumnIfExists; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,7 @@ | ||
DELETE FROM config_cfg WHERE cfg_value = cfg_default; | ||
|
||
/* make drop column if exists procedure */ | ||
DROP PROCEDURE IF EXISTS DropColumnIfExists; | ||
CREATE PROCEDURE DropColumnIfExists(IN tableName VARCHAR(255), IN columnName VARCHAR(255)) | ||
BEGIN | ||
DECLARE columnExists INT; | ||
|
||
-- Check if the column exists | ||
SELECT COUNT(*) | ||
INTO columnExists | ||
FROM INFORMATION_SCHEMA.COLUMNS | ||
WHERE table_name = tableName AND column_name = columnName; | ||
|
||
-- Drop the column if it exists | ||
IF columnExists > 0 THEN | ||
SET @dropColumnQuery = CONCAT('ALTER TABLE `', tableName, '` DROP COLUMN `', columnName, '`'); | ||
PREPARE stmt FROM @dropColumnQuery; | ||
EXECUTE stmt; | ||
DEALLOCATE PREPARE stmt; | ||
END IF; | ||
END; | ||
|
||
CALL DropColumnIfExists('config_cfg', 'cfg_type'); | ||
CALL DropColumnIfExists('config_cfg', 'cfg_default'); | ||
CALL DropColumnIfExists('config_cfg', 'cfg_tooltip'); | ||
CALL DropColumnIfExists('config_cfg', 'cfg_section'); | ||
CALL DropColumnIfExists('config_cfg', 'cfg_category'); | ||
CALL DropColumnIfExists('config_cfg', 'cfg_order'); | ||
CALL DropColumnIfExists('config_cfg', 'cfg_data'); | ||
|
||
DROP PROCEDURE IF EXISTS DropColumnIfExists; | ||
alter table config_cfg drop column `cfg_type`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why was this edited? |
||
alter table config_cfg drop column `cfg_tooltip`; | ||
alter table config_cfg drop column `cfg_section`; | ||
alter table config_cfg drop column `cfg_category`; | ||
alter table config_cfg drop column `cfg_data`; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,5 @@ | ||
/* make add column if not exists procedure */ | ||
DROP PROCEDURE IF EXISTS AddColumnIfNotExists; | ||
CREATE PROCEDURE AddColumnIfNotExists(IN tableName VARCHAR(255), IN columnName VARCHAR(255), IN columnDesc VARCHAR(255)) | ||
BEGIN | ||
DECLARE columnExists INT; | ||
|
||
-- Check if the column exists | ||
SELECT COUNT(*) | ||
INTO columnExists | ||
FROM INFORMATION_SCHEMA.COLUMNS | ||
WHERE table_name = tableName AND column_name = columnName; | ||
|
||
-- Add the column if it doesn't exist | ||
IF columnExists = 0 THEN | ||
SET @addColumnQuery = CONCAT('ALTER TABLE `', tableName, '` ADD COLUMN `', columnName, '` ', columnDesc); | ||
PREPARE stmt FROM @addColumnQuery; | ||
EXECUTE stmt; | ||
DEALLOCATE PREPARE stmt; | ||
END IF; | ||
END; | ||
|
||
CALL AddColumnIfNotExists('group_grp', 'grp_active', 'BOOLEAN NOT NULL DEFAULT 1 AFTER grp_hasSpecialProps'); | ||
CALL AddColumnIfNotExists('group_grp', 'grp_include_email_export', 'BOOLEAN NOT NULL DEFAULT 1 AFTER grp_active'); | ||
ALTER TABLE group_grp ADD grp_active BOOLEAN DEFAULT 1 NOT NULL AFTER grp_hasSpecialProps; | ||
ALTER TABLE group_grp ADD grp_include_email_export BOOLEAN DEFAULT 1 NOT NULL AFTER grp_active; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why was this edited? |
||
|
||
ALTER TABLE queryparameteroptions_qpo | ||
MODIFY qpo_Value VARCHAR(255) NOT NULL DEFAULT ''; | ||
|
@@ -35,6 +14,4 @@ DELETE FROM userconfig_ucfg where ucfg_name = "sFromEmailAddress"; | |
DELETE FROM userconfig_ucfg where ucfg_name = "sFromName"; | ||
DELETE FROM userconfig_ucfg where ucfg_name = "bSendPHPMail"; | ||
|
||
CALL AddColumnIfNotExists('event_attend', 'attend_id', 'INT PRIMARY KEY AUTO_INCREMENT FIRST'); | ||
|
||
DROP PROCEDURE IF EXISTS AddColumnIfNotExists; | ||
ALTER TABLE event_attend ADD COLUMN attend_id INT PRIMARY KEY AUTO_INCREMENT FIRST; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,8 @@ | ||
/* make add column if not exists procedure */ | ||
DROP PROCEDURE IF EXISTS AddColumnIfNotExists; | ||
CREATE PROCEDURE AddColumnIfNotExists(IN tableName VARCHAR(255), IN columnName VARCHAR(255), IN columnDesc VARCHAR(255)) | ||
BEGIN | ||
DECLARE columnExists INT; | ||
|
||
-- Check if the column exists | ||
SELECT COUNT(*) | ||
INTO columnExists | ||
FROM INFORMATION_SCHEMA.COLUMNS | ||
WHERE table_name = tableName AND column_name = columnName; | ||
|
||
-- Add the column if it doesn't exist | ||
IF columnExists = 0 THEN | ||
SET @addColumnQuery = CONCAT('ALTER TABLE `', tableName, '` ADD COLUMN `', columnName, '` ', columnDesc); | ||
PREPARE stmt FROM @addColumnQuery; | ||
EXECUTE stmt; | ||
DEALLOCATE PREPARE stmt; | ||
END IF; | ||
END; | ||
|
||
-- --NOTE-- removed in 4.4.0 so commenting out -- | ||
-- CALL AddColumnIfNotExists('person_per', 'per_FacebookID', 'bigint(20) unsigned default NULL AFTER per_Flags'); | ||
CALL AddColumnIfNotExists('person_per', 'per_Twitter', 'varchar(50) default NULL AFTER per_Flags'); | ||
CALL AddColumnIfNotExists('person_per', 'per_LinkedIn', 'varchar(50) default NULL AFTER per_Twitter'); | ||
ALTER TABLE person_per ADD COLUMN per_Twitter varchar(50) default NULL AFTER per_Flags; | ||
ALTER TABLE person_per ADD COLUMN per_LinkedIn varchar(50) default NULL AFTER per_Twitter; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why was this edited? |
||
|
||
ALTER TABLE person_custom_master | ||
ADD PRIMARY KEY (custom_Field); | ||
|
@@ -64,5 +44,3 @@ CREATE TABLE `church_location_role` ( | |
`role_title` INT NOT NULL, #Thi | ||
PRIMARY KEY (`location_id`, `role_id`) | ||
) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_unicode_ci; | ||
|
||
DROP PROCEDURE IF EXISTS AddColumnIfNotExists; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,7 @@ | ||
/* make add column if not exists procedure */ | ||
DROP PROCEDURE IF EXISTS AddColumnIfNotExists; | ||
CREATE PROCEDURE AddColumnIfNotExists(IN tableName VARCHAR(255), IN columnName VARCHAR(255), IN columnDesc VARCHAR(255)) | ||
BEGIN | ||
DECLARE columnExists INT; | ||
|
||
-- Check if the column exists | ||
SELECT COUNT(*) | ||
INTO columnExists | ||
FROM INFORMATION_SCHEMA.COLUMNS | ||
WHERE table_name = tableName AND column_name = columnName; | ||
|
||
-- Add the column if it doesn't exist | ||
IF columnExists = 0 THEN | ||
SET @addColumnQuery = CONCAT('ALTER TABLE `', tableName, '` ADD COLUMN `', columnName, '` ', columnDesc); | ||
PREPARE stmt FROM @addColumnQuery; | ||
EXECUTE stmt; | ||
DEALLOCATE PREPARE stmt; | ||
END IF; | ||
END; | ||
|
||
CALL AddColumnIfNotExists('events_event', 'location_id', 'INT DEFAULT NULL AFTER `event_typename`'); | ||
CALL AddColumnIfNotExists('events_event', 'primary_contact_person_id', 'INT DEFAULT NULL AFTER `location_id`'); | ||
CALL AddColumnIfNotExists('events_event', 'secondary_contact_person_id', 'INT DEFAULT NULL AFTER `primary_contact_person_id`'); | ||
CALL AddColumnIfNotExists('events_event', 'event_url', 'text DEFAULT NULL AFTER `secondary_contact_person_id`'); | ||
ALTER TABLE events_event ADD COLUMN location_id INT DEFAULT NULL AFTER `event_typename`; | ||
ALTER TABLE events_event ADD COLUMN primary_contact_person_id INT DEFAULT NULL AFTER `location_id`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why was this edited? |
||
ALTER TABLE events_event ADD COLUMN secondary_contact_person_id INT DEFAULT NULL AFTER `primary_contact_person_id`; | ||
ALTER TABLE events_event ADD COLUMN event_url text DEFAULT NULL AFTER `secondary_contact_person_id`; | ||
|
||
DROP TABLE IF EXISTS `event_audience`; | ||
# This is a join-table to link an event with a prospective audience for the purpose of advertising / outreach. | ||
|
@@ -69,5 +48,3 @@ CREATE TABLE `menu_links` ( | |
`linkOrder` INT NOT NULL, | ||
PRIMARY KEY (`linkId`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; | ||
|
||
DROP PROCEDURE IF EXISTS AddColumnIfNotExists; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,3 @@ | ||
/* make add column if not exists procedure */ | ||
DROP PROCEDURE IF EXISTS AddColumnIfNotExists; | ||
CREATE PROCEDURE AddColumnIfNotExists(IN tableName VARCHAR(255), IN columnName VARCHAR(255), IN columnDesc VARCHAR(255)) | ||
BEGIN | ||
DECLARE columnExists INT; | ||
|
||
-- Check if the column exists | ||
SELECT COUNT(*) | ||
INTO columnExists | ||
FROM INFORMATION_SCHEMA.COLUMNS | ||
WHERE table_name = tableName AND column_name = columnName; | ||
|
||
-- Add the column if it doesn't exist | ||
IF columnExists = 0 THEN | ||
SET @addColumnQuery = CONCAT('ALTER TABLE `', tableName, '` ADD COLUMN `', columnName, '` ', columnDesc); | ||
PREPARE stmt FROM @addColumnQuery; | ||
EXECUTE stmt; | ||
DEALLOCATE PREPARE stmt; | ||
END IF; | ||
END; | ||
|
||
CALL AddColumnIfNotExists('user_usr', 'usr_TwoFactorAuthSecret', 'VARCHAR(255) NULL AFTER `usr_Canvasser`'); | ||
CALL AddColumnIfNotExists('user_usr', 'usr_TwoFactorAuthLastKeyTimestamp', 'INT NULL AFTER `usr_TwoFactorAuthSecret`'); | ||
CALL AddColumnIfNotExists('user_usr', 'usr_TwoFactorAuthRecoveryCodes', 'TEXT NULL AFTER `usr_TwoFactorAuthLastKeyTimestamp'); | ||
|
||
DROP PROCEDURE IF EXISTS AddColumnIfNotExists; | ||
ALTER TABLE user_usr ADD COLUMN usr_TwoFactorAuthSecret VARCHAR(255) NULL AFTER `usr_Canvasser`; | ||
ALTER TABLE user_usr ADD COLUMN usr_TwoFactorAuthLastKeyTimestamp INT NULL AFTER `usr_TwoFactorAuthSecret`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why was this edited? |
||
ALTER TABLE user_usr ADD COLUMN usr_TwoFactorAuthRecoveryCodes TEXT NULL AFTER `usr_TwoFactorAuthLastKeyTimestamp`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the same spirit as #6831 , we should make our migrations replayable to avoid issues on re-run