Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/02/2016, 11:32
juancaalbarracin
 
Fecha de Ingreso: julio-2011
Ubicación: Los Rios
Mensajes: 145
Antigüedad: 12 años, 9 meses
Puntos: 10
problema de Relaciones

Saludos tengo un problema raro que me gusrtaria saber si de pronto alguien sabe que sucede.

Genero una base de datos relacional en Power designer de la cual genero el script para mysql
Código MySQL:
Ver original
  1. /*==============================================================*/
  2. /* DBMS name:      MySQL 5.0                                    */
  3. /* Created on:     24/02/2016 12:06:06                          */
  4. /*==============================================================*/
  5.  
  6.  
  7.  
  8. drop table if exists clientes;
  9.  
  10. drop table if exists factura;
  11.  
  12.  
  13. drop table if exists productos;
  14.  
  15.  
  16. drop table if exists tipopro;
  17.  
  18. drop table if exists usuarios;
  19.  
  20.  
  21. /*==============================================================*/
  22. /* Table: bodega                                                */
  23. /*==============================================================*/
  24. create table bodega
  25. (
  26.    id_bodega            varchar(20) not null,
  27.    pro_codigo           varchar(20),
  28.    usu_mail             varchar(100),
  29.    bod_codigo           varchar(15) not null,
  30.    bod_cantid           int not null,
  31.    bod_contad           decimal(10,2) not null,
  32.    bod_credit           decimal(10,2) not null,
  33.    bod_tarjet           decimal(10,2) not null,
  34.    bod_factur           int not null,
  35.    primary key (id_bodega)
  36. );
  37.  
  38. /*==============================================================*/
  39. /* Table: clientes                                              */
  40. /*==============================================================*/
  41. create table clientes
  42. (
  43.    cli_ruc              varchar(13) not null,
  44.    cli_nombre           varchar(50),
  45.    cli_apelli           varchar(50),
  46.    cli_direcc           varchar(100),
  47.    cli_mail             varchar(50),
  48.    primary key (cli_ruc)
  49. );
  50.  
  51. /*==============================================================*/
  52. /* Table: factura                                               */
  53. /*==============================================================*/
  54. create table factura
  55. (
  56.    fact_numero          int not null,
  57.    fac_clave            varchar(50),
  58.    fac_autori           varchar(50),
  59.    fac_file             varchar(60),
  60.    primary key (fact_numero)
  61. );
  62.  
  63. /*==============================================================*/
  64. /* Table: pagos                                                 */
  65. /*==============================================================*/
  66. (
  67.    id_pago              int not null,
  68.    id_venta             int,
  69.    usu_mail             varchar(100),
  70.    pag_fecha            datetime,
  71.    pag_abono            decimal(10,2),
  72.    pag_saldo            decimal(10,2),
  73.    primary key (id_pago)
  74. );
  75.  
  76. /*==============================================================*/
  77. /* Table: productos                                             */
  78. /*==============================================================*/
  79. create table productos
  80. (
  81.    pro_codigo           varchar(20) not null,
  82.    id_tipo              varchar(10),
  83.    pro_marca            varchar(50) not null,
  84.    pro_modelo           varchar(50) default NULL,
  85.    pro_color            varchar(50) default NULL,
  86.    pro_detalle          varchar(255) default NULL,
  87.    pro_image            varchar(255) default NULL,
  88.    primary key (pro_codigo)
  89. );
  90.  
  91. /*==============================================================*/
  92. /* Table: recibo                                                */
  93. /*==============================================================*/
  94. create table recibo
  95. (
  96.    rec_numero           int not null,
  97.    rec_fecha            datetime,
  98.    primary key (rec_numero)
  99. );
  100.  
  101. /*==============================================================*/
  102. /* Table: tipopro                                               */
  103. /*==============================================================*/
  104. create table tipopro
  105. (
  106.    id_tipo              varchar(10) not null,
  107.    tip_nombre           varchar(40) not null,
  108.    tip_status           int not null default 1,
  109.    primary key (id_tipo)
  110. );
  111.  
  112. /*==============================================================*/
  113. /* Table: usuarios                                              */
  114. /*==============================================================*/
  115. create table usuarios
  116. (
  117.    usu_nombre           varchar(50) not null,
  118.    usu_apelli           varchar(50) not null,
  119.    usu_mail             varchar(100) not null,
  120.    usu_pass             varchar(32) not null,
  121.    usu_nivel            varchar(15) not null,
  122.    usu_change           int not null,
  123.    usu_status           int not null,
  124.    primary key (usu_mail)
  125. );
  126.  
  127. /*==============================================================*/
  128. /* Table: ventas                                                */
  129. /*==============================================================*/
  130. create table ventas
  131. (
  132.    id_venta             int not null,
  133.    cli_ruc              varchar(13) not null,
  134.    id_bodega            varchar(20) not null,
  135.    ven_fecha            datetime not null,
  136.    ven_valor            decimal(10,2) not null,
  137.    ven_cantid           decimal(10,2) not null,
  138.    usu_mail             varchar(100) not null,
  139.    fact_numero          int,
  140.    rec_numero           int,
  141.    primary key (id_venta)
  142. );
  143.  
  144. alter table bodega add constraint FK_RELATIONSHIP_2 foreign key (pro_codigo)
  145.       references productos (pro_codigo) on delete restrict on update cascade;
  146.  
  147. alter table bodega add constraint FK_rel_usu_bod foreign key (usu_mail)
  148.       references usuarios (usu_mail) on delete restrict on update cascade;
  149.  
  150. alter table pagos add constraint FK_rel_usu_pag foreign key (usu_mail)
  151.       references usuarios (usu_mail) on delete restrict on update cascade;
  152.  
  153. alter table pagos add constraint FK_rel_van_pag foreign key (id_venta)
  154.       references ventas (id_venta) on delete restrict on update cascade;
  155.  
  156. alter table productos add constraint FK_rel_tip_pro foreign key (id_tipo)
  157.       references tipopro (id_tipo) on delete restrict on update cascade;
  158.  
  159. alter table ventas add constraint FK_RELATIONSHIP_3 foreign key (cli_ruc)
  160.       references clientes (cli_ruc) on delete restrict on update cascade;
  161.  
  162. alter table ventas add constraint FK_RELATIONSHIP_4 foreign key (id_bodega)
  163.       references bodega (id_bodega) on delete restrict on update cascade;
  164.  
  165. alter table ventas add constraint FK_RELATIONSHIP_5 foreign key (fact_numero)
  166.       references factura (fact_numero) on delete restrict on update cascade;
  167.  
  168. alter table ventas add constraint FK_RELATIONSHIP_6 foreign key (usu_mail)
  169.       references usuarios (usu_mail) on delete restrict on update cascade;
  170.  
  171. alter table ventas add constraint FK_rel_rec_ven foreign key (rec_numero)
  172.       references recibo (rec_numero) on delete restrict on update cascade;

hasta aqui sin problemas, pero cuando importo la base en phpmyadmin me crea todas las tablas, las FK en cada tabla pero estas no estan relacionadas perdiendo todos mis on update..

Alguna idea de que o porque sucede esto.
__________________
___________________________
Si te ayudo mi respuesta dale al +1