wiki.techinc.nl/maintenance/sqlite/archives/patch-user_autocreate_serial-uas_year.sql
Thalia caf9912323 Use year in temporary user names and restart index each year
Why:

* Part of a temporary user name is generated from an index that
  increments, which is stored in the database.
* As specified in T345855, the index will be restarted each year.
* Also specified in T345855, the year will be included in
  generated temporary user names.

What:
* Since the year must be included in the name in order to avoid
  naming conflicts if the index is restarted each year, both are
  implemented together and controlled by a single config.
* Add a new config option that, when true, restarts the name
  generation index at the start of each year and add the year into
  the user name: $wgAutoCreateTempUser['serialProvider']['useYear']
* Add a uas_year column to the user_autocreate_serial table, which
  is unique in combination with uas_shard, so the index can be
  stored for each shard/year combination.
* The year is added into the username just after the prefix, as
  specified in T345855. This is based on research that having the
  year near the start of the name aids understanding that the
  names are not IP addresses. The position of the year within the
  name is therefore not configurable (though whether to include
  it is). See T345855 for the research.

Bug: T349494
Bug: T349501
Depends-On: I6b3c640a4e74f52fd4a4f46de5a2cbe80fe3b665
Change-Id: If51acb3f4efa361ce36d919c862a52501a5a7d24
2024-01-05 17:14:19 +00:00

25 lines
837 B
SQL

-- This file is automatically generated using maintenance/generateSchemaChangeSql.php.
-- Source: maintenance/abstractSchemaChanges/patch-user_autocreate_serial-uas_year.json
-- Do not modify this file directly.
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
CREATE TEMPORARY TABLE /*_*/__temp__user_autocreate_serial AS
SELECT
uas_shard,
uas_value
FROM /*_*/user_autocreate_serial;
DROP TABLE /*_*/user_autocreate_serial;
CREATE TABLE /*_*/user_autocreate_serial (
uas_shard INTEGER UNSIGNED NOT NULL,
uas_year SMALLINT UNSIGNED NOT NULL,
uas_value INTEGER UNSIGNED NOT NULL,
PRIMARY KEY(uas_shard, uas_year)
);
INSERT INTO /*_*/user_autocreate_serial (uas_shard, uas_value)
SELECT
uas_shard,
uas_value
FROM
/*_*/__temp__user_autocreate_serial;
DROP TABLE /*_*/__temp__user_autocreate_serial;