]> ruin.nu Git - ndwebbie.git/blobdiff - database/wiki.sql
Good to have time if we want to list most recent changes
[ndwebbie.git] / database / wiki.sql
index 1d00c01f2563836e96680c4b60e454377a280da1..2ec29f6c624cfd1561acc4f001608fd8cece9f72 100644 (file)
@@ -7,6 +7,7 @@ CREATE TABLE wiki_pages (
        name VARCHAR(255) NOT NULL,
        namespace TExt NOT NULL REFERENCES wiki_namespaces(namespace) DEFAULT '',
        textsearch tsvector NOT NULL DEFAULT to_tsvector(''),
+       time TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
        UNIQUE(namespace,name)
 );
 
@@ -35,6 +36,7 @@ BEGIN
                WHERE NEW.wprev = wpr.wprev;
        NEW.textsearch := rec.ts
                || setweight(to_tsvector(NEW.namespace || ':' || NEW.name), 'A');
+       NEW.time = NOW();
        return NEW;
 END;
 $$ LANGUAGE plpgsql;