-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Perform the drop queries in a procedure to check for existance
Michael Babker
committed
Sep 3, 2014
1 parent
431d5e0
commit 0928782
Showing
1 changed file
with
26 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,31 @@ | ||
# This is a rollup of all database schema changes applied from 3.0.0 to 3.3.x | ||
|
||
ALTER TABLE `#__weblinks` DROP COLUMN `sid`; | ||
ALTER TABLE `#__weblinks` DROP COLUMN `date`; | ||
ALTER TABLE `#__weblinks` DROP COLUMN `archived`; | ||
ALTER TABLE `#__weblinks` DROP COLUMN `approved`; | ||
ALTER TABLE `#__weblinks` ENGINE=InnoDB; | ||
drop procedure if exists weblinks_schema_change; | ||
|
||
delimiter ';;' | ||
create procedure weblinks_schema_change() begin | ||
|
||
/* delete columns if they exist */ | ||
if exists(SELECT * FROM information_schema.columns WHERE table_name = '#__weblinks' AND column_name = 'sid') THEN | ||
ALTER TABLE `#__weblinks` DROP COLUMN `sid`; | ||
end if; | ||
if exists(SELECT * FROM information_schema.columns WHERE table_name = '#__weblinks' AND column_name = 'date') THEN | ||
ALTER TABLE `#__weblinks` DROP COLUMN `date`; | ||
end if; | ||
if exists(SELECT * FROM information_schema.columns WHERE table_name = '#__weblinks' AND column_name = 'archived') THEN | ||
ALTER TABLE `#__weblinks` DROP COLUMN `archived`; | ||
end if; | ||
if exists(SELECT * FROM information_schema.columns WHERE table_name = '#__weblinks' AND column_name = 'approved') THEN | ||
ALTER TABLE `#__weblinks` DROP COLUMN `approved`; | ||
end if; | ||
|
||
end;; | ||
|
||
delimiter ';' | ||
call weblinks_schema_change(); | ||
|
||
drop procedure if exists weblinks_schema_change; | ||
|
||
ALTER TABLE `#__weblinks` ENGINE=InnoDB; | ||
ALTER TABLE `#__weblinks` ADD COLUMN `version` int(10) unsigned NOT NULL DEFAULT '1'; | ||
ALTER TABLE `#__weblinks` ADD COLUMN `images` text NOT NULL; |