Skip to content

Commit

Permalink
Merge pull request #66 from documize/db-setup
Browse files Browse the repository at this point in the history
Db setup
  • Loading branch information
HarveyKandola authored Nov 28, 2016
2 parents 428ed1b + ddb93fa commit 4849dd8
Show file tree
Hide file tree
Showing 10 changed files with 639 additions and 729 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The mission is to bring software dev inspired features (refactoring, testing, li

## Latest version

v0.34.0
v0.34.1

## OS Support

Expand Down
2 changes: 1 addition & 1 deletion app/app/pods/setup/template.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class=" page-setup container-fluid padding-100 background-color-primary">
<div class="page-setup container-fluid padding-100">
<div class="row">
<div class="col-lg-3 col-md-3 col-sm-3">
<div>
Expand Down
68 changes: 32 additions & 36 deletions app/app/templates/components/documize-setup.hbs
Original file line number Diff line number Diff line change
@@ -1,38 +1,34 @@
<div class="col-lg-9 col-md-9 col-sm-9">
<div class="input-form">
<form>
<div class="heading">
<div class="title">Let's setup Documize</div>
<div class="tip">Database name is <em>{{model.dbname}}</em></div>
</div>
<div>
<div class="input-control">
<label>Team</label>
<div class="tip">What's your tribe called?</div>
{{focus-input id="siteTitle" type="text" value=model.title class=(if hasEmptyTitleError 'error')}}
</div>
<div class="input-control">
<label>Firstname</label>
<div class="tip">What do people call you?</div>
{{input id="adminFirstname" type="text" value=model.firstname class=(if hasEmptyFirstnameError 'error')}}
</div>
<div class="input-control">
<label>Lastname</label>
<div class="tip">How the government refers to you.</div>
{{input id="adminLastname" type="text" value=model.lastname class=(if hasEmptyLastnameError 'error')}}
</div>
<div class="input-control">
<label>Email</label>
<div class="tip">No spam. Ever!</div>
{{input id="adminEmail" type="email" value=model.email class=(if hasEmptyEmailError 'error')}}
</div>
<div class="input-control">
<label>Password</label>
<div class="tip">Something you can remember without writing it down.</div>
{{input id="adminPassword" type="text" value=model.password class=(if hasEmptyPasswordError 'error')}}
</div>
<div class="regular-button button-green" {{ action 'save' }}>Go Setup</div>
</div>
</form>
</div>
<div class="form-bordered">
<div class="form-header">
<div class="title">Let's setup Documize</div>
<div class="tip">Database name is <em>{{model.dbname}}</em></div>
</div>
<div class="input-control">
<label>Team</label>
<div class="tip">What's your tribe called?</div>
{{focus-input id="siteTitle" type="text" value=model.title class=(if hasEmptyTitleError 'error')}}
</div>
<div class="input-control">
<label>Firstname</label>
<div class="tip">What do people call you?</div>
{{input id="adminFirstname" type="text" value=model.firstname class=(if hasEmptyFirstnameError 'error')}}
</div>
<div class="input-control">
<label>Lastname</label>
<div class="tip">How the government refers to you.</div>
{{input id="adminLastname" type="text" value=model.lastname class=(if hasEmptyLastnameError 'error')}}
</div>
<div class="input-control">
<label>Email</label>
<div class="tip">No spam. Ever!</div>
{{input id="adminEmail" type="email" value=model.email class=(if hasEmptyEmailError 'error')}}
</div>
<div class="input-control">
<label>Password</label>
<div class="tip">Something you can remember without writing it down.</div>
{{input id="adminPassword" type="text" value=model.password class=(if hasEmptyPasswordError 'error')}}
</div>
<div class="regular-button button-green" {{ action 'save' }}>Setup</div>
</div>
</div>
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "documize",
"version": "0.33.0",
"version": "0.34.1",
"description": "The Document IDE",
"private": true,
"directories": {
Expand Down
Binary file modified app/public/assets/img/setup/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion core/database/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func Check(Db *sqlx.DB, connectionString string) bool {
return false
}
if strings.TrimSpace(flds[0]) == "0" {
log.Error("Entering database set-up mode because the database is empty.", errors.New("no tables"))
log.Info("Entering database set-up mode because the database is empty.....")
web.SiteMode = web.SiteModeSetup
return false
}
Expand Down
5 changes: 5 additions & 0 deletions core/database/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ func Create(w http.ResponseWriter, r *http.Request) {
dbname := r.Form.Get("dbname")
dbhash := r.Form.Get("dbhash")

fmt.Println(dbname)
fmt.Println(dbhash)
fmt.Println(web.SiteInfo.DBname)
fmt.Println(web.SiteInfo.DBhash)

if dbname != web.SiteInfo.DBname || dbhash != web.SiteInfo.DBhash {
log.Error("database.Create()'s security credentials error ", errors.New("bad db name or validation code"))
return
Expand Down
91 changes: 0 additions & 91 deletions core/database/scripts/autobuild/db_00000.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ CREATE TABLE IF NOT EXISTS `user` (
`lastname` NVARCHAR(500) NOT NULL,
`email` NVARCHAR(250) NOT NULL UNIQUE,
`initials` NVARCHAR(10) NOT NULL DEFAULT "",
`global` BOOL NOT NULL DEFAULT 0,
`password` NVARCHAR(500) NOT NULL DEFAULT "",
`salt` NVARCHAR(100) NOT NULL DEFAULT "",
`reset` NVARCHAR(100) NOT NULL DEFAULT "",
Expand Down Expand Up @@ -131,7 +130,6 @@ CREATE TABLE IF NOT EXISTS `document` (
`slug` NVARCHAR(2000) NOT NULL,
`tags` NVARCHAR(1000) NOT NULL DEFAULT '',
`template` BOOL NOT NULL DEFAULT 0,
`layout` CHAR(10) NOT NULL DEFAULT 'doc',
`created` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
`revised` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT pk_refid PRIMARY KEY (refid),
Expand All @@ -150,7 +148,6 @@ CREATE TABLE IF NOT EXISTS `page` (
`documentid` CHAR(16) NOT NULL COLLATE utf8_bin,
`userid` CHAR(16) DEFAULT '' COLLATE utf8_bin,
`contenttype` CHAR(20) NOT NULL DEFAULT 'wysiwyg',
`pagetype` CHAR(10) NOT NULL DEFAULT 'section',
`level` INT UNSIGNED NOT NULL,
`sequence` DOUBLE NOT NULL,
`title` NVARCHAR(2000) NOT NULL,
Expand Down Expand Up @@ -241,7 +238,6 @@ CREATE TABLE IF NOT EXISTS `revision` (
`pageid` CHAR(16) NOT NULL COLLATE utf8_bin,
`userid` CHAR(16) NOT NULL COLLATE utf8_bin,
`contenttype` CHAR(20) NOT NULL DEFAULT 'wysiwyg',
`pagetype` CHAR(10) NOT NULL DEFAULT 'section',
`title` NVARCHAR(2000) NOT NULL,
`body` LONGTEXT,
`rawbody` LONGBLOB,
Expand Down Expand Up @@ -282,90 +278,3 @@ CREATE TABLE IF NOT EXISTS `userconfig` (
UNIQUE INDEX `idx_userconfig_orguserkey` (`orgid`, `userid`, `key` ASC))
DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci
ENGINE = InnoDB;

DROP TABLE IF EXISTS `share`;

CREATE TABLE IF NOT EXISTS `share` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`orgid` CHAR(16) NOT NULL COLLATE utf8_bin,
`documentid` CHAR(16) NOT NULL COLLATE utf8_bin,
`userid` CHAR(16) DEFAULT '' COLLATE utf8_bin,
`email` NVARCHAR(250) NOT NULL DEFAULT '',
`message` NVARCHAR(500) NOT NULL DEFAULT '',
`viewed` VARCHAR(500) NOT NULL DEFAULT '',
`secret` VARCHAR(200) NOT NULL DEFAULT '',
`expires` CHAR(16) DEFAULT '' COLLATE utf8_bin,
`active` BOOL NOT NULL DEFAULT 1,
`created` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT pk_id PRIMARY KEY (id))
DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci
ENGINE = InnoDB;

DROP TABLE IF EXISTS `feedback`;

CREATE TABLE IF NOT EXISTS `feedback` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`refid` CHAR(16) NOT NULL COLLATE utf8_bin,
`orgid` CHAR(16) NOT NULL COLLATE utf8_bin,
`documentid` CHAR(16) NOT NULL COLLATE utf8_bin,
`userid` CHAR(16) DEFAULT '' COLLATE utf8_bin,
`email` NVARCHAR(250) NOT NULL DEFAULT '',
`feedback` LONGTEXT,
`created` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT pk_id PRIMARY KEY (id))
DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci
ENGINE = InnoDB;

DROP TABLE IF EXISTS `link`;

CREATE TABLE IF NOT EXISTS `link` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`refid` CHAR(16) NOT NULL COLLATE utf8_bin,
`orgid` CHAR(16) NOT NULL COLLATE utf8_bin,
`folderid` CHAR(16) NOT NULL COLLATE utf8_bin,
`userid` CHAR(16) NOT NULL COLLATE utf8_bin,
`sourcedocumentid` CHAR(16) NOT NULL COLLATE utf8_bin,
`sourcepageid` CHAR(16) NOT NULL COLLATE utf8_bin,
`linktype` CHAR(16) NOT NULL COLLATE utf8_bin,
`targetdocumentid` CHAR(16) NOT NULL COLLATE utf8_bin,
`targetid` CHAR(16) NOT NULL DEFAULT '' COLLATE utf8_bin,
`orphan` BOOL NOT NULL DEFAULT 0,
`created` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
`revised` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT pk_id PRIMARY KEY (id))
DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci
ENGINE = InnoDB;

DROP TABLE IF EXISTS `participant`;

CREATE TABLE IF NOT EXISTS `participant` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`refid` CHAR(16) NOT NULL COLLATE utf8_bin,
`orgid` CHAR(16) NOT NULL COLLATE utf8_bin,
`documentid` CHAR(16) NOT NULL COLLATE utf8_bin,
`userid` CHAR(16) DEFAULT '' COLLATE utf8_bin,
`roletype` CHAR(1) NOT NULL DEFAULT 'I' COLLATE utf8_bin,
`lastviewed` TIMESTAMP NULL,
`created` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT pk_id PRIMARY KEY (id),
INDEX `idx_participant_documentid` (`documentid` ASC))
DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci
ENGINE = InnoDB;

DROP TABLE IF EXISTS `pin`;

CREATE TABLE IF NOT EXISTS `pin` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`refid` CHAR(16) NOT NULL COLLATE utf8_bin,
`orgid` CHAR(16) NOT NULL COLLATE utf8_bin,
`userid` CHAR(16) DEFAULT '' COLLATE utf8_bin,
`labelid` CHAR(16) DEFAULT '' COLLATE utf8_bin,
`documentid` CHAR(16) DEFAULT '' COLLATE utf8_bin,
`sequence` INT UNSIGNED NOT NULL DEFAULT 99,
`pin` CHAR(20) NOT NULL DEFAULT '' COLLATE utf8_bin,
`created` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
`revised` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT pk_id PRIMARY KEY (id),
INDEX `idx_pin_userid` (`userid` ASC))
DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci
ENGINE = InnoDB;
2 changes: 1 addition & 1 deletion core/product.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type ProdInfo struct {
func Product() (p ProdInfo) {
p.Major = "0"
p.Minor = "34"
p.Patch = "0"
p.Patch = "1"
p.Version = fmt.Sprintf("%s.%s.%s", p.Major, p.Minor, p.Patch)
p.Edition = "Community"
p.Title = fmt.Sprintf("%s Edition", p.Edition)
Expand Down
1,194 changes: 597 additions & 597 deletions embed/bindata_assetfs.go

Large diffs are not rendered by default.

0 comments on commit 4849dd8

Please sign in to comment.