Add migration fixes

This commit is contained in:
2020-10-09 16:06:31 +02:00
parent 011619d3c3
commit aea74bef27
8 changed files with 23 additions and 7 deletions

View File

@@ -33,6 +33,10 @@ func DbMainpage(pool *pgxpool.Pool) gin.H {
log.Println(err.Error())
}
persons = append(persons, models.Person{
Id: -1,
Name: "-- Auswählen --",
})
var person models.Person
for wperson.Next() {
err = wperson.Scan(&person.Id, &person.Name)

View File

@@ -0,0 +1,3 @@
--
-- DROP/Reverse everything here
--

View File

@@ -0,0 +1,3 @@
ALTER TABLE public.washlist DROP COLUMN washed;
ALTER TABLE public.washlist
ADD COLUMN washed integer;

View File

@@ -0,0 +1,3 @@
--
-- DROP/Reverse everything here
--

View File

@@ -0,0 +1,2 @@
ALTER TABLE public.washlist
ALTER COLUMN washed SET DEFAULT -1;

View File

@@ -15,7 +15,6 @@
<tr>
<th>Person</th>
<th>Datum</th>
<th>Gewaschen?</th>
<th>Waschperson</th>
</tr>
</thead>
@@ -26,15 +25,18 @@
<tr>
<td>{{$item.Person}}</td>
<td>{{$item.Date}}</td>
<td>{{$item.Washed}}</td>
<td>
<div class="center">
<form class="ui form" action="/uploadname" method="POST">
<input type="hidden" id="washid" name="washid" value="{{ $item.Id}}">
<select name="names" id="names">
<option value="-1" selected></option>
<!--<option value="-1" selected disabled hidden>Choose here</option>-->
{{range $person := $persons}}
<option value="{{$person.Id}}">{{$person.Name}}</option>
{{if eq $item.Washed $person.Id}}
<option value="{{$person.Id}}" selected>{{$person.Name}}</option>
{{else}}
<option value="{{$person.Id}}">{{$person.Name}}</option>
{{end}}
{{end}}
</select>
<input type="submit" value="Speichern">

View File

@@ -1,10 +1,9 @@
{{define "navbar"}}
<div class="ui inverted menu">
<a href="/"><div class="header item">Trikotwaschliste</div></a>
<a href="/"><div class="header item">Personen</div></a>
<div class="right menu">
<a href="/querypage/create"><div class="item">Query</div></a>
<a href="/stats/interpret"><div class="item">Stats</div></a>
<a href="/credits"><div class="item">Credits</div></a>
</div>
</div>

View File

@@ -6,5 +6,5 @@ type Washlist struct {
Id int `json:"id"`
Person string `json:"person"`
Date time.Time `json:"date"`
Washed string `json:"iswashed"`
Washed int `json:"iswashed"`
}