2023-12-20 07:03:03 +00:00
|
|
|
package migrations
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/uptrace/bun"
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
migrations.MustRegister(func(ctx context.Context, db *bun.DB) error {
|
|
|
|
_, err := db.ExecContext(ctx, `
|
2023-12-16 07:12:20 +00:00
|
|
|
create table if not exists versions
|
|
|
|
(
|
|
|
|
code varchar(6) not null
|
|
|
|
primary key,
|
|
|
|
name varchar(150) not null,
|
|
|
|
host varchar(150) not null
|
|
|
|
unique,
|
|
|
|
timezone varchar(150) not null
|
|
|
|
);
|
|
|
|
|
|
|
|
insert into versions (code, name, host, timezone)
|
|
|
|
values ('pl', 'Poland', 'www.plemiona.pl', 'Europe/Warsaw'),
|
|
|
|
('uk', 'United Kingdom', 'www.tribalwars.co.uk', 'Europe/London'),
|
|
|
|
('hu', 'Hungary', 'www.klanhaboru.hu', 'Europe/Budapest'),
|
|
|
|
('it', 'Italy', 'www.tribals.it', 'Europe/Rome'),
|
|
|
|
('fr', 'France', 'www.guerretribale.fr', 'Europe/Paris'),
|
|
|
|
('us', 'United States', 'www.tribalwars.us', 'America/New_York'),
|
|
|
|
('nl', 'The Netherlands', 'www.tribalwars.nl', 'Europe/Amsterdam'),
|
|
|
|
('es', 'Spain', 'www.guerrastribales.es', 'Europe/Madrid'),
|
|
|
|
('ro', 'Romania', 'www.triburile.ro', 'Europe/Bucharest'),
|
|
|
|
('gr', 'Greece', 'www.fyletikesmaxes.gr', 'Europe/Athens'),
|
|
|
|
('br', 'Brazil', 'www.tribalwars.com.br', 'America/Sao_Paulo'),
|
|
|
|
('tr', 'Turkey', 'www.klanlar.org', 'Europe/Istanbul'),
|
|
|
|
('cs', 'Czech Republic', 'www.divokekmeny.cz', 'Europe/Prague'),
|
|
|
|
('ch', 'Switzerland', 'www.staemme.ch', 'Europe/Zurich'),
|
|
|
|
('pt', 'Portugal', 'www.tribalwars.com.pt', 'Europe/Lisbon'),
|
|
|
|
('en', 'International', 'www.tribalwars.net', 'Europe/London'),
|
|
|
|
('de', 'Germany', 'www.die-staemme.de', 'Europe/Berlin'),
|
|
|
|
('sk', 'Slovakia', 'www.divoke-kmene.sk', 'Europe/Bratislava'),
|
|
|
|
('ru', 'Russia', 'www.voynaplemyon.com', 'Europe/Moscow')
|
2023-12-20 07:03:03 +00:00
|
|
|
ON CONFLICT DO NOTHING;`)
|
|
|
|
|
|
|
|
return err
|
|
|
|
}, func(ctx context.Context, db *bun.DB) error {
|
|
|
|
_, err := db.ExecContext(ctx, "drop table if exists versions CASCADE;")
|
|
|
|
return err
|
|
|
|
})
|
|
|
|
}
|