phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mferlay <mfer...@gnubila.fr>
Subject How to migrate sql cascade and foreign keys
Date Thu, 02 Mar 2017 13:32:40 GMT
Hi everybody, 
I need to migrate an sql script which creates all our database in apache
phoenix format. I do not manage to translate foreign keys and delete cascade
from this following sample:

CREATE TABLE IF NOT EXISTS A(
  ID VARCHAR(255) NOT NULL,
  colX VARCHAR(255) NULL,
  PRIMARY KEY(ID)
);

CREATE TABLE IF NOT EXISTS B(
  ID VARCHAR(255) NOT NULL,
  colY VARCHAR(255) NOT NULL,
  PRIMARY KEY(colY)
);

CREATE TABLE IF NOT EXISTS C(
  colY VARCHAR(255) NOT NULL,
  ID VARCHAR(255) NOT NULL,
  PRIMARY KEY(ID,colY),
  FOREIGN KEY(ID)
    REFERENCES A(ID)
      ON DELETE CASCADE
      ON UPDATE NO ACTION,
  FOREIGN KEY(colY)
    REFERENCES B(colY)
      ON DELETE CASCADE
      ON UPDATE NO ACTION
)


thanks for your help,

Regards



--
View this message in context: http://apache-phoenix-user-list.1124778.n5.nabble.com/How-to-migrate-sql-cascade-and-foreign-keys-tp3226.html
Sent from the Apache Phoenix User List mailing list archive at Nabble.com.

Mime
View raw message