Fix migration order
All checks were successful
Build and Push Docker Image / build (push) Successful in 2m9s
All checks were successful
Build and Push Docker Image / build (push) Successful in 2m9s
This commit is contained in:
@@ -28,26 +28,6 @@ BEGIN
|
||||
);
|
||||
END;
|
||||
|
||||
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Rental]') AND type = 'U')
|
||||
BEGIN
|
||||
CREATE TABLE Rental (
|
||||
id BIGINT NOT NULL IDENTITY (1, 1),
|
||||
rentalStart DATETIME NOT NULL,
|
||||
rentalEnd DATETIME NOT NULL,
|
||||
actualEnd DATETIME NULL,
|
||||
customerID BIGINT NOT NULL,
|
||||
vehicleID BIGINT NOT NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE Rental
|
||||
ADD CONSTRAINT FK_Customer_TO_Rental FOREIGN KEY (customerID) REFERENCES Customer (id);
|
||||
|
||||
ALTER TABLE Rental
|
||||
ADD CONSTRAINT FK_Vehicle_TO_Rental FOREIGN KEY (vehicleID) REFERENCES Vehicle (id);
|
||||
END;
|
||||
|
||||
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[VehicleCategory]') AND type = 'U')
|
||||
BEGIN
|
||||
CREATE TABLE VehicleCategory (
|
||||
@@ -78,4 +58,25 @@ BEGIN
|
||||
ADD CONSTRAINT FK_VehicleCategory_TO_Vehicle FOREIGN KEY (vehicleCategoryID) REFERENCES VehicleCategory (id);
|
||||
END;
|
||||
|
||||
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Rental]') AND type = 'U')
|
||||
BEGIN
|
||||
CREATE TABLE Rental (
|
||||
id BIGINT NOT NULL IDENTITY (1, 1),
|
||||
rentalStart DATETIME NOT NULL,
|
||||
rentalEnd DATETIME NOT NULL,
|
||||
actualEnd DATETIME NULL,
|
||||
customerID BIGINT NOT NULL,
|
||||
vehicleID BIGINT NOT NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE Rental
|
||||
ADD CONSTRAINT FK_Customer_TO_Rental FOREIGN KEY (customerID) REFERENCES Customer (id);
|
||||
|
||||
ALTER TABLE Rental
|
||||
ADD CONSTRAINT FK_Vehicle_TO_Rental FOREIGN KEY (vehicleID) REFERENCES Vehicle (id);
|
||||
END;
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user