Создание веб-приложения, сочетающего в себе проектирование и создание баз данных, работу со сторонними форматами данных, программирование в NET и веб-разработку, страница 32

delimiter $$

CREATE TABLE `type_message` (

  `id` int(11) NOT NULL AUTO_INCREMENT,

  `type` varchar(100) NOT NULL,

  PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8$$

delimiter $$

CREATE TABLE `message` (

  `id` int(11) NOT NULL AUTO_INCREMENT,

  `type` int(11) NOT NULL,

  `from_user` int(11) NOT NULL,

  `to_user` int(11) NOT NULL,

  `message` text NOT NULL,

  `date` datetime NOT NULL,

  `read` tinyint(1) NOT NULL DEFAULT '0',

  PRIMARY KEY (`id`),

  KEY `from_user` (`from_user`),

  KEY `to_user` (`to_user`),

  KEY `foreign_type` (`type`),

  CONSTRAINT `message_ibfk_3` FOREIGN KEY (`type`) REFERENCES `type_message` (`id`),

  CONSTRAINT `message_ibfk_1` FOREIGN KEY (`from_user`) REFERENCES `auth_user` (`id`),

  CONSTRAINT `message_ibfk_2` FOREIGN KEY (`to_user`) REFERENCES `auth_user` (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8$$

delimiter $$

CREATE TABLE `ratingppl` (

  `user` int(11) NOT NULL,

  `season` int(11) NOT NULL,

  `game` int(11) NOT NULL,

  `rating` int(11) NOT NULL,

  `date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,

  PRIMARY KEY (`user`,`season`,`game`),

  KEY `season` (`season`),

  CONSTRAINT `ratingppl_ibfk_1` FOREIGN KEY (`user`) REFERENCES `auth_user` (`id`),

  CONSTRAINT `ratingppl_ibfk_2` FOREIGN KEY (`season`) REFERENCES `seasons` (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8$$

delimiter $$

CREATE TABLE `reputation` (

  `user` int(11) NOT NULL,

  `season` int(11) NOT NULL,

  `game` int(11) NOT NULL,

  `reputation` float NOT NULL,

  `date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,

  PRIMARY KEY (`user`,`season`,`game`),

  KEY `season` (`season`),

  CONSTRAINT `reputation_ibfk_1` FOREIGN KEY (`user`) REFERENCES `auth_user` (`id`),

  CONSTRAINT `reputation_ibfk_2` FOREIGN KEY (`season`) REFERENCES `seasons` (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8$$

Приложение Б.

Б.1 Главный каталог:

<configuration>

  <system.web>

    <roleManager enabled="true"

                 defaultProvider="PowerPlayRolesProvider">

      <providers>

        <add name="PowerPlayRolesProvider"

              type="powerplay.PowerPlayRolesProvider"/>

      </providers>

    </roleManager>

    <compilation debug="true" targetFramework="4.0" />

    <authorization>

      <allow users="*"/>

    </authorization>

    <authentication mode="Forms" >

      <forms loginUrl="~/account/signin.aspx" defaultUrl="~/index.aspx"></forms>

    </authentication>

    <membership defaultProvider="PowerPlayProvider">

      <providers>

        <add name="PowerPlayProvider"

             type="powerplay.PowerPlayProvider"

              requiresQuestionAndAnswer="false"

             />

      </providers>

    </membership>

    <machineKey

      validationKey="32E35872597989D14CC1D5D9F5B1E94238D0EE32CF10AA2D2059533DF6035F4F"

      decryptionKey="B179091DBB2389B996A526DE8BCD7ACFDBCAB04EF1D085481C61496F693DF5F4"

/>

  </system.web>

  <system.webServer>

    <directoryBrowse enabled="false"/>

  </system.webServer>

</configuration>

Б.2 Подкаталог /account:

<?xml version="1.0"?>

<configuration>

  <location path="registration.aspx">

    <system.web>

      <authorization>

        <allow users="*"/>

      </authorization>

    </system.web>

  </location>

  <location path="signin.aspx">

    <system.web>

      <authorization>

        <allow users="*"/>

      </authorization>

    </system.web>

  </location>

  <system.web>

    <authorization>

      <deny users="?"/>