3 Replies Latest reply on May 19, 2004 10:28 AM by jae77

    Nukes Database

    sysuser1

      Hi,

      Just a question...
      Do the database use foreign keys? What is the type of the tables (MyIsam or InnoDB)? How the transactions are managed?

      Thanks a lot !

        • 1. Re: Nukes Database
          jae77

          foreign key use, the answer is yes and no....

          for tables w/in their own schema (ie news), there are foreign key constraints between those tables (ie, the story table has a foreign key to the topic table), there are also foreign key constraints against the "user" table.

          not all of the other modules currently do this b/c they were direct ports of the post nuke schema (which wasn't normalized), however this should change as they are refactored to become "offically released".

          i believe the table types are determined by you (and this is only applicable if you are using mysql). transactions are managed by jboss itself.

          • 2. Re: Nukes Database
            sysuser1

             


            there are foreign key constraints between those tables (ie, the story table has a foreign key to the topic table)

            Ok but I don't understand because in the script MySQL to create tables the forein keys are not declared (syntax 'FOREIGN KEY'). Why?
            I think the foreign keys can't exist without this declaration !

            Here the scripts :

            CREATE TABLE nuke_topics (
             pn_topicid TINYINT(4) NOT NULL AUTO_INCREMENT,
             pn_topicname VARCHAR(255) DEFAULT NULL,
             pn_topicimage VARCHAR(255) DEFAULT NULL,
             pn_topictext VARCHAR(255) DEFAULT NULL,
             pn_counter INT(11) NOT NULL DEFAULT '0',
             PRIMARY KEY (pn_topicid)
             );
            


            CREATE TABLE nuke_stories (
             pn_sid INT(11) NOT NULL AUTO_INCREMENT,
             pn_state INT(11) NOT NULL DEFAULT '0',
             pn_aid VARCHAR(30) NOT NULL DEFAULT '',
             pn_title VARCHAR(255) DEFAULT NULL,
             pn_time DATETIME DEFAULT NULL,
             pn_hometext TEXT,
             pn_bodytext TEXT NOT NULL,
             pn_comments INT(11) DEFAULT '0',
             pn_counter MEDIUMINT(8) UNSIGNED DEFAULT NULL,
             pn_topic TINYINT(4) DEFAULT '1',
             pn_informant VARCHAR(20) NOT NULL DEFAULT '',
             pn_notes TEXT NOT NULL,
             pn_ihome TINYINT(1) NOT NULL DEFAULT '0',
             pn_themeoverride VARCHAR(30) NOT NULL DEFAULT '',
             pn_language VARCHAR(30) NOT NULL DEFAULT '',
             pn_withcomm TINYINT(1) NOT NULL DEFAULT '0',
             pn_format_type TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',
             PRIMARY KEY (pn_sid)
             );
            


            • 3. Re: Nukes Database
              jae77

              well - in the case of news, the ddls are you are looking at are no longer valid. the news tables are now created by jboss b/c it's too much of a pita to try and maintain ddls for 4 different databases.

              even in this example, the foreign keys did exist, but they were managed by jboss via the relations that are defined in the deployment descriptors. (look at the xdoclet in the latest news code to see this).