<commit_before>  
<h3>Emoncms Database Setup Script</h3>
<p><a href="index.php" >Continue to emoncms</a></p>
<?php

  /*
   All Emoncms code is released under the GNU Affero General Public License.
   See COPYRIGHT.txt and LICENSE.txt.

    ---------------------------------------------------------------------
    Emoncms - open source energy visualisation
    Part of the OpenEnergyMonitor project:
    http://openenergymonitor.org
  */

  //=====================================================
  //$runnable = TRUE; // ENABLE THIS ONCE TO FORCE UPDATE
  //=====================================================

  require "Includes/db.php";
  $e = db_connect();
  if ($e == 4) $runnable = TRUE;

  if(!$runnable) {echo "to run script uncomment runnable"; die;}

  $shema = array();

  $schema['users'] = array(
    'id'=> array('type'=>'int NOT NULL AUTO_INCREMENT, PRIMARY KEY(id)'),
    'username'=> array('type'=>'varchar(30)'),
    'password'=> array('type'=>'varchar(64)'),
    'salt'=> array('type'=>'varchar(3)'),
    'apikey_write'=> array('type'=>'varchar(64)'),
    'apikey_read'=> array('type'=>'varchar(64)'),
    'lastlogin'=> array('type'=>'DATETIME'),
    'admin'=> array('type'=>'INT NOT NULL')
  );

  $schema['input'] = array(
    'id'=> array('type'=>'int NOT NULL AUTO_INCREMENT, PRIMARY KEY(id)'),
    'userid'=> array('type'=>'text'),
    'name'=> array('type'=>'text'),
    'processList'=> array('type'=>'text'),
    'time'=> array('type'=>'DATETIME'),
    'value'=> array('type'=>'FLOAT'),
    'status'=> array('type'=>'int')
  );

  $schema['feeds'] = array(
    'id'=> array('type'=>'int NOT NULL AUTO_INCREMENT, PRIMARY KEY(id)'),
    'name'=> array('type'=>'text'),
    'tag'=> array('type'=>'text'),
    'time'=> array('type'=>'DATETIME'),
    'value'=> array('type'=>'FLOAT'),
    'status'=> array('type'=>'int'),
    'today'=> array('type'=>'FLOAT'),
    'yesterday'=> array('type'=>'FLOAT'),
    'week'=> array('type'=>'FLOAT'),
    'month'=> array('type'=>'FLOAT'),
    'year'=> array('type'=>'FLOAT'),
    'type'=> array('type'=>'int NOT NULL')
  );

  $schema['feed_relation'] = array(
    'userid'=> array('type'=>'int'),
    'feedid'=> array('type'=>'int')
  );

  $schema['dashboard'] = array(
    'userid'=> array('type'=>'int'),
    'content'=> array('type'=>'text')
  );

  $schema['notify'] = array(
    'userid'=> array('type'=>'int'),
    'feedid'=> array('type'=>'int'),
    'onvalue'=> array('type'=>'FLOAT'),
    'onvalue_sent'=> array('type'=>'bool'),
    'oninactive'=> array('type'=>'bool'),
    'oninactive_sent'=> array('type'=>'bool'),
    'periodic'=> array('type'=>'bool')
  );
<commit_msg>Added items from upgrade.php to setup script<commit_after>  
<h3>Emoncms Database Setup Script</h3>
<p><a href="index.php" >Continue to emoncms</a></p>
<?php

  /*
   All Emoncms code is released under the GNU Affero General Public License.
   See COPYRIGHT.txt and LICENSE.txt.

    ---------------------------------------------------------------------
    Emoncms - open source energy visualisation
    Part of the OpenEnergyMonitor project:
    http://openenergymonitor.org
  */

  //=====================================================
  //$runnable = TRUE; // ENABLE THIS ONCE TO FORCE UPDATE
  //=====================================================

  require "Includes/db.php";
  $e = db_connect();
  if ($e == 4) $runnable = TRUE;

  if(!$runnable) {echo "to run script uncomment runnable"; die;}

  $shema = array();

  $schema['users'] = array(
    'id'=> array('type'=>'int NOT NULL AUTO_INCREMENT, PRIMARY KEY(id)'),
    'username'=> array('type'=>'varchar(30)'),
    'password'=> array('type'=>'varchar(64)'),
    'salt'=> array('type'=>'varchar(3)'),
    'apikey_write'=> array('type'=>'varchar(64)'),
    'apikey_read'=> array('type'=>'varchar(64)'),
    'lastlogin'=> array('type'=>'DATETIME'),
    'admin'=> array('type'=>'INT NOT NULL')
  );

  $schema['input'] = array(
    'id'=> array('type'=>'int NOT NULL AUTO_INCREMENT, PRIMARY KEY(id)'),
    'userid'=> array('type'=>'text'),
    'name'=> array('type'=>'text'),
    'processList'=> array('type'=>'text'),
    'time'=> array('type'=>'DATETIME'),
    'value'=> array('type'=>'FLOAT'),
    'status'=> array('type'=>'int')
  );

  $schema['feeds'] = array(
    'id'=> array('type'=>'int NOT NULL AUTO_INCREMENT, PRIMARY KEY(id)'),
    'name'=> array('type'=>'text'),
    'tag'=> array('type'=>'text'),
    'time'=> array('type'=>'DATETIME'),
    'value'=> array('type'=>'FLOAT'),
    'status'=> array('type'=>'int'),
    'today'=> array('type'=>'FLOAT'),
    'yesterday'=> array('type'=>'FLOAT'),
    'week'=> array('type'=>'FLOAT'),
    'month'=> array('type'=>'FLOAT'),
    'year'=> array('type'=>'FLOAT'),
    'type'=> array('type'=>'int NOT NULL')
  );

  $schema['feed_relation'] = array(
    'userid'=> array('type'=>'int'),
    'feedid'=> array('type'=>'int')
  );

  $schema['dashboard'] = array(
    'id'=> array('type'=>'int NOT NULL AUTO_INCREMENT, PRIMARY KEY(id,userid)'),
    'userid'=> array('type'=>'int'),
    'content'=> array('type'=>'text'),
    'name'=> array('type'=>"VARCHAR(30) DEFAULT 'no name'"),
    'description'=> array('type'=>"VARCHAR(255) DEFAULT 'no description'")
  );

  $schema['notify'] = array(
    'userid'=> array('type'=>'int'),
    'feedid'=> array('type'=>'int'),
    'onvalue'=> array('type'=>'FLOAT'),
    'onvalue_sent'=> array('type'=>'bool'),
    'oninactive'=> array('type'=>'bool'),
    'oninactive_sent'=> array('type'=>'bool'),
    'periodic'=> array('type'=>'bool')
  );

{'fraction_non_alphanumeric': 0.3044183949504058, 'fraction_numerical': 0.005229936880072137, 'mean_word_length': 4.1399443929564415, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 173, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1289042', 'n_tokens_mistral': 1794, 'n_tokens_neox': 1801, 'n_words': 367}