Ejegg has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/183379

Change subject: Persistence schema
......................................................................

Persistence schema

Add tables for users, dashboards, and widgets.  Populate widget
tables with definitions of existing widgets, add preview images.

Change-Id: I42b167b83dea0af2300890e176794380b7577572
---
A persistence.sql
A src/images/big-english.png
A src/images/fraud-gauge.png
A src/images/x-by-y.png
4 files changed, 48 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/dash 
refs/changes/79/183379/1

diff --git a/persistence.sql b/persistence.sql
new file mode 100644
index 0000000..c3fe6ba
--- /dev/null
+++ b/persistence.sql
@@ -0,0 +1,48 @@
+CREATE TABLE IF NOT EXISTS dash_user(
+       id INT AUTO_INCREMENT PRIMARY KEY, /* local id */
+       oauth_id VARCHAR(255), /* remote unique id */
+       oauth_provider VARCHAR(255), /* service that gave us the remote id */
+       display_name VARCHAR(255), /* display name provided by oauth */
+       default_board INT,
+       UNIQUE (oauth_id, oauth_provider)
+);
+/* List of available widgets */
+CREATE TABLE IF NOT EXISTS dash_widget(
+       id INT AUTO_INCREMENT PRIMARY KEY,
+       code VARCHAR(255), /* used in data and metadata URLs */
+       display_name VARCHAR(255),
+       preview_path VARCHAR(255), /* preview image */
+       UNIQUE (code) 
+);
+/* Saved widget configurations */
+CREATE TABLE IF NOT EXISTS dash_widget_instance(
+       id INT AUTO_INCREMENT PRIMARY KEY,
+       widget_id INT,
+       owner_id INT,
+       is_shared BIT DEFAULT 0,
+       configuration TEXT, /* json blob */
+       FOREIGN KEY (widget_id) REFERENCES dash_widget(id),
+       FOREIGN KEY (owner_id) REFERENCES dash_user(id)
+);
+/* List of available boards */
+CREATE TABLE IF NOT EXISTS dash_board(
+       id INT AUTO_INCREMENT PRIMARY KEY,
+       display_name VARCHAR(255),
+       owner_id INT NOT NULL,
+       is_shared BIT DEFAULT 0,
+       FOREIGN KEY (owner_id) REFERENCES dash_user(id)
+);
+/* Places widget instances on boards */
+CREATE TABLE IF NOT EXISTS dash_widget_instance_board(
+       id INT AUTO_INCREMENT PRIMARY KEY,
+       instance_id INT,
+       board_id INT,
+       widget_position INT,
+       FOREIGN KEY (instance_id) REFERENCES dash_widget_instance(id),
+       FOREIGN KEY (board_id) REFERENCES dash_board(id)
+);
+
+/* Add definitions for existing widgets */
+INSERT IGNORE INTO dash_widget ( code, display_name, preview_path ) VALUES ( 
'fraud', 'Fraud Gauge', 'images/fraud.png' );
+INSERT IGNORE INTO dash_widget ( code, display_name, preview_path ) VALUES ( 
'big-english', 'Big English', 'images/big-english.png' );
+INSERT IGNORE INTO dash_widget ( code, display_name, preview_path ) VALUES ( 
'x-by-y', 'X by Y', 'images/x-by-y.png' );
diff --git a/src/images/big-english.png b/src/images/big-english.png
new file mode 100644
index 0000000..4cc6b7f
--- /dev/null
+++ b/src/images/big-english.png
Binary files differ
diff --git a/src/images/fraud-gauge.png b/src/images/fraud-gauge.png
new file mode 100644
index 0000000..c92eda9
--- /dev/null
+++ b/src/images/fraud-gauge.png
Binary files differ
diff --git a/src/images/x-by-y.png b/src/images/x-by-y.png
new file mode 100644
index 0000000..779b255
--- /dev/null
+++ b/src/images/x-by-y.png
Binary files differ

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I42b167b83dea0af2300890e176794380b7577572
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/dash
Gerrit-Branch: master
Gerrit-Owner: Ejegg <eeggles...@wikimedia.org>

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

Reply via email to