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

Function test

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

Source from the content-addressed store, hash-verified

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