friends/database/init_postgres_3ds.go
Daniel López Guimaraes f9071cbed3
feat: Update modules and new Mii database fields
Add Mii profanity flag and character set to the 3DS friends database.
This in theory allows better support of Mii names that use characters
exclusive to the following regions: CHN, KOR or TWN.

Also get the Mii changed timestamp from the database, and not use the
current time for it.

Update the go modules to get the latest stability updates and use the
new fields on the Mii structure.
2024-05-20 21:55:56 +01:00

54 lines
1.3 KiB
Go

package database
import "github.com/PretendoNetwork/friends/globals"
func initPostgres3DS() {
var err error
_, err = Manager.Exec(`CREATE SCHEMA IF NOT EXISTS "3ds"`)
if err != nil {
globals.Logger.Critical(err.Error())
return
}
globals.Logger.Success("[3DS] Postgres schema created")
_, err = Manager.Exec(`CREATE TABLE IF NOT EXISTS "3ds".user_data (
pid integer PRIMARY KEY,
show_online boolean DEFAULT true,
show_current_game boolean DEFAULT true,
comment text DEFAULT '',
comment_changed bigint DEFAULT 0,
last_online bigint DEFAULT 0,
favorite_title bigint DEFAULT 0,
favorite_title_version integer DEFAULT 0,
mii_name text DEFAULT '',
mii_profanity boolean DEFAULT false,
mii_character_set smallint DEFAULT 0,
mii_data bytea DEFAULT '',
mii_changed bigint DEFAULT 0,
region integer DEFAULT 0,
area integer DEFAULT 0,
language integer DEFAULT 0,
country integer DEFAULT 0
)`)
if err != nil {
globals.Logger.Critical(err.Error())
return
}
_, err = Manager.Exec(`CREATE TABLE IF NOT EXISTS "3ds".friendships (
id bigserial PRIMARY KEY,
user1_pid integer,
user2_pid integer,
type integer,
date bigint,
UNIQUE (user1_pid, user2_pid)
)`)
if err != nil {
globals.Logger.Critical(err.Error())
return
}
globals.Logger.Success("[3DS] Postgres tables created")
}