I have database schemas, wherein I have several tables with a composite primary key (meaning 2 0r more columns together make up a single PK).
I also frequently have FKs in a table also be part of the PK of that table.
I just started using appgini today and on a simple schema, it said:
-A foreign key cannot also be a primary key, and
-A table cannot have > 1 PK..implying that I can only have a single column PK.
Is this a limitation of appgini? Only single column PK and a PK in a table cannot be an FK as well? In other words use only auto-generated IDs or something for each table?
thank you for any help you may be able to provide!
-abajaj11
Composite primary key and foreign key part of PK?
Re: Composite primary key and foreign key part of PK?
Take a look at this link:
http://forums.appgini.com/phpbb/viewtop ... 1666#p1666
http://forums.appgini.com/phpbb/viewtop ... 1666#p1666
AppGini 22.14 - xampp 3.3.0 - PHP 7.4.30 - Summary reports - Calendar - Mass update - Messages - AppGiniHelper
Re: Composite primary key and foreign key part of PK?
Yes, I saw that already before i made my post...thanks for the link.
that solution does not solve my problem...
Here is an example schema:
Professors (f_id, f_name, f_address, f_specialty, highest_degree)
Courses (c_id, c_name, num_credits)
Sections (c_id, s_id, time_held, week_days_held, date_began, date_ended, cl_id)
c_id FOREIGN KEY REFERENCES Courses, cl_id FOREIGN KEY REFERENCES Classrooms
Students (st_id, st_name, gender, st_gpa)
Grades (st_id, c_id, s_id, grade)
st_id FOREIGN KEY REFERENCES Students
c_id,s_id FOREIGN KEY REFERENCES Sections
Classrooms (cl_id, capacity, location)
Teach (f_id, c_id, s_id)
f_id FOREIGN KEY REFERENCES Professors
c_id,s_id FOREIGN KEY REFERENCES Sections
NOTE: Primary keys are in red.
If I take this schema, appgini does not work with it. seems like I have to really mutate this schema in order for appgini to work...or am i missing something?

that solution does not solve my problem...
Here is an example schema:
Professors (f_id, f_name, f_address, f_specialty, highest_degree)
Courses (c_id, c_name, num_credits)
Sections (c_id, s_id, time_held, week_days_held, date_began, date_ended, cl_id)
c_id FOREIGN KEY REFERENCES Courses, cl_id FOREIGN KEY REFERENCES Classrooms
Students (st_id, st_name, gender, st_gpa)
Grades (st_id, c_id, s_id, grade)
st_id FOREIGN KEY REFERENCES Students
c_id,s_id FOREIGN KEY REFERENCES Sections
Classrooms (cl_id, capacity, location)
Teach (f_id, c_id, s_id)
f_id FOREIGN KEY REFERENCES Professors
c_id,s_id FOREIGN KEY REFERENCES Sections
NOTE: Primary keys are in red.
If I take this schema, appgini does not work with it. seems like I have to really mutate this schema in order for appgini to work...or am i missing something?

Re: Composite primary key and foreign key part of PK?
Here is the mutated schema:
Professors (ID,f_id, f_name, f_address, f_specialty, highest_degree)
Courses (ID,c_id, c_name, num_credits)
Sections (ID,Courses.ID, s_id, time_held, week_days_held, date_began, date_ended, Classrooms.ID)
Courses.ID FOREIGN KEY REFERENCES Courses, Classrooms.ID FOREIGN KEY REFERENCES Classrooms
Students (ID,st_id, st_name, gender, st_gpa)
Grades (ID, Student.ID, Sections.ID, grade)
Student.ID FOREIGN KEY REFERENCES Students
Sections.ID FOREIGN KEY REFERENCES Sections
Classrooms (ID, cl_id, capacity, location)
Teach (ID, Professors.ID, Sections.ID)
Professors.ID FOREIGN KEY REFERENCES Professors
Sections.ID FOREIGN KEY REFERENCES Sections
NOTE: Primary keys are in red.
In my opinion, I would need to mutate my earlier schema to this in order to use appGini. Am i right or am I missing something?
Professors (ID,f_id, f_name, f_address, f_specialty, highest_degree)
Courses (ID,c_id, c_name, num_credits)
Sections (ID,Courses.ID, s_id, time_held, week_days_held, date_began, date_ended, Classrooms.ID)
Courses.ID FOREIGN KEY REFERENCES Courses, Classrooms.ID FOREIGN KEY REFERENCES Classrooms
Students (ID,st_id, st_name, gender, st_gpa)
Grades (ID, Student.ID, Sections.ID, grade)
Student.ID FOREIGN KEY REFERENCES Students
Sections.ID FOREIGN KEY REFERENCES Sections
Classrooms (ID, cl_id, capacity, location)
Teach (ID, Professors.ID, Sections.ID)
Professors.ID FOREIGN KEY REFERENCES Professors
Sections.ID FOREIGN KEY REFERENCES Sections
NOTE: Primary keys are in red.
In my opinion, I would need to mutate my earlier schema to this in order to use appGini. Am i right or am I missing something?