Ensure that the database.sql contains "if exists"

This commit is contained in:
Michael 2020-12-02 08:50:45 +00:00
parent c1d1b189f7
commit bd4dc10588
2 changed files with 10 additions and 10 deletions

View File

@ -1485,7 +1485,7 @@ CREATE TABLE IF NOT EXISTS `workerqueue` (
-- --
-- VIEW category-view -- VIEW category-view
-- --
DROP VIEW `category-view`; DROP VIEW IF EXISTS `category-view`;
CREATE VIEW `category-view` AS SELECT CREATE VIEW `category-view` AS SELECT
`post-category`.`uri-id` AS `uri-id`, `post-category`.`uri-id` AS `uri-id`,
`post-category`.`uid` AS `uid`, `post-category`.`uid` AS `uid`,
@ -1502,7 +1502,7 @@ CREATE VIEW `category-view` AS SELECT
-- --
-- VIEW tag-view -- VIEW tag-view
-- --
DROP VIEW `tag-view`; DROP VIEW IF EXISTS `tag-view`;
CREATE VIEW `tag-view` AS SELECT CREATE VIEW `tag-view` AS SELECT
`post-tag`.`uri-id` AS `uri-id`, `post-tag`.`uri-id` AS `uri-id`,
`item-uri`.`uri` AS `uri`, `item-uri`.`uri` AS `uri`,
@ -1520,7 +1520,7 @@ CREATE VIEW `tag-view` AS SELECT
-- --
-- VIEW network-item-view -- VIEW network-item-view
-- --
DROP VIEW `network-item-view`; DROP VIEW IF EXISTS `network-item-view`;
CREATE VIEW `network-item-view` AS SELECT CREATE VIEW `network-item-view` AS SELECT
`item`.`parent-uri-id` AS `uri-id`, `item`.`parent-uri-id` AS `uri-id`,
`item`.`parent-uri` AS `uri`, `item`.`parent-uri` AS `uri`,
@ -1552,7 +1552,7 @@ CREATE VIEW `network-item-view` AS SELECT
-- --
-- VIEW network-thread-view -- VIEW network-thread-view
-- --
DROP VIEW `network-thread-view`; DROP VIEW IF EXISTS `network-thread-view`;
CREATE VIEW `network-thread-view` AS SELECT CREATE VIEW `network-thread-view` AS SELECT
`item`.`uri-id` AS `uri-id`, `item`.`uri-id` AS `uri-id`,
`item`.`uri` AS `uri`, `item`.`uri` AS `uri`,
@ -1583,7 +1583,7 @@ CREATE VIEW `network-thread-view` AS SELECT
-- --
-- VIEW owner-view -- VIEW owner-view
-- --
DROP VIEW `owner-view`; DROP VIEW IF EXISTS `owner-view`;
CREATE VIEW `owner-view` AS SELECT CREATE VIEW `owner-view` AS SELECT
`contact`.`id` AS `id`, `contact`.`id` AS `id`,
`contact`.`uid` AS `uid`, `contact`.`uid` AS `uid`,
@ -1718,7 +1718,7 @@ CREATE VIEW `owner-view` AS SELECT
-- --
-- VIEW pending-view -- VIEW pending-view
-- --
DROP VIEW `pending-view`; DROP VIEW IF EXISTS `pending-view`;
CREATE VIEW `pending-view` AS SELECT CREATE VIEW `pending-view` AS SELECT
`register`.`id` AS `id`, `register`.`id` AS `id`,
`register`.`hash` AS `hash`, `register`.`hash` AS `hash`,
@ -1740,7 +1740,7 @@ CREATE VIEW `pending-view` AS SELECT
-- --
-- VIEW tag-search-view -- VIEW tag-search-view
-- --
DROP VIEW `tag-search-view`; DROP VIEW IF EXISTS `tag-search-view`;
CREATE VIEW `tag-search-view` AS SELECT CREATE VIEW `tag-search-view` AS SELECT
`post-tag`.`uri-id` AS `uri-id`, `post-tag`.`uri-id` AS `uri-id`,
`item`.`id` AS `iid`, `item`.`id` AS `iid`,
@ -1761,7 +1761,7 @@ CREATE VIEW `tag-search-view` AS SELECT
-- --
-- VIEW workerqueue-view -- VIEW workerqueue-view
-- --
DROP VIEW `workerqueue-view`; DROP VIEW IF EXISTS `workerqueue-view`;
CREATE VIEW `workerqueue-view` AS SELECT CREATE VIEW `workerqueue-view` AS SELECT
`process`.`pid` AS `pid`, `process`.`pid` AS `pid`,
`workerqueue`.`priority` AS `priority` `workerqueue`.`priority` AS `priority`

View File

@ -112,9 +112,9 @@ class View
} }
if (self::isView($name)) { if (self::isView($name)) {
$sql = sprintf("DROP VIEW `%s`", DBA::escape($name)); $sql = sprintf("DROP VIEW IF EXISTS `%s`", DBA::escape($name));
} elseif (self::isTable($name)) { } elseif (self::isTable($name)) {
$sql = sprintf("DROP TABLE `%s`", DBA::escape($name)); $sql = sprintf("DROP TABLE IF EXISTS `%s`", DBA::escape($name));
} }
if ($verbose) { if ($verbose) {