Versionen im Vergleich

Schlüssel

  • Diese Zeile wurde hinzugefügt.
  • Diese Zeile wurde entfernt.
  • Formatierung wurde geändert.

...

Codeblock
languagejs
/// <reference path="../../../.vscode.js"/>

const SQL = UM.config.sql;


export default class DbSchemaMigration extends PluginSchemaMigration {
    schemaUpdate_0_1(scr) {
        // Create column for primary attribute "new_attribute":
        this.primaryAddColumn(scr, UM.config.attributes.getAttribute('new_attribute');
 

 }      schemaUpdate_1_2() {
        // CreateAlter column for new table primary attribute's column: according to the current settings from   this.tableAddColumn(scr, UM.config.getAttribute("table_attribute->new_column"));*.attributes file:
    }      schemaUpdate_2_3(scr) {
        let sql = "CREATE VIEW " + SQL.qualifyTable('v_groupmembers') + " AS SELECT "
            + " grp.oid user_oid, 1 pos, user.sid c_userUid, membership.c_joinedAt, membership.c_isManager, membership.c_fromSegment, "
            + " user.firstname c_firstname, user.lastname c_lastname "
            + " FROM  " + SQL.users + " grp, " + SQL.qualifyTable(this.primaryModifyColumn(scr, UM.config.getAttribute('groupMembershipsaltered_attribute').sqlName);
+
" membership, " + SQL.users + " user" // Create           + " WHERE membership.c_groupUid=grp.sid AND user.oid=membership.user_oid";

        scr.add(new SqlQuery(sql));
    }
    
    schemaUpdate_3_4(scr) {column for new table attribute's column:
        this.tableModifyColumntableAddColumn(scr, UM.config.getAttribute("groupNews->link"'table_attribute->new_column'));

   }     //  schemaUpdate_23_24(scr) {
        var SQL = UM.config.sql;
Alter table attribute's column according to the current settings from *.attributes file:
        this.primaryModifyColumntableModifyColumn(scr, UM.config.getAttribute("nid"));

        // Index on users.p_nid
        let createIndex1 = new SqlQuery("CREATE INDEX idx_users_nid ON " + SQL.qualifyTable('users') + " (P_NID)")'table_attribute->altered_column'));
        scr.add(createIndex1); 
        // HBSEDS-871 Fehlende MySQL-Indixe anlegen
        let createIndex2 = new SqlQuery("CREATE INDEX idx_users_address ON " + SQL.qualifyTable('users') + " (address)");
        createIndex2.expectException = true;
        scr.add(createIndex2);

        let createIndex3 = new SqlQuery("CREATE INDEX idx_users_city ON " + SQL.qualifyTable('users') + " (city)");
        createIndex3.expectException = true;
        scr.add(createIndex3);

        let createIndex4 Issue SQL statement to create an INDEX:
        const createIndex1 = new SqlQuery("CREATE`CREATE INDEX idx_users_company ON " + SQL.qualifyTable('users') + " (company)");
        createIndex4.expectException = true;
        scr.add(createIndex4);

        let createIndex5 = new SqlQuery("CREATE INDEX idx_users_country_attr ON " + ${SQL.qualifyTable('users') +} " (country)");
        createIndex5.expectException = true;
        scr.add(createIndex5);

        let createIndex6 = new SqlQuery("CREATE INDEX idx_users_sid ON " + SQL.qualifyTable('users') + " (sid)");
        createIndex6.expectException = true;
        scr.add(createIndex6);

        let createIndex7 = new SqlQuery("CREATE INDEX idx_users_zipcode ON " + SQL.qualifyTable('users') + " (zipcode)");
        createIndex7.expectException = true;
        scr.add(createIndex7);
    }

    schemaUpdate_24_25(scr) {
        var SQL = UM.config.sql;

        // HBSEDS-871 Fehlende MySQL-Indixe anlegen
        let columSpecs = " (keycol, valcol)";
        if (SQL.dbTypeName == 'mysql') {
            columSpecs = " (keycol, valcol(191))";
        }
        let createIndex2 = new SqlQuery("CREATE INDEX idx_users_attr_keycol_valcol ON " + SQL.qualifyTable('users_attr') + columSpecs);
        createIndex2.expectException = true(p_new_attribute)`);
        scr.add(createIndex2createIndex1);
    }

   
schemaUpdate_25_26(scr)
{         this.primaryAddColumn(scr, UM.config.getAttribute("active"));

        letconst update1 = new SqlQuery("UPDATE " + UM.config.sql.`UPDATE ${SQL.qualifyTable('users')} + " SET p_activeentrytype='1user' WHERE p_entrytype='user'" IS NULL`);
        scr.add(update1);
    }
}

// ExportDon't forget to export:
de.pinutsacme.hbsprojectx.eds.DbSchemaMigration = DbSchemaMigration;