+1
Answered

how to specify schema for a reference ?

Ali Tabrizi 8 ár síðan updated by Rafał Strzaliński (Senior Engineer) 8 ár síðan 6

In SQL Model , please note that we are using 5 different schema in our model so we will need to specify each reference `s schema

GOOD, I'M SATISFIED
Satisfaction mark by Ali Tabrizi 8 ár síðan
Answered

Hi


AFAIK reference is not an object in the database like: table, view, sequence, procedure and so on. It's just a table constraint. There is no need to specify schema.


I'm not sure if your understanding of "reference" it the same as mine. Database terms are ambigous :(





i`m aware of that , maybe i explained not correctly , here is an example of what i mean :


this is a table script with a specified schema :


-- tables -- Table: town CREATE TABLE base.town ( id int NOT NULL, city_id int NOT NULL, name nvarchar(50) NOT NULL, CONSTRAINT pk_town PRIMARY KEY (id) ); CREATE UNIQUE INDEX ndx_town_name on base.town (city_id ASC,name ASC) ; -- End of file.


The revelation to this table :


-- foreign keys -- Reference: parkeon_terminal_town (table: parkeon_terminal) ALTER TABLE parkeon_terminal ADD CONSTRAINT parkeon_terminal_town FOREIGN KEY (town_id) REFERENCES town (id); -- End of file.



as you can see when your software is generating the table which has schema , it is not generating right relation to it , because the in the database "town" table does not exits it`s "base.town" , therefore you should add the schema when you are generating the relation as well in the script in reference part .



+1
Answered

Hi,


This is fixed on production. Sorry for inconvenience.