wisest owl (wisest_owl) wrote in changelog,
wisest owl
wisest_owl
changelog

[livejournal] r17749: LJSUP-7052. Fix "create table category" ...

Committer: gprochaev
LJSUP-7052. Fix "create table category" to actual table. Change unique key.

U   trunk/bin/upgrading/update-db-general.pl
Modified: trunk/bin/upgrading/update-db-general.pl
===================================================================
--- trunk/bin/upgrading/update-db-general.pl	2010-11-23 04:11:22 UTC (rev 17748)
+++ trunk/bin/upgrading/update-db-general.pl	2010-11-23 04:41:29 UTC (rev 17749)
@@ -3255,9 +3255,10 @@
    pretty_name VARCHAR(255) NOT NULL,
    url_path    VARCHAR(120) NOT NULL,
    parentcatid INT UNSIGNED,
+   vert_id     INT NOT NULL,
    PRIMARY KEY (catid),
-   INDEX       (url_path),
-   INDEX       (parentcatid)
+   UNIQUE KEY  url_path (url_path,parentcatid,vert_id),
+   KEY         (parentcatid)
 )
 EOC
 
@@ -4260,13 +4261,6 @@
                  "MODIFY jtalkid INT UNSIGNED NOT NULL");
     }
 
-    # no row should have the same url_path and parentcatid
-    unless (index_name("category", "UNIQUE:url_path-parentcatid")) {
-        do_alter("category", "ALTER IGNORE TABLE category ".
-                 "DROP KEY `url_path`, ".
-                 "ADD UNIQUE `url_path` (url_path, parentcatid)");
-    }
-
     # add an index on 'country' column
     unless (index_name("schools_pending", "INDEX:country")) {
         do_alter("schools_pending",
@@ -4326,7 +4320,15 @@
         do_alter("vertical_keywords",
             "ALTER TABLE vertical_keywords ADD PRIMARY KEY(kw_id), ADD UNIQUE(keyword), MODIFY kw_id INT NOT NULL AUTO_INCREMENT");
     }
+    
+    ## category may have the same path in different verticals
+    unless (index_name("category", "UNIQUE:url_path-parentcatid-vert_id")) {
+        do_alter("category", "ALTER IGNORE TABLE category ".
+                 "DROP KEY `url_path`, ".
+                 "ADD UNIQUE `url_path` (url_path, parentcatid, vert_id)");
+    }
 
+
 });
 
 register_tablecreate("eventrates", <<'EOC'); # clustered

Tags: livejournal, pl, wisest-owl
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments