func setupDatabase() (err error) {
	err = rethink.DbCreate(TODO_DB).Run(session).Exec()
	if err != nil {
		// TODO: Check if the failure is that the database already exists
		return
	}

	err = rethink.TableCreate(TODO_TABLE).Run(session).Exec()
	if err != nil {
		// TODO: Check if the failure is that the table already exists
		return
	}
	return nil
}
Пример #2
0
func initDb() {
	session, err := r.Connect(os.Getenv("WERCKER_RETHINKDB_URL"), "gettingstarted")
	if err != nil {
		log.Fatal(err)
		return
	}

	err = r.DbCreate("gettingstarted").Run(session).Exec()
	if err != nil {
		log.Println(err)
	}

	err = r.TableCreate("bookmarks").Run(session).Exec()
	if err != nil {
		log.Println(err)
	}

	sessionArray = append(sessionArray, session)
}
Пример #3
0
func (c *Connection) InitDatabase() {
	rethinkgo.DbCreate("magnet").Run(c.session).Exec()
	rethinkgo.TableCreate("users").Run(c.session).Exec()
	rethinkgo.TableCreate("bookmarks").Run(c.session).Exec()
	rethinkgo.TableCreate("sessions").Run(c.session).Exec()
}