naco-api/sql/schema/003_add_cache_version.sql

15 lines
583 B
SQL

-- +goose up
ALTER TABLE user_style_profiles
ADD COLUMN IF NOT EXISTS model_version INTEGER NOT NULL DEFAULT 1,
ADD COLUMN IF NOT EXISTS schema_version INTEGER NOT NULL DEFAULT 1,
ADD COLUMN IF NOT EXISTS algorithm_version INTEGER NOT NULL DEFAULT 1;
CREATE INDEX IF NOT EXISTS idx_user_style_profiles_versions
ON user_style_profiles (model_version, schema_version, algorithm_version);
-- +goose down
DROP INDEX idx_user_style_profiles_versions;
ALTER TABLE user_style_profiles
DROP COLUMN algorithm_version,
DROP COLUMN model_version,
DROP COLUMN schema_version;