mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-05-18 19:46:12 -04:00
Redo the update for User_Preferences. Sourcing User_Preferences.sql drops the table, losing contents.
This commit is contained in:
39
db/zm_update-1.37.38.sql
Normal file
39
db/zm_update-1.37.38.sql
Normal file
@@ -0,0 +1,39 @@
|
||||
--
|
||||
-- This adds Manufacturers and Models
|
||||
--
|
||||
|
||||
SET @s = (SELECT IF(
|
||||
(SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.TABLES
|
||||
WHERE table_name = 'User_Preferences'
|
||||
AND table_schema = DATABASE()
|
||||
) > 0,
|
||||
"SELECT 'User_Preferences table exists'",
|
||||
"
|
||||
CREATE TABLE `User_Preferences` (
|
||||
`Id` int(10) unsigned NOT NULL auto_increment,
|
||||
`UserId` int(10) unsigned NOT NULL,
|
||||
FOREIGN KEY (UserId) REFERENCES Users(Id),
|
||||
`Name` varchar(64),
|
||||
`Value` TEXT,
|
||||
PRIMARY KEY (Id)
|
||||
)
|
||||
"
|
||||
));
|
||||
|
||||
PREPARE stmt FROM @s;
|
||||
EXECUTE stmt;
|
||||
|
||||
SET @s = (SELECT IF(
|
||||
(SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.STATISTICS
|
||||
WHERE table_name = 'User_Preferences'
|
||||
AND table_schema = DATABASE()
|
||||
AND index_name = 'User_Preferences_UserID_idx'
|
||||
) > 0,
|
||||
"SELECT 'UserId Index already exists on User_Preferences table'",
|
||||
"CREATE INDEX User_Preferences_UserID_idx on User_Preferences (`UserId`)"
|
||||
));
|
||||
|
||||
PREPARE stmt FROM @s;
|
||||
EXECUTE stmt;
|
||||
@@ -1 +0,0 @@
|
||||
source @PKGDATADIR@/db/User_Preferences.sql
|
||||
39
db/zm_update-1.37.47.sql
Normal file
39
db/zm_update-1.37.47.sql
Normal file
@@ -0,0 +1,39 @@
|
||||
--
|
||||
-- This adds Manufacturers and Models
|
||||
--
|
||||
|
||||
SET @s = (SELECT IF(
|
||||
(SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.TABLES
|
||||
WHERE table_name = 'User_Preferences'
|
||||
AND table_schema = DATABASE()
|
||||
) > 0,
|
||||
"SELECT 'User_Preferences table exists'",
|
||||
"
|
||||
CREATE TABLE `User_Preferences` (
|
||||
`Id` int(10) unsigned NOT NULL auto_increment,
|
||||
`UserId` int(10) unsigned NOT NULL,
|
||||
FOREIGN KEY (UserId) REFERENCES Users(Id),
|
||||
`Name` varchar(64),
|
||||
`Value` TEXT,
|
||||
PRIMARY KEY (Id)
|
||||
)
|
||||
"
|
||||
));
|
||||
|
||||
PREPARE stmt FROM @s;
|
||||
EXECUTE stmt;
|
||||
|
||||
SET @s = (SELECT IF(
|
||||
(SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.STATISTICS
|
||||
WHERE table_name = 'User_Preferences'
|
||||
AND table_schema = DATABASE()
|
||||
AND index_name = 'User_Preferences_UserID_idx'
|
||||
) > 0,
|
||||
"SELECT 'UserId Index already exists on User_Preferences table'",
|
||||
"CREATE INDEX User_Preferences_UserID_idx on User_Preferences (`UserId`)"
|
||||
));
|
||||
|
||||
PREPARE stmt FROM @s;
|
||||
EXECUTE stmt;
|
||||
Reference in New Issue
Block a user