Skip to content

Commit

Permalink
feat(backend): Add Fake migration to backend (#401)
Browse files Browse the repository at this point in the history
* feat(backend): Add Fake migration to backend

Needed by iterative/studio#9766

* Add `showmigrations` step.

This will check if there is a connection to database, and will restart the init container if it fails

---------

Co-authored-by: Marcin Jasion <mjasion@users.noreply.github.com>
  • Loading branch information
mjasion and mjasion committed May 20, 2024
1 parent 8fdcda6 commit ebfb4af
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/studio/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: studio
description: A Helm chart for Kubernetes
type: application
version: 0.13.21
version: 0.13.22
appVersion: "v2.115.0"
maintainers:
- name: iterative
Expand Down
2 changes: 1 addition & 1 deletion charts/studio/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# studio

![Version: 0.13.21](https://img.shields.io/badge/Version-0.13.21-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v2.115.0](https://img.shields.io/badge/AppVersion-v2.115.0-informational?style=flat-square)
![Version: 0.13.22](https://img.shields.io/badge/Version-0.13.22-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v2.115.0](https://img.shields.io/badge/AppVersion-v2.115.0-informational?style=flat-square)

A Helm chart for Kubernetes

Expand Down
8 changes: 8 additions & 0 deletions charts/studio/templates/deployment-studio-backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,19 @@ spec:
command: [ "/bin/sh", "-c" ]
args:
- |
./manage.py showmigrations || exit 1
./manage.py migrate
{{- if not (hasPrefix "sha-" (.Values.studioBackend.image.tag | default "")) }}
{{- if semverCompare "<=2.103.0" (.Values.studioBackend.image.tag | default .Chart.AppVersion) }}
./manage.py migrate --database dvcx
{{- end }}
{{- if semverCompare ">=2.115.0" (.Values.studioBackend.image.tag | default .Chart.AppVersion) }}
./manage.py migrate --fake dqlapp 0047
{{- end }}
{{- end }}
{{- if hasPrefix "sha-" (.Values.studioBackend.image.tag | default "") }}
./manage.py migrate --fake dqlapp 0047
./manage.py migrate
{{- end }}
{{- if and .Release.IsUpgrade (not .Values.ci) }}
./manage.py migrate phonenumber --fake-initial
Expand Down

0 comments on commit ebfb4af

Please sign in to comment.