Loading CHANGELOG.md +1 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr ## [Unreleased] ### Changed - Update sql-migrate library to a32ed26. - Rework some migrations for better compatibility with different database engines. ## [3.2.0] - 2021-04-14 ### Added Loading migrate/migrate.go +1 −0 Original line number Diff line number Diff line Loading @@ -109,6 +109,7 @@ func Parse(args []string, tmpLogger *zap.Logger) { } migrate.SetTable(migrationTable) migrate.SetIgnoreUnknown(true) ms := &migrationService{ migrations: &migrate.AssetMigrationSource{ Asset: func(path string) ([]byte, error) { Loading migrate/sql/20180805174141-tournaments.sql +4 −2 Original line number Diff line number Diff line Loading @@ -30,8 +30,10 @@ ALTER TABLE leaderboard ALTER TABLE leaderboard_record ADD COLUMN max_num_score INT NOT NULL DEFAULT 1000000 CHECK (max_num_score > 0); CREATE INDEX IF NOT EXISTS duration_start_time_end_time_category_idx ON leaderboard (duration, start_time, end_time DESC, category); CREATE INDEX IF NOT EXISTS owner_id_expiry_time_leaderboard_id_idx ON leaderboard_record (owner_id, expiry_time, leaderboard_id); CREATE INDEX IF NOT EXISTS duration_start_time_end_time_category_idx ON leaderboard (duration, start_time, end_time DESC, category); CREATE INDEX IF NOT EXISTS owner_id_expiry_time_leaderboard_id_idx ON leaderboard_record (owner_id, expiry_time, leaderboard_id); -- +migrate Down DROP INDEX IF EXISTS duration_start_time_end_time_category_idx; Loading migrate/sql/20210318140137-receipt.sqldeleted 100644 → 0 +0 −27 Original line number Diff line number Diff line /* * Copyright 2020 The Nakama Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ -- +migrate Up ALTER TABLE purchase_receipt DROP CONSTRAINT IF EXISTS purchase_receipt_pkey, -- Drop primary key constraint for Postgres DROP CONSTRAINT IF EXISTS "primary", -- Drop primary key constraint for Cockroach ADD CONSTRAINT purchase_receipt_pkey PRIMARY KEY (transaction_id); -- +migrate Down ALTER TABLE purchase_receipt ADD COLUMN IF NOT EXISTS receipt TEXT NOT NULL CHECK (length(receipt) > 0), DROP CONSTRAINT purchase_receipt_pkey, ADD CONSTRAINT purchase_receipt_pkey PRIMARY KEY (receipt); migrate/sql/20210318140138-receipt.sqldeleted 100644 → 0 +0 −25 Original line number Diff line number Diff line /* * Copyright 2020 The Nakama Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ -- +migrate Up ALTER TABLE purchase_receipt ADD COLUMN environment SMALLINT NOT NULL DEFAULT 0, -- Unknown(0), Sandbox(1), Production(2) DROP COLUMN IF EXISTS receipt; -- +migrate Down ALTER TABLE purchase_receipt ADD COLUMN IF NOT EXISTS receipt TEXT NOT NULL CHECK (length(receipt) > 0), DROP COLUMN IF EXISTS environment; Loading
CHANGELOG.md +1 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr ## [Unreleased] ### Changed - Update sql-migrate library to a32ed26. - Rework some migrations for better compatibility with different database engines. ## [3.2.0] - 2021-04-14 ### Added Loading
migrate/migrate.go +1 −0 Original line number Diff line number Diff line Loading @@ -109,6 +109,7 @@ func Parse(args []string, tmpLogger *zap.Logger) { } migrate.SetTable(migrationTable) migrate.SetIgnoreUnknown(true) ms := &migrationService{ migrations: &migrate.AssetMigrationSource{ Asset: func(path string) ([]byte, error) { Loading
migrate/sql/20180805174141-tournaments.sql +4 −2 Original line number Diff line number Diff line Loading @@ -30,8 +30,10 @@ ALTER TABLE leaderboard ALTER TABLE leaderboard_record ADD COLUMN max_num_score INT NOT NULL DEFAULT 1000000 CHECK (max_num_score > 0); CREATE INDEX IF NOT EXISTS duration_start_time_end_time_category_idx ON leaderboard (duration, start_time, end_time DESC, category); CREATE INDEX IF NOT EXISTS owner_id_expiry_time_leaderboard_id_idx ON leaderboard_record (owner_id, expiry_time, leaderboard_id); CREATE INDEX IF NOT EXISTS duration_start_time_end_time_category_idx ON leaderboard (duration, start_time, end_time DESC, category); CREATE INDEX IF NOT EXISTS owner_id_expiry_time_leaderboard_id_idx ON leaderboard_record (owner_id, expiry_time, leaderboard_id); -- +migrate Down DROP INDEX IF EXISTS duration_start_time_end_time_category_idx; Loading
migrate/sql/20210318140137-receipt.sqldeleted 100644 → 0 +0 −27 Original line number Diff line number Diff line /* * Copyright 2020 The Nakama Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ -- +migrate Up ALTER TABLE purchase_receipt DROP CONSTRAINT IF EXISTS purchase_receipt_pkey, -- Drop primary key constraint for Postgres DROP CONSTRAINT IF EXISTS "primary", -- Drop primary key constraint for Cockroach ADD CONSTRAINT purchase_receipt_pkey PRIMARY KEY (transaction_id); -- +migrate Down ALTER TABLE purchase_receipt ADD COLUMN IF NOT EXISTS receipt TEXT NOT NULL CHECK (length(receipt) > 0), DROP CONSTRAINT purchase_receipt_pkey, ADD CONSTRAINT purchase_receipt_pkey PRIMARY KEY (receipt);
migrate/sql/20210318140138-receipt.sqldeleted 100644 → 0 +0 −25 Original line number Diff line number Diff line /* * Copyright 2020 The Nakama Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ -- +migrate Up ALTER TABLE purchase_receipt ADD COLUMN environment SMALLINT NOT NULL DEFAULT 0, -- Unknown(0), Sandbox(1), Production(2) DROP COLUMN IF EXISTS receipt; -- +migrate Down ALTER TABLE purchase_receipt ADD COLUMN IF NOT EXISTS receipt TEXT NOT NULL CHECK (length(receipt) > 0), DROP COLUMN IF EXISTS environment;