1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-14 02:42:40 +01:00
phorge-phorge/resources/sql/patches/20121226.config.sql
Ricky Elrod a774620042 Start of a config web interface.
Summary:
This is somewhat clowny, particularly in how it handles JSON encode/decode, but
I've commented why I did things the way I did. The goal is to store minified JSON
but show pretty-printed JSON where possible, to the user editing it.

Test Plan:
* Went to /config/ and saw a list of keys from the `default` config.
* Clicked on one of them, submitted the default value successfully.
* Changed the value to invalid JSON and got a decent error.
* Changed the value to valid JSON and checked the DB to confirm it saved.
* Confirmed the DB values were minified.
* Confirmed the user-facing values were pretty-printed where they could be.
* Confirmed that PHIDs were getting assigned properly and that isDeleted
  properly defaulted to false/0.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T2246

Differential Revision: https://secure.phabricator.com/D4290
2012-12-27 15:21:21 -08:00

12 lines
533 B
SQL

CREATE TABLE {$NAMESPACE}_config.config_entry (
`id` INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
`phid` VARCHAR(64) NOT NULL COLLATE utf8_bin,
`namespace` VARCHAR(64) BINARY NOT NULL COLLATE utf8_bin,
`configKey` VARCHAR(64) BINARY NOT NULL COLLATE utf8_bin,
`value` LONGTEXT NOT NULL,
`isDeleted` BOOL NOT NULL,
`dateCreated` INT UNSIGNED NOT NULL,
`dateModified` INT UNSIGNED NOT NULL,
UNIQUE KEY `key_phid` (`phid`),
UNIQUE KEY `key_name` (`namespace`, `configKey`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;