generated from ulavalIFTGLOateliers/GLO2005-Migration
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
La migration et le rollback s'effectuent correctement
- Loading branch information
1 parent
b948170
commit ced86b8
Showing
3 changed files
with
37 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
CREATE TABLE band ( | ||
bandName VARCHAR(50), | ||
creation YEAR, | ||
genre VARCHAR(50), | ||
PRIMARY KEY (bandName) | ||
); | ||
|
||
INSERT INTO band (bandName, creation, genre) VALUES | ||
('Crazy Duo', 2015, 'rock'), | ||
('Luna', 2009, 'classical'), | ||
('Mysterio', 2019, 'pop'); | ||
|
||
ALTER TABLE singer RENAME TO musician; | ||
ALTER TABLE musician CHANGE singerName musicianName VARCHAR(50); | ||
ALTER TABLE musician ADD COLUMN role VARCHAR(50); | ||
ALTER TABLE musician ADD COLUMN bandName VARCHAR(50); | ||
|
||
UPDATE musician m SET m.role = 'vocals' WHERE m.musicianName = 'Alina'; | ||
UPDATE musician m SET m.bandName = 'Crazy Duo' WHERE m.musicianName = 'Alina'; | ||
UPDATE musician m SET m.role = 'guitar' WHERE m.musicianName = 'Mysterio'; | ||
UPDATE musician m SET m.bandName = 'Mysterio' WHERE m.musicianName = 'Mysterio'; | ||
UPDATE musician m SET m.role = 'percussion' WHERE m.musicianName = 'Rainbow'; | ||
UPDATE musician m SET m.bandName = 'Crazy Duo' WHERE m.musicianName = 'Rainbow'; | ||
UPDATE musician m SET m.role = 'piano' WHERE m.musicianName = 'Luna'; | ||
UPDATE musician m SET m.bandName = 'Luna' WHERE m.musicianName = 'Luna'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
DROP TABLE band; | ||
|
||
ALTER TABLE musician RENAME TO singer; | ||
ALTER TABLE singer CHANGE musicianName singerName VARCHAR(50); | ||
ALTER TABLE singer DROP COLUMN role; | ||
ALTER TABLE singer DROP COLUMN bandName; |