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

@ -123,7 +123,7 @@ comment on column "action"."apply_object" is 'column specifies whether an acti
create table "stat"( create table "stat"(
"uid" serial not null, "uid" serial not null,
"owner" int not null default 1, "owner" int not null default 1,
"group" int not null default 2, -- 1 is a root usergroup, 2 is 'users' set as default "group" int not null default 2, -- 1 is a root usergroup, 2 is 'users' set as default
"unixperms" int not null default unix_to_numeric('764'), "unixperms" int not null default unix_to_numeric('764'),
"status" int not null default 0, "status" int not null default 0,
"name" text NOT NULL check( length(name) < 4096 ), "name" text NOT NULL check( length(name) < 4096 ),
@ -175,12 +175,11 @@ create table "user" (
"config" json DEFAULT ('{}'), "config" json DEFAULT ('{}'),
"avatar" text, "avatar" text,
"email" varchar(256) not null, "email" varchar(256) not null,
"status" integer not null,
constraint "pk_user_uid" primary key ("uid"), constraint "pk_user_uid" primary key ("uid"),
constraint "ux_user_name" unique ("name"), constraint "ux_user_name" unique ("name"),
constraint "ux_user_email" unique ("email") constraint "ux_user_email" unique ("email")
) INHERITS (stat); ) 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" ( 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 IF NEW.parent_id IS NULL THEN
NEW.parent_path = 'root'::ltree; NEW.parent_path = 'root'::ltree;
ELSEIF TG_OP = 'INSERT' OR OLD.parent_id IS NULL OR OLD.parent_id != NEW.parent_id THEN 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 IF path IS NULL THEN
RAISE exception 'Invalid parent_uid %', NEW.parent_id; RAISE exception 'Invalid parent_uid %', NEW.parent_id;
END IF; END IF;
@ -281,7 +280,6 @@ create table "category"(
) INHERITS (stat); ) INHERITS (stat);
create index "ix_category_parent_path" on "category" using GIST ("parent_path"); 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_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_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(); 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'; 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"."description" is '';
comment on column "category"."parent_path" is ''; comment on column "category"."parent_path" is '';
/* /*
create table "measurands"( create table "measurands"(
"id" serial not null unique primary key, "id" serial not null unique primary key,
@ -354,13 +353,13 @@ comment on column parameters.ptype IS '''stored'' parameter is a parameter whic
*/ */
create table "item"( create table "item"(
"category_id" int NOT NULL, "category_id" int NOT NULL,
"symbol" text NOT NULL, "symbol" text NOT NULL,
"original_symbol" text, "original_symbol" text,
"producer" text, "producer" text,
-- name_scope VARCHAR(64) DEFAULT 'std' NOT NULL, "visibility" VARCHAR(64) DEFAULT 'global' NOT NULL,
"attributes" jsonb NOT NULL DEFAULT('{}'), "attributes" jsonb NOT NULL DEFAULT('{}'),
description TEXT, "description" TEXT,
constraint "pk_items" primary key ("uid"), 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_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 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 index "ix_item_attributes" on "item" USING GIN ("attributes");
create unique index "ux_item" on "item"("name", "symbol"); 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(); 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"( 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. // Create a navigation bar with a link to a web page.
Wt::WNavigationBar * navigation = new Wt::WNavigationBar(container); 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); navigation->setResponsive(true);
Wt::WStackedWidget * contentsStack = new Wt::WStackedWidget(container); Wt::WStackedWidget * contentsStack = new Wt::WStackedWidget(container);
@ -192,8 +192,6 @@ class AuthApplication : public Wt::WApplication {
std::unique_ptr< eedb::auth::PgUserAuth > userDatabase_; std::unique_ptr< eedb::auth::PgUserAuth > userDatabase_;
Wt::Auth::Login login_; Wt::Auth::Login login_;
Wt::Auth::AuthWidget * _loginWidget; Wt::Auth::AuthWidget * _loginWidget;
Wt::WWidget * homePage_;
Wt::WContainerWidget * sideBarContent_;
}; };
Wt::WApplication * createApplication(const Wt::WEnvironment & env) { 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> #include <Wt/WWidget>
namespace eedb { namespace eedb {
class Home : public WWidget { class Home : public Wt::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;
}; };
} }