Yuvipanda has submitted this change and it was merged.

Change subject: labs: Add db structure for keeping info about labsdb accounts
......................................................................


labs: Add db structure for keeping info about labsdb accounts

Bug: T149933
Change-Id: If98e7877151173623b96b168d44a82464b6e59e0
---
A modules/role/files/labs/db/maintain-dbusers.sql
1 file changed, 20 insertions(+), 0 deletions(-)

Approvals:
  Jcrespo: Looks good to me, but someone else must approve
  Yuvipanda: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/role/files/labs/db/maintain-dbusers.sql 
b/modules/role/files/labs/db/maintain-dbusers.sql
new file mode 100644
index 0000000..da867b7
--- /dev/null
+++ b/modules/role/files/labs/db/maintain-dbusers.sql
@@ -0,0 +1,20 @@
+-- Keep state about tool / user accounts on tool labs and their mysql
+-- account counterparts. This is the canonical store of this information.
+-- Schema is set up to be able to trivially query the following things:
+--  1. What labsdb hosts does this tool / user *not* have an account on.
+--  2. What's the mysql username / password for this tool / user.
+CREATE TABLE accounts(
+    id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+    mysql_username VARCHAR(255) NOT NULL,
+    type enum('tool', 'user') NOT NULL,
+    username VARCHAR(255) NOT NULL,
+    password VARCHAR(255) NOT NULL,
+) CHARSET=utf8mb4;
+CREATE UNIQUE INDEX account_type ON accounts(type, username);
+
+CREATE TABLE account_hosts(
+    id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
+    account_id INT UNSIGNED NOT NULL,
+    hostname VARCHAR(255) NOT NULL,
+) CHARSET=utf8mb4;
+CREATE INDEX account_host_status ON accounts(account_id, hostname);

-- 
To view, visit https://gerrit.wikimedia.org/r/325268
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If98e7877151173623b96b168d44a82464b6e59e0
Gerrit-PatchSet: 4
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Yuvipanda <yuvipa...@wikimedia.org>
Gerrit-Reviewer: Jcrespo <jcre...@wikimedia.org>
Gerrit-Reviewer: Yuvipanda <yuvipa...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to