Jump to content
  • 0

MySQL clean-up pr_group_shop


Texxi

Question

Servus

Ich bin (noch) kein Experte, aber langsam bekomme ich auch bei den Datenbanken den Durchblick. Leider konnte ich keine Ressourcen zu meiner Frage finden, deshalb stelle ich sie nun hier.

Ich bin der Meinung, dass pro

<table name="pr_group_shop">

und

<column name="id_shop">x</column>

jeweils nur 1

<column name="id_group">x</column>

zugewiesen werden sollte...
 

 

unverändert:

<?xml version="1.0" encoding="utf-8"?>
<!--
- phpMyAdmin XML Dump
- version 4.4.15.8
- https://www.phpmyadmin.net
-
- Host: sql300.your-server.de
- Generation Time: Jul 05, 2017 at 12:48 PM
- Server version: 5.6.35-1
- PHP Version: 5.3.29
-->

<pma_xml_export version="1.0" xmlns:pma="https://www.phpmyadmin.net/some_doc_url/">
    <!--
    - Structure schemas
    -->
    <pma:structure_schemas>
        <pma:database name="presta" collation="latin1_swedish_ci" charset="latin1">
            <pma:table name="pr_group_shop">
                CREATE TABLE `pr_group_shop` (
                  `id_group` int(11) unsigned NOT NULL,
                  `id_shop` int(11) unsigned NOT NULL,
                  PRIMARY KEY (`id_group`,`id_shop`),
                  KEY `id_shop` (`id_shop`)
                ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
            </pma:table>
        </pma:database>
    </pma:structure_schemas>

    <!--
    - Database: 'presta'
    -->
    <database name="presta">
        <!-- Table pr_group_shop -->
        <table name="pr_group_shop">
            <column name="id_group">1</column>
            <column name="id_shop">1</column>
        </table>
        <table name="pr_group_shop">
            <column name="id_group">2</column>
            <column name="id_shop">1</column>
        </table>
        <table name="pr_group_shop">
            <column name="id_group">3</column>
            <column name="id_shop">1</column>
        </table>
        <table name="pr_group_shop">
            <column name="id_group">4</column>
            <column name="id_shop">1</column>
        </table>
        <table name="pr_group_shop">
            <column name="id_group">1</column>
            <column name="id_shop">2</column>
        </table>
        <table name="pr_group_shop">
            <column name="id_group">2</column>
            <column name="id_shop">2</column>
        </table>
        <table name="pr_group_shop">
            <column name="id_group">3</column>
            <column name="id_shop">2</column>
        </table>
        <table name="pr_group_shop">
            <column name="id_group">4</column>
            <column name="id_shop">2</column>
        </table>
        <table name="pr_group_shop">
            <column name="id_group">1</column>
            <column name="id_shop">5</column>
        </table>
        <table name="pr_group_shop">
            <column name="id_group">2</column>
            <column name="id_shop">5</column>
        </table>
        <table name="pr_group_shop">
            <column name="id_group">3</column>
            <column name="id_shop">5</column>
        </table>
    </database>
</pma_xml_export>

Wir haben Shop Gruppe 1 mit Shop 1 und 2, sowie Shop Gruppe 2 mit Shop 5.

 

Shop 3 und 4 existieren nicht.

 

Ich würde es demnach so kürzen:

<database name="presta">
        <!-- Table pr_group_shop -->
        <table name="pr_group_shop">
            <column name="id_group">1</column>
            <column name="id_shop">1</column>
        </table>
        <table name="pr_group_shop">
            <column name="id_group">1</column>
            <column name="id_shop">2</column>
        </table>
        <table name="pr_group_shop">
            <column name="id_group">2</column>
            <column name="id_shop">5</column>
        </table>
    </database>
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Wir sprechen hier von Kundengruppen und nicht Shopgruppen. Meines Wissens gibt es keine Shopgruppen.

Kundengruppen kann man einem oder mehreren Shops zuweisen.

 

Default sind immer 3 Kundengruppen: Besucher, Gast, Kunde

Diese Gruppen haben in bestimmten Funktionen des Bestellvorgangs Relevanz.

Auch kann man Preise anzeigen oder nicht anzeigen je nach Gruppe, Rabatte gewähren und noch ein paar Dinge mehr.

  • Like 1
Link to comment
Share on other sites

  • 0

Deine Frage ist sehr unverständlich formuliert. Um es kurz zu machen: In der relevanten Tabelle sind Kundengruppen zu Shop-Zuweisungen.

ID_Group 1 bis 3 sind Standart. Diese sollte man auch nicht löschen.

ID_Shop soviele, wie es Shops hat. Nur bei Multishop-Setup hat es das eine ID_Shop > 1.

 

Überflüssiges nur löschen, wenn man weiss, was man tut.

Wenn da ein paar IDs zuviel drinne sind, tun die auch niemandem weh. Auch bezüglich DB Performance so gut wie irrelevant.

Edited by Scully (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...