Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cli-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- name: Run Tests
run: make test-coverage
- name: Upload Coverage Report
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
files: all.coverprofile
Expand Down
9 changes: 8 additions & 1 deletion pkg/cloud/sql/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,14 @@

l.Publish(l.State)

err := l.migrationRunner(fs, l.State, databasesToMigrate)
servers := map[string]*DatabaseServer{}

Check warning on line 289 in pkg/cloud/sql/sql.go

View check run for this annotation

Codecov / codecov/patch

pkg/cloud/sql/sql.go#L289

Added line #L289 was not covered by tests

// only run migrations for databases that are keys in databasesToMigrate
for dbName := range databasesToMigrate {
servers[dbName] = l.State[dbName]

Check warning on line 293 in pkg/cloud/sql/sql.go

View check run for this annotation

Codecov / codecov/patch

pkg/cloud/sql/sql.go#L292-L293

Added lines #L292 - L293 were not covered by tests
}

err := l.migrationRunner(fs, servers, databasesToMigrate)

Check warning on line 296 in pkg/cloud/sql/sql.go

View check run for this annotation

Codecov / codecov/patch

pkg/cloud/sql/sql.go#L296

Added line #L296 was not covered by tests
if err != nil {
return err
}
Expand Down
31 changes: 22 additions & 9 deletions pkg/dashboard/frontend/cypress/e2e/databases.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,19 @@ describe('Databases Spec', () => {
cy.getTestEl('run-btn').click()

cy.intercept('POST', '/api/sql', (req) => {
if (req.body && req.body.query === 'select * from test_table;') {
let body = req.body

if (typeof req.body === 'string') {
body = JSON.parse(req.body)
}

if (body && body.query.trim() === `select * from test_table;`) {
req.alias = 'query'
req.continue()
} else {
req.continue()
}
}).as('query')
})

cy.get('#sql-editor .cm-content', {
timeout: 5000,
Expand All @@ -259,6 +268,8 @@ describe('Databases Spec', () => {
})

it(`should of applied migrations for ${db}`, () => {
cy.wait(1000)

cy.get(`[data-rct-item-id="${db}"]`).click()

cy.wait(1000)
Expand All @@ -269,6 +280,14 @@ describe('Databases Spec', () => {

cy.wait('@migrate')

cy.get('#sql-editor .cm-content', {
timeout: 5000,
})
.clear({
force: true,
})
.invoke('html', 'select * from my_migration_table;')

cy.intercept('POST', '/api/sql', (req) => {
let body = req.body

Expand All @@ -284,13 +303,7 @@ describe('Databases Spec', () => {
}
})

cy.get('#sql-editor .cm-content', {
timeout: 5000,
})
.clear({
force: true,
})
.invoke('html', 'select * from my_migration_table;')
cy.wait(1000)

cy.getTestEl('run-btn').click()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ const DatabasesExplorer: React.FC = () => {
if (res.ok) {
toast.success('Migration successful', { id: loadingId })
} else {
toast.error('Migration failed', { id: loadingId })
const text = await res.text()
toast.error('Migration failed: ' + text, { id: loadingId })
}

setMigrationLoading(false)
Expand Down
Loading