當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Sequelize.STRING函數代碼示例

本文整理匯總了TypeScript中Sequelize.STRING函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript STRING函數的具體用法?TypeScript STRING怎麽用?TypeScript STRING使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了STRING函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: up

async function up (utils: {
  transaction: Sequelize.Transaction,
  queryInterface: Sequelize.QueryInterface,
  sequelize: Sequelize.Sequelize
}): Promise<void> {
  {
    const data = {
      type: Sequelize.STRING(500),
      allowNull: true,
      defaultValue: null
    }
    await utils.queryInterface.changeColumn('video', 'support', data)
  }

  {
    const data = {
      type: Sequelize.STRING(500),
      allowNull: true,
      defaultValue: null
    }
    await utils.queryInterface.changeColumn('videoChannel', 'support', data)
  }

  {
    const data = {
      type: Sequelize.STRING(500),
      allowNull: true,
      defaultValue: null
    }
    await utils.queryInterface.changeColumn('videoChannel', 'description', data)
  }
}
開發者ID:jiang263,項目名稱:PeerTube,代碼行數:32,代碼來源:0215-video-support-length.ts

示例2: up

async function up (utils: {
  transaction: Sequelize.Transaction,
  queryInterface: Sequelize.QueryInterface,
  sequelize: Sequelize.Sequelize,
  db: any
}): Promise<void> {

  {
    const data = {
      type: Sequelize.INTEGER,
      allowNull: true,
      defaultValue: null
    }
    await utils.queryInterface.changeColumn('Videos', 'licence', data)
  }

  {
    const data = {
      type: Sequelize.INTEGER,
      allowNull: true,
      defaultValue: null
    }
    await utils.queryInterface.changeColumn('Videos', 'category', data)
  }

  {
    const data = {
      type: Sequelize.STRING(CONSTRAINTS_FIELDS.VIDEOS.DESCRIPTION.max),
      allowNull: true,
      defaultValue: null
    }
    await utils.queryInterface.changeColumn('Videos', 'description', data)
  }
}
開發者ID:jiang263,項目名稱:PeerTube,代碼行數:34,代碼來源:0120-video-null.ts

示例3: getSequelizeType

export function getSequelizeType(model: IModel): Sequelize.DataTypeAbstract {
  const type = model.spec.type
  const format = model.spec.format

  // tslint:disable-next-line
  switch (format) {
    case 'uuid':
      return Sequelize.UUID()
    case 'integer':
      return Sequelize.BIGINT()
  }

  switch (type) {
    case ModelType.String:
      const maxLength = model.spec.max
      return maxLength ? Sequelize.STRING(maxLength) : Sequelize.TEXT()
    case ModelType.Number:
      return Sequelize.DOUBLE()
    case ModelType.Boolean:
      return Sequelize.BOOLEAN
    case ModelType.DateTime:
      return Sequelize.DATE(6)
    default:
      // record will be JSONified
      return Sequelize.TEXT()
  }
}
開發者ID:patrickhulce,項目名稱:klay,代碼行數:27,代碼來源:model.ts

示例4: up

async function up (utils: {
  transaction: Sequelize.Transaction,
  queryInterface: Sequelize.QueryInterface,
  sequelize: Sequelize.Sequelize
}): Promise<void> {
  {
    const data = {
      type: Sequelize.STRING(CONSTRAINTS_FIELDS.VIDEOS.SUPPORT.max),
      allowNull: true,
      defaultValue: null
    }
    await utils.queryInterface.addColumn('video', 'support', data)
  }

  {
    const data = {
      type: Sequelize.STRING(CONSTRAINTS_FIELDS.VIDEO_CHANNELS.SUPPORT.max),
      allowNull: true,
      defaultValue: null
    }
    await utils.queryInterface.addColumn('videoChannel', 'support', data)
  }

  {
    const data = {
      type: Sequelize.STRING(CONSTRAINTS_FIELDS.USERS.DESCRIPTION.max),
      allowNull: true,
      defaultValue: null
    }
    await utils.queryInterface.addColumn('account', 'description', data)
  }

  {
    const data = {
      type: Sequelize.STRING(CONSTRAINTS_FIELDS.VIDEOS.DESCRIPTION.max),
      allowNull: true,
      defaultValue: null
    }
    await utils.queryInterface.changeColumn('video', 'description', data)
  }
}
開發者ID:jiang263,項目名稱:PeerTube,代碼行數:41,代碼來源:0195-support.ts

示例5: defineTask

export default function defineTask(sequelize: Sequelize.Sequelize, DataTypes) {
    let Task = sequelize.define('Task', {
        id: {
            type: Sequelize.INTEGER,
            primaryKey: true,
            autoIncrement: true
        },
        title: {
            type: Sequelize.STRING(20)
        },
        description: {
            type: Sequelize.STRING(50)
        },
        status: {
            type: Sequelize.BOOLEAN,
            defaultValue: false
        }
    });
    
    Task.sync();
    
    return Task;
}
開發者ID:psahindrakar,項目名稱:hapi-typescript-todo,代碼行數:23,代碼來源:Task.model.ts

示例6: up

async function up (utils: {
  transaction: Sequelize.Transaction,
  queryInterface: Sequelize.QueryInterface,
  sequelize: Sequelize.Sequelize,
  db: any
}): Promise<void> {
  const q = utils.queryInterface

  const data = {
    type: Sequelize.STRING(3000),
    allowNull: false
  }
  await q.changeColumn('Videos', 'description', data)
}
開發者ID:jiang263,項目名稱:PeerTube,代碼行數:14,代碼來源:0090-videos-description.ts

示例7: up

function up (utils: {
  transaction: Sequelize.Transaction,
  queryInterface: Sequelize.QueryInterface,
  sequelize: Sequelize.Sequelize
}): Promise<void> {
  const q = utils.queryInterface

  const data = {
    type: Sequelize.STRING(400),
    allowNull: false,
    defaultValue: ''
  }
  return q.addColumn('Users', 'email', data)
    .then(() => {
      const query = 'UPDATE "Users" SET "email" = CONCAT("username", \'@example.com\')'
      return utils.sequelize.query(query, { transaction: utils.transaction })
    })
    .then(() => {
      data.defaultValue = null

      return q.changeColumn('Users', 'email', data)
    })
}
開發者ID:jiang263,項目名稱:PeerTube,代碼行數:23,代碼來源:0010-email-user.ts

示例8:

    // Possible values: 'json', 'sequelize', an object
    storage: 'sequelize',
    storageOptions: {
        // The configured instance of Sequelize.
        // Optional if `model` is passed.
        sequelize: sequelize,

        // The to be used Sequelize model.
        // Must have column name matching `columnName` option
        // Optional of `sequelize` is passed.
        model: sequelize.define<any, any>('model', {}),

        // The name of the to be used model.
        // Defaults to 'SequelizeMeta'
        modelName: 'Schema',

        // The name of table to create if `model` option is not supplied
        // Defaults to `modelName`
        tableName: 'Schema',

        // The name of table column holding migration name.
        // Defaults to 'name'.
        columnName: 'migration',

        // The type of the column holding migration name.
        // Defaults to `Sequelize.STRING`
        columnType: Sequelize.STRING(100),
    },

});
開發者ID:Engineer2B,項目名稱:DefinitelyTyped,代碼行數:30,代碼來源:umzug-tests.ts

示例9: up

async function up (utils: {
  transaction: Sequelize.Transaction,
  queryInterface: Sequelize.QueryInterface,
  sequelize: Sequelize.Sequelize
}): Promise<void> {

  {
    await utils.queryInterface.renameColumn('video', 'language', 'oldLanguage')
  }

  {
    const data = {
      type: Sequelize.STRING(CONSTRAINTS_FIELDS.VIDEOS.LANGUAGE.max),
      allowNull: true,
      defaultValue: null
    }
    await utils.queryInterface.addColumn('video', 'language', data)
  }

  {
    const languages = [
      {
        oldLanguage: 1,
        newLanguage: 'en'
      },
      {
        oldLanguage: 2,
        newLanguage: 'es'
      },
      {
        oldLanguage: 3,
        newLanguage: 'zh'
      },
      {
        oldLanguage: 4,
        newLanguage: 'hi'
      },
      {
        oldLanguage: 5,
        newLanguage: 'ar'
      },
      {
        oldLanguage: 6,
        newLanguage: 'pt'
      },
      {
        oldLanguage: 7,
        newLanguage: 'bn'
      },
      {
        oldLanguage: 8,
        newLanguage: 'ru'
      },
      {
        oldLanguage: 9,
        newLanguage: 'ja'
      },
      {
        oldLanguage: 10,
        newLanguage: 'pa'
      },
      {
        oldLanguage: 11,
        newLanguage: 'de'
      },
      {
        oldLanguage: 12,
        newLanguage: 'ko'
      },
      {
        oldLanguage: 13,
        newLanguage: 'fr'
      },
      {
        oldLanguage: 14,
        newLanguage: 'it'
      },
      {
        oldLanguage: 1000,
        newLanguage: 'sgn'
      },
      {
        oldLanguage: 1001,
        newLanguage: 'ase'
      },
      {
        oldLanguage: 1002,
        newLanguage: 'sdl'
      },
      {
        oldLanguage: 1003,
        newLanguage: 'bfi'
      },
      {
        oldLanguage: 1004,
        newLanguage: 'bzs'
      },
      {
        oldLanguage: 1005,
        newLanguage: 'csl'
//.........這裏部分代碼省略.........
開發者ID:jiang263,項目名稱:PeerTube,代碼行數:101,代碼來源:0210-video-language.ts

示例10:

    config.password,   // 用戶密碼
    {
        'dialect': 'mysql',  // 數據庫使用mysql
        'host': config.server, // 數據庫服務器ip
        'port': 3306,        // 數據庫服務器端口
        'define': {
            // 字段以下劃線(_)來分割(默認是駝峰命名風格)
            'underscored': true
        },
        logging:false//關閉輸出sql日誌
    }
);

let ImgDb = sequelize.define('img', {
    'url': {
        'type': Sequelize.STRING(255),
        'allowNull': true,
        'unique': true // 字段是否UNIQUE
    },
    'time': {
        'type': Sequelize.DATE(10),
        'allowNull': true
    },
    'titleId': {
        'type': Sequelize.STRING(100),
        'allowNull': true
    }
}, {
    // 自定義表名
    'freezeTableName': true,
    'tableName': 'node_img',
開發者ID:zcg331793187,項目名稱:DownloadYouLike,代碼行數:31,代碼來源:SequelizeDb.ts


注:本文中的Sequelize.STRING函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。