MCPcopy
hub / github.com/sequelize/sequelize / test

Function test

types/test/query-interface.ts:7–229  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5declare let queryInterface: QueryInterface;
6
7async function test() {
8 await queryInterface.createTable(
9 'nameOfTheNewTable',
10 {
11 attr1: DataTypes.STRING,
12 attr2: DataTypes.INTEGER,
13 attr3: {
14 allowNull: false,
15 defaultValue: false,
16 type: DataTypes.BOOLEAN,
17 },
18 // foreign key usage
19 attr4: {
20 onDelete: 'cascade',
21 onUpdate: 'cascade',
22 references: {
23 key: 'id',
24 model: 'another_table_name',
25 },
26 type: DataTypes.INTEGER,
27 },
28 attr5: {
29 onDelete: 'cascade',
30 onUpdate: 'cascade',
31 references: {
32 key: 'id',
33 model: { schema: '<schema>', tableName: 'another_table_name' },
34 },
35 type: DataTypes.INTEGER,
36 },
37 createdAt: {
38 type: DataTypes.DATE,
39 },
40 id: {
41 autoIncrement: true,
42 primaryKey: true,
43 type: DataTypes.INTEGER,
44 },
45 updatedAt: {
46 type: DataTypes.DATE,
47 },
48 },
49 {
50 charset: 'latin1', // default: null
51 collate: 'latin1_general_ci',
52 engine: 'MYISAM', // default: 'InnoDB'
53 uniqueKeys: {
54 test: {
55 customIndex: true,
56 fields: ['attr2', 'attr3'],
57 }
58 }
59 }
60 );
61 await queryInterface.createTable({ tableName: '<table-name>' }, {});
62
63 await queryInterface.dropTable('nameOfTheExistingTable');
64 await queryInterface.dropTable({ schema: '<schema>', tableName: 'nameOfTheExistingTable' });

Callers

nothing calls this directly

Calls 15

bulkDeleteMethod · 0.80
bulkInsertMethod · 0.80
bulkUpdateMethod · 0.80
quoteTableMethod · 0.80
renameTableMethod · 0.80
showAllTablesMethod · 0.80
addColumnMethod · 0.80
addIndexMethod · 0.80
removeIndexMethod · 0.80
transactionMethod · 0.80
selectMethod · 0.80
deleteMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…