diff options
author | Paul Duncan <pabs@pablotron.org> | 2016-07-30 03:29:13 -0400 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2016-07-30 03:29:13 -0400 |
commit | 9db15612b16b140bd7958be983d93de0b943cb01 (patch) | |
tree | 125e73894b6eae719899bda00ca49842543fe49c /data/init.yaml | |
parent | 040cbfc93f870fd4242d112757bf1c52ddf7a2a0 (diff) | |
download | guff-9db15612b16b140bd7958be983d93de0b943cb01.tar.bz2 guff-9db15612b16b140bd7958be983d93de0b943cb01.zip |
populate sites api and site list
Diffstat (limited to 'data/init.yaml')
-rw-r--r-- | data/init.yaml | 75 |
1 files changed, 57 insertions, 18 deletions
diff --git a/data/init.yaml b/data/init.yaml index 34a0595..f9a8ac1 100644 --- a/data/init.yaml +++ b/data/init.yaml @@ -41,7 +41,7 @@ init_sql: password TEXT NOT NULL DEFAULT '', - is_active BOOLEAN NOT NULL DEFAULT false + is_active BOOLEAN NOT NULL DEFAULT 0 ) - | @@ -88,7 +88,7 @@ init_sql: -- is this a system theme? -- note: system themes are located in system_dir/themes/<slug>/ - is_system BOOLEAN NOT NULL DEFAULT false + is_system BOOLEAN NOT NULL DEFAULT 0 ) - | @@ -188,32 +188,67 @@ init_sql: - | CREATE TABLE sites ( - site_id INTEGER PRIMARY KEY, + site_id INTEGER PRIMARY KEY, + + -- make sure slug is lowercase, does not begin with a dot, and + -- does not contain slashes + slug TEXT UNIQUE NOT NULL CHECK ( + LENGTH(slug) > 0 AND + slug = LOWER(slug) AND + slug NOT LIKE '.%' AND + slug NOT LIKE '%/%' + ), - -- make sure name does not begin with a dot or + -- make sure slug does not begin with a dot or -- contain slashes - name TEXT UNIQUE NOT NULL CHECK ( - LENGTH(name) > 0 AND - name NOT LIKE '.%' AND - name NOT LIKE '%/%' - ), + name TEXT UNIQUE NOT NULL + CHECK (LENGTH(name) > 0), + + -- site description + body TEXT NOT NULL DEFAULT '', + + -- site description + lang TEXT NOT NULL DEFAULT 'en-US' CHECK ( + -- e.g. 'en' or 'en-US' + (LENGTH(lang) = 2 OR LENGTH(lang) = 5) AND + (lang LIKE '__' OR lang LIKE '__-__') + ), -- date that site was created - created_at TIMESTAMP WITH TIME ZONE NOT NULL - DEFAULT CURRENT_TIMESTAMP, + created_at TIMESTAMP WITH TIME ZONE NOT NULL + DEFAULT CURRENT_TIMESTAMP, -- theme for this site - theme_id INTEGER NOT NULL - REFERENCES themes(theme_id), + theme_id INTEGER NOT NULL + REFERENCES themes(theme_id), + + -- disabled: too fucking complicated with "is_default" + -- is this site active + -- is_active BOOLEAN NOT NULL DEFAULT 0, - is_active BOOLEAN NOT NULL DEFAULT false, + -- is this the default site + is_default BOOLEAN NOT NULL DEFAULT 0, - is_default BOOLEAN NOT NULL DEFAULT false + -- use full body for rss and atom feeds + is_full_feed BOOLEAN NOT NULL DEFAULT 1 ) - | - INSERT INTO sites(site_id, name, theme_id, is_active, is_default) VALUES - (1, 'default', 1, 1, 1) + INSERT INTO sites ( + site_id, + slug, + name, + body, + theme_id, + is_default + ) VALUES ( + 1, + 'default', + 'Default', + 'True guff stuff.', + 1, + 1 + ) - | CREATE TABLE site_domains ( @@ -224,7 +259,11 @@ init_sql: LENGTH(domain) > 0 AND domain = LOWER(domain) AND domain NOT LIKE '% %' - ) + ), + + sort_order INTEGER NOT NULL, + + PRIMARY KEY (site_id, domain) ) - | |