<commit_before>/**
 * mSupply Mobile
 * Sustainable Solutions (NZ) Ltd. 2019
 */

import {
  Address,
  Item,
  ItemBatch,
  ItemCategory,
  ItemDepartment,
  ItemStoreJoin,
  MasterList,
  MasterListItem,
  MasterListNameJoin,
  Name,
  NameStoreJoin,
  NumberSequence,
  NumberToReuse,
  Options,
  Requisition,
  RequisitionItem,
  Setting,
  Stocktake,
  StocktakeBatch,
  StocktakeItem,
  SyncOut,
  Period,
  PeriodSchedule,
  Transaction,
  TransactionBatch,
  TransactionCategory,
  TransactionItem,
  User,
} from './DataTypes';

Address.schema = {
  name: 'Address',
  primaryKey: 'id',
  properties: {
    id: 'string',
    line1: { type: 'string', optional: true },
    line2: { type: 'string', optional: true },
    line3: { type: 'string', optional: true },
    line4: { type: 'string', optional: true },
    zipCode: { type: 'string', optional: true },
  },
};

ItemCategory.schema = {
  name: 'ItemCategory',
  primaryKey: 'id',
  properties: {
    id: 'string',
    name: { type: 'string', default: 'placeholderName' },
    parentCategory: { type: 'ItemCategory', optional: true },
  },
};

ItemDepartment.schema = {
  name: 'ItemDepartment',
  primaryKey: 'id',
  properties: {
    id: 'string',
    name: { type: 'string', default: 'placeholderName' },
    parentDepartment: { type: 'ItemDepartment', optional: true },
  },
};

Setting.schema = {
  name: 'Setting',
  primaryKey: 'key',
  properties: {
    key: 'string', // Includes the user's UUID if it is per-user.
    value: 'string',
    user: { type: 'User', optional: true },
  },
};

SyncOut.schema = {
  name: 'SyncOut',
  primaryKey: 'id',
  properties: {
    id: 'string',
    changeTime: 'int', // UNIX epoch format.
    changeType: 'string', // 'create', 'update', or 'delete'.
    recordType: 'string', // table name.
    recordId: 'string',
  },
};

TransactionCategory.schema = {
  name: 'TransactionCategory',
  primaryKey: 'id',
  properties: {
    id: 'string',
    name: { type: 'string', default: 'placeholderName' },
    code: { type: 'string', default: 'placeholderCode' },
    type: { type: 'string', default: 'placeholderType' },
    parentCategory: { type: 'TransactionCategory', optional: true },
  },
};

User.schema = {
  name: 'User',
  primaryKey: 'id',
  properties: {
    id: 'string',
    username: { type: 'string', default: 'placeholderUsername' },
    lastLogin: { type: 'date', optional: true },
    firstName: { type: 'string', optional: true },
    lastName: { type: 'string', optional: true },
    email: { type: 'string', optional: true },
    passwordHash: {
      type: 'string',
      default: '<PASSWORD>',
    },
    salt: { type: 'string', optional: true },
  },
};

export const schema = {
  schema: [
    Address,
    Item,
    ItemBatch,
    ItemDepartment,
    ItemCategory,
    ItemStoreJoin,
    Transaction,
    TransactionItem,
    TransactionBatch,
    TransactionCategory,
    MasterList,
    MasterListItem,
    MasterListNameJoin,
    Name,
    NameStoreJoin,
    NumberSequence,
    NumberToReuse,
    Options,
    Requisition,
    RequisitionItem,
    Setting,
    SyncOut,
    Stocktake,
    StocktakeItem,
    Period,
    PeriodSchedule,
    StocktakeBatch,
    User,
  ],
  schemaVersion: 12,
};

export default schema;<commit_msg>Add put schema version back<commit_after>/**
 * mSupply Mobile
 * Sustainable Solutions (NZ) Ltd. 2019
 */

import {
  Address,
  Item,
  ItemBatch,
  ItemCategory,
  ItemDepartment,
  ItemStoreJoin,
  MasterList,
  MasterListItem,
  MasterListNameJoin,
  Name,
  NameStoreJoin,
  NumberSequence,
  NumberToReuse,
  Options,
  Requisition,
  RequisitionItem,
  Setting,
  Stocktake,
  StocktakeBatch,
  StocktakeItem,
  SyncOut,
  Period,
  PeriodSchedule,
  Transaction,
  TransactionBatch,
  TransactionCategory,
  TransactionItem,
  User,
} from './DataTypes';

Address.schema = {
  name: 'Address',
  primaryKey: 'id',
  properties: {
    id: 'string',
    line1: { type: 'string', optional: true },
    line2: { type: 'string', optional: true },
    line3: { type: 'string', optional: true },
    line4: { type: 'string', optional: true },
    zipCode: { type: 'string', optional: true },
  },
};

ItemCategory.schema = {
  name: 'ItemCategory',
  primaryKey: 'id',
  properties: {
    id: 'string',
    name: { type: 'string', default: 'placeholderName' },
    parentCategory: { type: 'ItemCategory', optional: true },
  },
};

ItemDepartment.schema = {
  name: 'ItemDepartment',
  primaryKey: 'id',
  properties: {
    id: 'string',
    name: { type: 'string', default: 'placeholderName' },
    parentDepartment: { type: 'ItemDepartment', optional: true },
  },
};

Setting.schema = {
  name: 'Setting',
  primaryKey: 'key',
  properties: {
    key: 'string', // Includes the user's UUID if it is per-user.
    value: 'string',
    user: { type: 'User', optional: true },
  },
};

SyncOut.schema = {
  name: 'SyncOut',
  primaryKey: 'id',
  properties: {
    id: 'string',
    changeTime: 'int', // UNIX epoch format.
    changeType: 'string', // 'create', 'update', or 'delete'.
    recordType: 'string', // table name.
    recordId: 'string',
  },
};

TransactionCategory.schema = {
  name: 'TransactionCategory',
  primaryKey: 'id',
  properties: {
    id: 'string',
    name: { type: 'string', default: 'placeholderName' },
    code: { type: 'string', default: 'placeholderCode' },
    type: { type: 'string', default: 'placeholderType' },
    parentCategory: { type: 'TransactionCategory', optional: true },
  },
};

User.schema = {
  name: 'User',
  primaryKey: 'id',
  properties: {
    id: 'string',
    username: { type: 'string', default: 'placeholderUsername' },
    lastLogin: { type: 'date', optional: true },
    firstName: { type: 'string', optional: true },
    lastName: { type: 'string', optional: true },
    email: { type: 'string', optional: true },
    passwordHash: {
      type: 'string',
      default: '<PASSWORD>',
    },
    salt: { type: 'string', optional: true },
  },
};

export const schema = {
  schema: [
    Address,
    Item,
    ItemBatch,
    ItemDepartment,
    ItemCategory,
    ItemStoreJoin,
    Transaction,
    TransactionItem,
    TransactionBatch,
    TransactionCategory,
    MasterList,
    MasterListItem,
    MasterListNameJoin,
    Name,
    NameStoreJoin,
    NumberSequence,
    NumberToReuse,
    Options,
    Requisition,
    RequisitionItem,
    Setting,
    SyncOut,
    Stocktake,
    StocktakeItem,
    Period,
    PeriodSchedule,
    StocktakeBatch,
    User,
  ],
  schemaVersion: 6,
};

export default schema;
{'fraction_non_alphanumeric': 0.14728800611153553, 'fraction_numerical': 0.0029029793735676087, 'mean_word_length': 3.236893203883495, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1422738', 'n_tokens_mistral': 2136, 'n_tokens_neox': 2097, 'n_words': 531}