Loading migrate/migrate.go +1 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ type migrationService struct { func StartupCheck(logger *zap.Logger, db *sql.DB) { migrate.SetTable(migrationTable) migrate.SetIgnoreUnknown(true) ms := &migrate.AssetMigrationSource{ Asset: func(path string) ([]byte, error) { Loading migrate/sql/20210416090601-purchase.sql +2 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ DROP TABLE IF EXISTS purchase_receipt; CREATE TABLE IF NOT EXISTS purchase ( PRIMARY KEY (transaction_id), FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE SET NULL, create_time TIMESTAMPTZ NOT NULL DEFAULT now(), environment SMALLINT NOT NULL DEFAULT 0, -- Unknown(0), Sandbox(1), Production(2) Loading @@ -28,7 +29,7 @@ CREATE TABLE IF NOT EXISTS purchase ( store SMALLINT NOT NULL DEFAULT 0, -- AppleAppStore(0), GooglePlay(1), Huawei(2) transaction_id VARCHAR(512) NOT NULL CHECK (length(transaction_id) > 0), update_time TIMESTAMPTZ NOT NULL DEFAULT now(), user_id UUID NOT NULL user_id UUID DEFAULT NULL ); CREATE INDEX IF NOT EXISTS purchase_user_id_purchase_time_transaction_id_idx ON purchase (user_id, purchase_time DESC, transaction_id); Loading @@ -38,7 +39,6 @@ DROP TABLE IF EXISTS purchase; CREATE TABLE IF NOT EXISTS purchase_receipt ( PRIMARY KEY (receipt), FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE NO ACTION, create_time TIMESTAMPTZ NOT NULL DEFAULT now(), product_id VARCHAR(512) NOT NULL, Loading Loading
migrate/migrate.go +1 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ type migrationService struct { func StartupCheck(logger *zap.Logger, db *sql.DB) { migrate.SetTable(migrationTable) migrate.SetIgnoreUnknown(true) ms := &migrate.AssetMigrationSource{ Asset: func(path string) ([]byte, error) { Loading
migrate/sql/20210416090601-purchase.sql +2 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ DROP TABLE IF EXISTS purchase_receipt; CREATE TABLE IF NOT EXISTS purchase ( PRIMARY KEY (transaction_id), FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE SET NULL, create_time TIMESTAMPTZ NOT NULL DEFAULT now(), environment SMALLINT NOT NULL DEFAULT 0, -- Unknown(0), Sandbox(1), Production(2) Loading @@ -28,7 +29,7 @@ CREATE TABLE IF NOT EXISTS purchase ( store SMALLINT NOT NULL DEFAULT 0, -- AppleAppStore(0), GooglePlay(1), Huawei(2) transaction_id VARCHAR(512) NOT NULL CHECK (length(transaction_id) > 0), update_time TIMESTAMPTZ NOT NULL DEFAULT now(), user_id UUID NOT NULL user_id UUID DEFAULT NULL ); CREATE INDEX IF NOT EXISTS purchase_user_id_purchase_time_transaction_id_idx ON purchase (user_id, purchase_time DESC, transaction_id); Loading @@ -38,7 +39,6 @@ DROP TABLE IF EXISTS purchase; CREATE TABLE IF NOT EXISTS purchase_receipt ( PRIMARY KEY (receipt), FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE NO ACTION, create_time TIMESTAMPTZ NOT NULL DEFAULT now(), product_id VARCHAR(512) NOT NULL, Loading