mirror of
https://github.com/muety/wakapi.git
synced 2025-12-05 22:20:24 -08:00
fix: migration for mariadb
This commit is contained in:
@@ -15,10 +15,12 @@ func init() {
|
||||
return nil
|
||||
}
|
||||
|
||||
const q = "with t1 as " +
|
||||
"(select id, row_number() over(partition by email order by id) as row_num from users where email is not null) " +
|
||||
"update users set email = null " +
|
||||
"where users.id in (select id from t1 where row_num > 1)"
|
||||
// til: https://chat.mistral.ai/chat/86e338b7-dad7-4478-8950-11efbf94aa4d
|
||||
const q = "update users " +
|
||||
"set email = null " +
|
||||
"where users.id in " +
|
||||
"(select id from (select id, row_number() over (partition by email order by id) as row_num from users where email is not null) as t1 " +
|
||||
"where row_num > 1);"
|
||||
|
||||
if err := db.Exec(q).Error; err != nil {
|
||||
return err
|
||||
|
||||
3
scripts/docker_mariadb.sh
Normal file
3
scripts/docker_mariadb.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
docker run -d -p 3306:3306 -e MARIADB_ROOT_PASSWORD=secretpassword -e MARIADB_DATABASE=wakapi_local -e MARIADB_USER=wakapi_user -e MARIADB_PASSWORD=wakapi --name wakapi-mariadb mariadb:latest
|
||||
Reference in New Issue
Block a user