Forums | Mahara Community

Support /
Upgrade from 1.1.7 to 1.2.2 fails


anonymous profile picture
Account deleted
Posts: 1

06 January 2010, 8:08

Hi *,

when trying to upgrade 1.1.7 to 1.2.2 I get a postgresql error:

Relation »mahara_arteblogblogfile_blofil_pk« does not exist

This is the description of the table mahara_artefact_blog_blogpost_file:

mahara=# \d mahara_artefact_blog_blogpost_file
Tabelle »public.mahara_artefact_blog_blogpost_file«
  Spalte  |  Typ   | Attribute
----------+--------+-----------
 blogpost | bigint | not null
 file     | bigint | not null
Indexe:
    »mahara_arteblogblogfile_blo_pk« PRIMARY KEY, btree (blogpost, file)
    »mahara_arteblogblogfile_blo_ix« btree (blogpost)
    »mahara_arteblogblogfile_fil_ix« btree (file)
Fremdschlüssel-Constraints:
    »mahara_arteblogblogfile_blo_fk« FOREIGN KEY (blogpost) REFERENCES mahara_artefact(id)
    »mahara_arteblogblogfile_fil_fk« FOREIGN KEY (file) REFERENCES mahara_artefact(id)

The related code from upgrade.php (line 904ff) is:

     if ($oldversion < 2009031800) {

        // Files can only attach blogpost artefacts, but we would like to be able to attach them
        // to other stuff.  Rename the existing attachment table artefact_blog_blogpost_file to
        // artefact_file_attachment so we don't end up with many tables doing the same thing.
        execute_sql("ALTER TABLE {artefact_blog_blogpost_file} RENAME TO {artefact_attachment}");

        if (is_postgres()) {
            // Ensure all of the indexes and constraints are renamed
            execute_sql("
            ALTER TABLE {artefact_attachment} RENAME blogpost TO artefact;
            ALTER TABLE {artefact_attachment} RENAME file TO attachment;

            ALTER INDEX {arteblogblogfile_blofil_pk} RENAME TO {arteatta_artatt_pk};
            ALTER INDEX {arteblogblogfile_blo_ix} RENAME TO {arteatta_art_ix};
            ALTER INDEX {arteblogblogfile_fil_ix} RENAME TO {arteatta_att_ix};

            ALTER TABLE {artefact_attachment} DROP CONSTRAINT {arteblogblogfile_blo_fk};
            ALTER TABLE {artefact_attachment} ADD CONSTRAINT {arteatta_art_fk} FOREIGN KEY (artefact) REFERENCES {artefact}(id);

            ALTER TABLE {artefact_attachment} DROP CONSTRAINT {arteblogblogfile_fil_fk};
            ALTER TABLE {artefact_attachment} ADD CONSTRAINT {arteatta_att_fk} FOREIGN KEY (attachment) REFERENCES {artefact}(id);
            ");
        }

Can I safely change arteblogblogfile_blofil_pk to arteblogblogfile_blo_pk in upgrade.php?

Does anybody else also had some troubles like that?

Thanks in advance

Stephan

1 result