feat: expand opt-in capability coverage with versioned consent

This commit is contained in:
Paul Nothaft
2026-09-06 00:56:58 +02:00
parent 5d31b61c8d
commit a7382591bf
32 changed files with 6250 additions and 164 deletions
@@ -0,0 +1,20 @@
// Existing participants retain their v1 consent and v1 allowlist. New fields
// require a separate explicit, signed upgrade; migrations never opt anyone in.
exports.up = async function (knex) {
if (
(await knex.schema.hasTable('product_usage_state')) &&
!(await knex.schema.hasColumn('product_usage_state', 'consent_version'))
) {
await knex.schema.alterTable('product_usage_state', (t) => {
t.string('consent_version', 40).notNullable().defaultTo('usage-consent.v1');
});
}
};
exports.down = async function (knex) {
if (
(await knex.schema.hasTable('product_usage_state')) &&
(await knex.schema.hasColumn('product_usage_state', 'consent_version'))
) {
await knex.schema.alterTable('product_usage_state', (t) => t.dropColumn('consent_version'));
}
};