add new empty files, remove one index from categories table

This commit is contained in:
Wieczorek Bartosz 2017-02-26 18:47:39 +01:00
parent 9148ae53f9
commit 63b9813012
6 changed files with 19 additions and 82 deletions

View File

@ -175,12 +175,11 @@ create table "user" (
"config" json DEFAULT ('{}'),
"avatar" text,
"email" varchar(256) not null,
"status" integer not null,
constraint "pk_user_uid" primary key ("uid"),
constraint "ux_user_name" unique ("name"),
constraint "ux_user_email" unique ("email")
) INHERITS (stat);
create trigger update_user_last_update before update on "user" FOR EACH ROW EXECUTE PROCEDURE last_update_column();
create trigger "update_user_last_update" before update on "user" FOR EACH ROW EXECUTE PROCEDURE last_update_column();
create table "user_action" (
@ -261,7 +260,7 @@ create or replace function update_category_parent_path() returns trigger as $$
IF NEW.parent_id IS NULL THEN
NEW.parent_path = 'root'::ltree;
ELSEIF TG_OP = 'INSERT' OR OLD.parent_id IS NULL OR OLD.parent_id != NEW.parent_id THEN
SELECT parent_path || uid::text FROM categories WHERE uid = NEW.parent_id INTO path;
SELECT parent_path || uid::text FROM "category" WHERE uid = NEW.parent_id INTO path;
IF path IS NULL THEN
RAISE exception 'Invalid parent_uid %', NEW.parent_id;
END IF;
@ -281,7 +280,6 @@ create table "category"(
) INHERITS (stat);
create index "ix_category_parent_path" on "category" using GIST ("parent_path");
create unique index "ux_category_name" on "category" ( "parent_id", "name" );
create unique index "ux_category_parent" on "category" ( "parent_id", "uid" );
create trigger "update_category_last_update" before update on "category" FOR EACH ROW EXECUTE PROCEDURE last_update_column();
create trigger "update_category_parent_path" before insert or update on "category" FOR EACH ROW EXECUTE PROCEDURE update_category_parent_path();
comment on table "category" is 'categories of items';
@ -289,6 +287,7 @@ comment on column "category"."parent_id" is '';
comment on column "category"."description" is '';
comment on column "category"."parent_path" is '';
/*
create table "measurands"(
"id" serial not null unique primary key,
@ -358,9 +357,9 @@ create table "item"(
"symbol" text NOT NULL,
"original_symbol" text,
"producer" text,
-- name_scope VARCHAR(64) DEFAULT 'std' NOT NULL,
"visibility" VARCHAR(64) DEFAULT 'global' NOT NULL,
"attributes" jsonb NOT NULL DEFAULT('{}'),
description TEXT,
"description" TEXT,
constraint "pk_items" primary key ("uid"),
constraint "fk_item_category" foreign key ("category_id") references "category"("uid") on delete cascade deferrable initially deferred,
constraint "fk_item_user" foreign key ("owner") REFERENCES "user"("uid") deferrable initially IMMEDIATE
@ -368,6 +367,9 @@ create table "item"(
create index "ix_item_attributes" on "item" USING GIN ("attributes");
create unique index "ux_item" on "item"("name", "symbol");
create trigger update_item_last_update before update on item FOR EACH ROW EXECUTE PROCEDURE last_update_column();
comment on table "item" is '';
comment on column "item"."category_id" is '';
comment on column "item"."visibility" is '';
create table "inventory"(

View File

@ -87,7 +87,7 @@ class AuthApplication : public Wt::WApplication {
// Create a navigation bar with a link to a web page.
Wt::WNavigationBar * navigation = new Wt::WNavigationBar(container);
navigation->setTitle("Corpy Inc.", "http://www.google.com/search?q=corpy+inc");
navigation->setTitle("eedb", "http://eedb.pl");
navigation->setResponsive(true);
Wt::WStackedWidget * contentsStack = new Wt::WStackedWidget(container);
@ -192,8 +192,6 @@ class AuthApplication : public Wt::WApplication {
std::unique_ptr< eedb::auth::PgUserAuth > userDatabase_;
Wt::Auth::Login login_;
Wt::Auth::AuthWidget * _loginWidget;
Wt::WWidget * homePage_;
Wt::WContainerWidget * sideBarContent_;
};
Wt::WApplication * createApplication(const Wt::WEnvironment & env) {

View File

View File

View File

@ -0,0 +1,3 @@
#include <eedb/widgets/MainWindow.hpp>
namespace eedb {}

View File

@ -1,72 +1,6 @@
#include <Wt/WWidget>
namespace eedb {
class Home : public WWidget {
public:
Home(const WEnvironment & env, Wt::Dbo::SqlConnectionPool & blogDb, const std::string & title, const std::string & resourceBundle,
const std::string & cssPath);
virtual ~Home();
void googleAnalyticsLogger();
protected:
virtual WWidget * examples() = 0;
virtual WWidget * createQuoteForm() = 0;
virtual WWidget * sourceViewer(const std::string & deployPath) = 0;
virtual std::string filePrefix() const = 0;
void init();
void addLanguage(const Lang & l) {
languages.push_back(l);
}
WWidget * linkSourceBrowser(const std::string & examplePath);
WTabWidget * examplesMenu_;
WString tr(const char * key);
std::string href(const std::string & url, const std::string & description);
WTable * releases_;
void readReleases(WTable * releaseTable);
private:
Wt::Dbo::SqlConnectionPool & blogDb_;
WWidget * homePage_;
WWidget * sourceViewer_;
WStackedWidget * contents_;
void createHome();
WWidget * introduction();
WWidget * blog();
WWidget * status();
WWidget * features();
WWidget * documentation();
WWidget * community();
WWidget * otherLanguage();
WWidget * download();
WWidget * quoteForm();
WMenu * mainMenu_;
int language_;
void readNews(WTable * newsTable, const std::string & newsfile);
WWidget * wrapView(WWidget * (Home::*createFunction)());
void updateTitle();
void setLanguage(int language);
void setLanguageFromPath();
void setup();
void logInternalPath(const std::string & path);
void chatSetUser(const WString & name);
WContainerWidget * sideBarContent_;
std::vector< Lang > languages;
class Home : public Wt::WWidget {
};
}