How to use the rethinkdb.tableCreate function in rethinkdb

To help you get started, we’ve selected a few rethinkdb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github deepstreamIO / deepstream.io-provider-search-rethinkdb / test / tools / create-test-table.js View on Github external
var createTable = function() {
	r
		.tableCreate( connectionParams.testTable, {
			primaryKey: connectionParams.primaryKey,
			durability: 'hard'
		} )
		.run( connection, fn( populateTable ) );
};
github ticruz38 / Ambrosia / script / seed.js View on Github external
if ((err) && (!err.message.match(/Database `.*` already exists/))) {
            console.log("Could not create the database `" + config.rethinkdb.db + "`");
            console.log(err);
            process.exit(1);
          }
          console.log('Database `' + config.rethinkdb.db + '` created.');

          r.tableCreate('user').run(conn, function(err, result) {
            if ((err) && (!err.message.match(/Table `.*` already exists/))) {
              console.log("Could not create the table `users`");
              console.log(err);
              process.exit(1);
            }
            console.log('Table `users` created.');
          });
          r.tableCreate('restaurant').run(conn, function(err, result) {
            if ((err) && (!err.message.match(/Table `.*` already exists/))) {
              console.log("Could not create the table `users`");
              console.log(err);
              process.exit(1);
            }
            console.log('Table restaurant created');
            r.table('restaurant').indexCreate('userID').run(conn);
          });
          r.tableCreate('order').run(conn, function(err, result) {
            if ((err) && (!err.message.match(/Table `.*` already exists/))) {
              console.log("Could not create the table `order`");
              console.log(err);
              process.exit(1);
            }
            r.table('order').indexCreate('userID').run(conn);
            r.table('order').indexCreate('restaurantID').run(conn);
github ticruz38 / Ambrosia / script / seed.js View on Github external
r.dbCreate(config.rethinkdb.db).run(conn, function(err, result) {
          if ((err) && (!err.message.match(/Database `.*` already exists/))) {
            console.log("Could not create the database `" + config.rethinkdb.db + "`");
            console.log(err);
            process.exit(1);
          }
          console.log('Database `' + config.rethinkdb.db + '` created.');

          r.tableCreate('user').run(conn, function(err, result) {
            if ((err) && (!err.message.match(/Table `.*` already exists/))) {
              console.log("Could not create the table `users`");
              console.log(err);
              process.exit(1);
            }
            console.log('Table `users` created.');
          });
          r.tableCreate('restaurant').run(conn, function(err, result) {
            if ((err) && (!err.message.match(/Table `.*` already exists/))) {
              console.log("Could not create the table `users`");
              console.log(err);
              process.exit(1);
            }
            console.log('Table restaurant created');
            r.table('restaurant').indexCreate('userID').run(conn);
          });
github ticruz38 / Ambrosia / script / seed.js View on Github external
console.log("Could not create the table `users`");
              console.log(err);
              process.exit(1);
            }
            console.log('Table `users` created.');
          });
          r.tableCreate('restaurant').run(conn, function(err, result) {
            if ((err) && (!err.message.match(/Table `.*` already exists/))) {
              console.log("Could not create the table `users`");
              console.log(err);
              process.exit(1);
            }
            console.log('Table restaurant created');
            r.table('restaurant').indexCreate('userID').run(conn);
          });
          r.tableCreate('order').run(conn, function(err, result) {
            if ((err) && (!err.message.match(/Table `.*` already exists/))) {
              console.log("Could not create the table `order`");
              console.log(err);
              process.exit(1);
            }
            r.table('order').indexCreate('userID').run(conn);
            r.table('order').indexCreate('restaurantID').run(conn);
            console.log('Table `order` created.');
          });
        });
      }
github thejsj / realtime-photo-tutorial / server / db.js View on Github external
.then(function() {
                if (tableList.indexOf('images') === -1) {
                  return r.tableCreate('images').run(r.conn);
                }
              });
          });
github joshwcomeau / panther / server / database.js View on Github external
        .finally( () => r.tableCreate('artists').run(conn) )
        .finally( () => r.table('artists').indexCreate('createdAt').run(conn) )
github rethinkdb / rethinkdb-example-nodejs / todo-angular-koa / app.js View on Github external
r.dbCreate(config.rethinkdb.db).run(conn).finally(function() {
            return r.tableCreate('todos').run(conn)
        }).finally(function() {
            r.table('todos').indexCreate('createdAt').run(conn);
github openstf / stf / lib / db / setup.js View on Github external
function createTable(table, options) {
    var tableOptions = {
      primaryKey: options.primaryKey
    }
    return r.tableCreate(table, tableOptions).run(conn)
      .then(function() {
        log.info('Table "%s" created', table)
      })
      .catch(alreadyExistsError, function() {
        log.info('Table "%s" already exists', table)
        return Promise.resolve()
      })
      .catch(noMasterAvailableError, function() {
        return Promise.delay(1000).then(function() {
          return createTable(table, options)
        })
      })
      .then(function() {
        if (options.indexes) {
          return Promise.all(Object.keys(options.indexes).map(function(index) {
            return createIndex(table, index, options.indexes[index])
github ediket / nothinkdb / src / Table.js View on Github external
static async ensureTable(connection) {
    await r.branch(
      r.tableList().contains(this.table).not(),
      r.tableCreate(this.table),
      null
    ).run(connection);
  }
github ElevenGiants / eleven-server / bench / suites / data / pbe / rethink.js View on Github external
function createTable(cb) {
			rdb.tableCreate(TABLE, {primaryKey: 'tsid'}).run(conn, cb);
		},
		function loadFixture(cb) {

rethinkdb

This package provides the JavaScript driver library for the RethinkDB database server for use in your node application.

Unknown
Latest version published 5 years ago

Package Health Score

58 / 100
Full package analysis