Skip to content
Snippets Groups Projects

Change the Timeslot table Private Key

In this Merge Request, the private key of the Timeslot is changed from an id to the date and the slot_id. This also leads to the id of the timeslot being removed.

In order to update the current master database, the following code can be executed:

ALTER TABLE Availability
  ADD COLUMN date date NOT NULL,
  ADD COLUMN slot_id int NOT NULL,
  DROP FOREIGN KEY Availability_Timeslot,
  DROP PRIMARY KEY,
  ADD PRIMARY KEY (netid,date,slot_id),
  DROP COLUMN timeslot_id;


ALTER TABLE LabAssignment 
  ADD COLUMN date date NOT NULL,
  ADD COLUMN slot_id int NOT NULL,
  DROP FOREIGN KEY LabAssignment_Timeslot,
  DROP PRIMARY KEY,
  ADD PRIMARY KEY (netid,schedule_id,date,slot_id),
  DROP COLUMN timeslot_id;

ALTER TABLE LabTimeslot
  ADD COLUMN date date NOT NULL,
  ADD COLUMN slot_id int NOT NULL,
  DROP FOREIGN KEY LabTimeslot_Timeslot,
  DROP PRIMARY KEY,
  ADD PRIMARY KEY (lab_id,date,slot_id),
  DROP COLUMN timeslot_id;

ALTER TABLE Timeslot
  DROP PRIMARY KEY,
  ADD PRIMARY KEY (date, slot_id),
  DROP COLUMN id;

ALTER TABLE Availability ADD CONSTRAINT Availability_Timeslot FOREIGN KEY Availability_Timeslot (date,slot_id) REFERENCES Timeslot (date,slot_id);
ALTER TABLE LabAssignment ADD CONSTRAINT LabAssignment_Timeslot FOREIGN KEY LabAssignment_Timeslot (date,slot_id) REFERENCES Timeslot (date,slot_id);
ALTER TABLE LabTimeslot ADD CONSTRAINT LabTimeslot_Timeslot FOREIGN KEY LabTimeslot_Timeslot (date,slot_id) REFERENCES Timeslot (date,slot_id);
Edited by Otto Visser

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Otto Visser marked as a Work In Progress

    marked as a Work In Progress

    By Max van Deursen on 2018-05-30T13:54:04 (imported from GitLab project)

  • Otto Visser changed the description

    changed the description

    By Max van Deursen on 2018-05-30T13:54:04 (imported from GitLab project)

  • Otto Visser unmarked as a Work In Progress

    unmarked as a Work In Progress

    By Max van Deursen on 2018-05-30T13:59:32 (imported from GitLab project)

  • Otto Visser changed the description

    changed the description

    By Geert Habben Jansen on 2018-05-30T14:20:55 (imported from GitLab project)

  • Why is this merge request based on master instead of dev?

    By Geert Habben Jansen on 2018-05-30T14:21:34 (imported from GitLab project)

  • Otto Visser changed target branch from master to dev

    changed target branch from master to dev

    By Max van Deursen on 2018-05-30T15:35:03 (imported from GitLab project)

  • Otto Visser added 2 commits

    added 2 commits

    • 54efb28f - 1 commit from branch dev
    • 5ebe0da4 - Change the Timeslot table Private Key

    Compare with previous version

    By Max van Deursen on 2018-05-30T15:35:26 (imported from GitLab project)

  • Fair point, would work too! We have to remember to run the script though when deploying

    By Max van Deursen on 2018-05-30T15:36:04 (imported from GitLab project)

    Edited by Otto Visser
  • Otto Visser changed target branch from dev to master

    changed target branch from dev to master

    By Max van Deursen on 2018-05-31T07:15:29 (imported from GitLab project)

  • Otto Visser added 3 commits

    added 3 commits

    Compare with previous version

    By Max van Deursen on 2018-05-31T07:17:48 (imported from GitLab project)

  • merged

    By Max Pigmans on 2018-05-31T07:22:31 (imported from GitLab project)

  • Otto Visser mentioned in commit 59c7a8ca

    mentioned in commit 59c7a8ca

    By Max Pigmans on 2018-05-31T07:22:31 (imported from GitLab project)

Please register or sign in to reply
Loading