Skip to content

Commit

Permalink
Add patch for v0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zdevaty committed May 22, 2024
1 parent 78a50c7 commit c31e435
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ func initialization() {
asset.InitAssetTypeFiles("resources/asset-types/*.json"),
dashboard.InitWidgetTypeFiles("resources/widget-types/*.json"),
)

app.Patch(conn, app.AppName(), "000201",
app.ExecSqlFile("conf/000200.sql"),
)
}

var once sync.Once
Expand Down
25 changes: 25 additions & 0 deletions conf/000200.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
CREATE TABLE IF NOT EXISTS ews.unified_booking
(
id bigserial PRIMARY KEY,
exchange_uid text UNIQUE,
exchange_organizer_mailbox text,
booking_id int UNIQUE
);

CREATE TABLE IF NOT EXISTS ews.room_booking
(
id bigserial PRIMARY KEY,
unified_booking_id bigserial NOT NULL REFERENCES ews.unified_booking(id) ON DELETE CASCADE,
exchange_id text UNIQUE
);

INSERT INTO ews.unified_booking (exchange_uid, exchange_organizer_mailbox, booking_id)
SELECT DISTINCT exchange_uid, exchange_mailbox, booking_id
FROM ews.booking;

INSERT INTO ews.room_booking (unified_booking_id, exchange_id)
SELECT ub.id, b.exchange_id
FROM ews.booking b
JOIN ews.unified_booking ub ON b.exchange_uid = ub.exchange_uid;

DROP TABLE IF EXISTS ews.booking;

0 comments on commit c31e435

Please sign in to comment.