Merge branch 'new-db' into 'staging'
New db See merge request PhilippHofer/rot!56
This commit is contained in:
commit
107f84734a
@ -1 +1,20 @@
|
||||
UPDATE user SET is_admin=true WHERE name IN ('Sandra Sollberger', 'Thomas Hoffelner', 'Manfred Meindl', 'Bernhard Heinemann');
|
||||
ALTER TABLE logbook ADD COLUMN "steering_person" INTEGER NOT NULL DEFAULT 0 REFERENCES user(id);
|
||||
UPDATE logbook SET steering_person = shipmaster;
|
||||
CREATE TABLE "logbook_temp" (
|
||||
"id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"boat_id" INTEGER NOT NULL REFERENCES boat(id),
|
||||
"shipmaster" INTEGER NOT NULL REFERENCES user(id),
|
||||
"steering_person" INTEGER NOT NULL DEFAULT 1 REFERENCES user(id),
|
||||
"shipmaster_only_steering" boolean not null,
|
||||
"departure" datetime not null,
|
||||
"arrival" datetime,
|
||||
"destination" text,
|
||||
"distance_in_km" integer,
|
||||
"comments" text,
|
||||
"logtype" INTEGER REFERENCES logbook_type(id)
|
||||
);
|
||||
INSERT INTO logbook_temp(id, boat_id, shipmaster, shipmaster_only_steering, departure, arrival, destination, distance_in_km, comments, logtype) SELECT id, boat_id, shipmaster, shipmaster_only_steering, COALESCE(departure, '2000-01-01 00:00:00'), arrival, destination, distance_in_km, comments, logtype FROM logbook;
|
||||
DROP TABLE logbook;
|
||||
ALTER TABLE logbook_temp RENAME TO logbook;
|
||||
|
||||
INSERT INTO rower(rower_id, logbook_id) SELECT shipmaster, id FROM logbook;
|
||||
|
Loading…
Reference in New Issue
Block a user