mirror of
https://github.com/Haidra-Org/AI-Horde.git
synced 2026-11-06 05:17:31 +00:00
- WaitingPrompt.style_id records the style a request runs under, the drawn style for a collection, and record_image_statistic and record_text_statistic copy it to image_gen_stats.style_id and text_gen_stats.style_id, so style use can be grouped per style - the columns are nullable UUIDs with no foreign key, so a deleted style leaves its statistics in place; sql_statements/5.1.13.txt adds them as catalogue-only changes - integration tests check a queued text and image request records its style, the drawn style under a collection, and none when unstyled; unit tests check the text statistic copies it
42 lines
2.1 KiB
Plaintext
42 lines
2.1 KiB
Plaintext
-- Run with psql in its default autocommit mode. Pass -v ON_ERROR_STOP=1 so a
|
|
-- failure stops the migration.
|
|
--
|
|
-- Two optional declarations a style can carry alongside its prompt and params:
|
|
-- which params a request may still set and the ceilings it may not exceed
|
|
-- (parameter_policy), and the placeholders the style's prompt accepts
|
|
-- (template_fields). Both are nullable, so an existing style keeps its current
|
|
-- behaviour with both columns null. Adding a nullable column with no default is
|
|
-- a catalogue-only change in PostgreSQL: no table rewrite, and only a brief
|
|
-- AccessExclusiveLock. An older application version ignores the columns, so this
|
|
-- migration can be applied before the code that reads them is deployed.
|
|
SET lock_timeout = '3s';
|
|
|
|
ALTER TABLE styles
|
|
ADD COLUMN IF NOT EXISTS parameter_policy JSONB NULL;
|
|
ALTER TABLE styles
|
|
ADD COLUMN IF NOT EXISTS template_fields JSONB NULL;
|
|
|
|
COMMENT ON COLUMN styles.parameter_policy IS
|
|
'Which generation params a request under this style may set, and the ceilings it may not exceed. Null means none.';
|
|
COMMENT ON COLUMN styles.template_fields IS
|
|
'The placeholders this style''s prompt accepts from the request, beyond {p}. Null means none.';
|
|
|
|
-- The style a generation ran under, recorded on the waiting prompt and copied to
|
|
-- the generation statistic on submit, so style use can be analysed per style. A
|
|
-- collection request records the style drawn from it. Nullable with no default
|
|
-- and no foreign key, so these are catalogue-only changes as well, and a deleted
|
|
-- style leaves its statistics in place.
|
|
ALTER TABLE waiting_prompts
|
|
ADD COLUMN IF NOT EXISTS style_id UUID NULL;
|
|
ALTER TABLE image_gen_stats
|
|
ADD COLUMN IF NOT EXISTS style_id UUID NULL;
|
|
ALTER TABLE text_gen_stats
|
|
ADD COLUMN IF NOT EXISTS style_id UUID NULL;
|
|
|
|
COMMENT ON COLUMN waiting_prompts.style_id IS
|
|
'The style the request runs under, drawn from a collection when the request specified one. Null when unstyled.';
|
|
COMMENT ON COLUMN image_gen_stats.style_id IS
|
|
'The style the generation ran under. Null when unstyled.';
|
|
COMMENT ON COLUMN text_gen_stats.style_id IS
|
|
'The style the generation ran under. Null when unstyled.';
|