[odrs-web/production] Move the schema to a different file
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [odrs-web/production] Move the schema to a different file
- Date: Mon, 26 Sep 2016 09:46:55 +0000 (UTC)
commit ea52a95358bc479eee3bdd746f59332a65d5cd5e
Author: Richard Hughes <richard hughsie com>
Date: Mon Sep 26 10:21:18 2016 +0100
Move the schema to a different file
README.md | 54 +-----------------------------------------------------
schema.sql | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 54 insertions(+), 53 deletions(-)
---
diff --git a/README.md b/README.md
index dfdd9a5..07f15aa 100644
--- a/README.md
+++ b/README.md
@@ -10,59 +10,7 @@ To set up the database tables do:
CREATE USER 'test'@'localhost' IDENTIFIED BY 'test';
USE odrs;
GRANT ALL ON odrs.* TO 'test'@'localhost';
- CREATE TABLE reviews (
- review_id INT NOT NULL AUTO_INCREMENT,
- date_created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
- date_deleted TIMESTAMP,
- app_id TEXT DEFAULT NULL,
- locale TEXT DEFAULT NULL,
- summary TEXT DEFAULT NULL,
- description TEXT DEFAULT NULL,
- user_hash TEXT DEFAULT NULL,
- user_addr TEXT DEFAULT NULL,
- user_display TEXT DEFAULT NULL,
- version TEXT DEFAULT NULL,
- distro TEXT DEFAULT NULL,
- rating INT DEFAULT 0,
- karma_up INT DEFAULT 0,
- karma_down INT DEFAULT 0,
- reported INT DEFAULT 0,
- UNIQUE KEY id (review_id)
- ) CHARSET=utf8;
- CREATE TABLE votes (
- vote_id INT NOT NULL AUTO_INCREMENT,
- date_created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
- user_hash TEXT DEFAULT NULL,
- val INT DEFAULT 0,
- review_id INT DEFAULT 0,
- UNIQUE KEY id (vote_id)
- ) CHARSET=utf8;
- CREATE TABLE users (
- user_id INT NOT NULL AUTO_INCREMENT,
- date_created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
- user_hash TEXT DEFAULT NULL,
- karma INT DEFAULT 0,
- is_banned INT DEFAULT 0,
- password TEXT DEFAULT NULL,
- UNIQUE KEY id (user_id)
- ) CHARSET=utf8;
- CREATE TABLE eventlog (
- eventlog_id INT NOT NULL AUTO_INCREMENT,
- date_created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
- user_addr TEXT DEFAULT NULL,
- user_hash TEXT DEFAULT NULL,
- app_id TEXT DEFAULT NULL,
- important INT DEFAULT 0,
- message TEXT DEFAULT NULL,
- UNIQUE KEY id (eventlog_id)
- ) CHARSET=utf8;
- CREATE TABLE analytics (
- datestr INT DEFAULT 0,
- app_id VARCHAR(64) DEFAULT NULL,
- fetch_cnt INT DEFAULT 1,
- UNIQUE (datestr,app_id)
- ) CHARSET=utf8;
- CREATE INDEX date_created_idx ON eventlog (date_created);
+ SOURCE /path/to/schema.sql
## How do I backup the data ##
diff --git a/schema.sql b/schema.sql
new file mode 100644
index 0000000..fa90b3b
--- /dev/null
+++ b/schema.sql
@@ -0,0 +1,53 @@
+CREATE TABLE reviews (
+ review_id INT NOT NULL AUTO_INCREMENT,
+ date_created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ date_deleted TIMESTAMP,
+ app_id TEXT DEFAULT NULL,
+ locale TEXT DEFAULT NULL,
+ summary TEXT DEFAULT NULL,
+ description TEXT DEFAULT NULL,
+ user_hash TEXT DEFAULT NULL,
+ user_addr TEXT DEFAULT NULL,
+ user_display TEXT DEFAULT NULL,
+ version TEXT DEFAULT NULL,
+ distro TEXT DEFAULT NULL,
+ rating INT DEFAULT 0,
+ karma_up INT DEFAULT 0,
+ karma_down INT DEFAULT 0,
+ reported INT DEFAULT 0,
+ UNIQUE KEY id (review_id)
+) CHARSET=utf8;
+CREATE TABLE votes (
+ vote_id INT NOT NULL AUTO_INCREMENT,
+ date_created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ user_hash TEXT DEFAULT NULL,
+ val INT DEFAULT 0,
+ review_id INT DEFAULT 0,
+ UNIQUE KEY id (vote_id)
+) CHARSET=utf8;
+CREATE TABLE users (
+ user_id INT NOT NULL AUTO_INCREMENT,
+ date_created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ user_hash TEXT DEFAULT NULL,
+ karma INT DEFAULT 0,
+ is_banned INT DEFAULT 0,
+ password TEXT DEFAULT NULL,
+ UNIQUE KEY id (user_id)
+) CHARSET=utf8;
+CREATE TABLE eventlog (
+ eventlog_id INT NOT NULL AUTO_INCREMENT,
+ date_created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ user_addr TEXT DEFAULT NULL,
+ user_hash TEXT DEFAULT NULL,
+ app_id TEXT DEFAULT NULL,
+ important INT DEFAULT 0,
+ message TEXT DEFAULT NULL,
+ UNIQUE KEY id (eventlog_id)
+) CHARSET=utf8;
+CREATE TABLE analytics (
+ datestr INT DEFAULT 0,
+ app_id VARCHAR(64) DEFAULT NULL,
+ fetch_cnt INT DEFAULT 1,
+ UNIQUE (datestr,app_id)
+) CHARSET=utf8;
+CREATE INDEX date_created_idx ON eventlog (date_created);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]