Skip to content

Commit

Permalink
fix: fix new instance db setup
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenfiszel committed Oct 1, 2024
1 parent ae6d99b commit 73ab8e1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backend/custom_migrations/create_workspace_without_md5.sql
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
INSERT INTO workspace(id, name, owner) VALUES
('admins', 'Admins', '[email protected]');
('admins', 'Admins', '[email protected]') ON CONFLICT DO NOTHING;

INSERT INTO workspace_settings (workspace_id) VALUES
('admins');
('admins') ON CONFLICT DO NOTHING;

INSERT INTO workspace_key
(workspace_id, kind, key)
Expand All @@ -13,4 +13,4 @@ INSERT INTO workspace_key
FROM generate_series(1, 32) -- generates 32 characters
),
''
));
)) ON CONFLICT DO NOTHING;
11 changes: 11 additions & 0 deletions backend/windmill-api/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,17 @@ impl Migrate for CustomMigrator {
"../../custom_migrations/create_workspace_without_md5.sql"
))
.await?;
let _ = sqlx::query(
r#"
INSERT INTO _sqlx_migrations ( version, description, success, checksum, execution_time )
VALUES ( $1, $2, TRUE, $3, -1 ) ON CONFLICT DO NOTHING
"#,
)
.bind(migration.version)
.bind(&*migration.description)
.bind(&*migration.checksum)
.execute(&mut *self.inner)
.await?;
return Ok(std::time::Duration::from_secs(0));
} else {
let r = self.inner.apply(migration).await;
Expand Down

0 comments on commit 73ab8e1

Please sign in to comment.