0
I have a code that is giving the following error:
there is no Unique Constraint matching Given Keys for referenced table "schedule"
Code:
CREATE TYPE weekday AS ENUM ('Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sabado');
-- Table Turma
CREATE TABLE TURMA
(
codigoTurma serial PRIMARY KEY,
nome character varying(50) NOT NULL UNIQUE
);
-- Table Horario
CREATE TABLE HORARIO
(
diaSemana weekday,
hora time,
PRIMARY KEY(diaSemana, hora)
);
-- Table: Horario Turma
create table HORARIOTURMA(
codigoTurma serial REFERENCES TURMA(codigoTurma),
diaSemana weekday REFERENCES HORARIO(diaSemana),
hora time REFERENCES HORARIO(hora),
PRIMARY KEY (codigoTurma, diaSemana, hora)
);
What may be generating this error?