Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit c77c553c
authored
Oct 25, 2019
by
2kindsofcs
Committed by
Sushant
Oct 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(typings): query-interface table schema (#11582)
1 parent
7ffa3d40
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
13 deletions
types/lib/query-interface.d.ts
types/test/query-interface.ts
types/lib/query-interface.d.ts
View file @
c77c553
...
...
@@ -120,6 +120,15 @@ export interface QueryInterfaceDropAllTablesOptions extends QueryInterfaceOption
skip
?:
string
[];
}
export
interface
TableNameWithSchema
{
tableName
:
string
;
schema
?:
string
;
delimiter
?:
string
;
as
?:
string
;
name
?:
string
;
}
export
type
TableName
=
string
|
TableNameWithSchema
;
export
type
IndexType
=
'UNIQUE'
|
'FULLTEXT'
|
'SPATIAL'
;
export
type
IndexMethod
=
'BTREE'
|
'HASH'
|
'GIST'
|
'SPGIST'
|
'GIN'
|
'BRIN'
|
string
;
...
...
@@ -436,7 +445,7 @@ export class QueryInterface {
* Inserts or Updates a record in the database
*/
public
upsert
(
tableName
:
string
,
tableName
:
TableName
,
values
:
object
,
updateValues
:
object
,
model
:
typeof
Model
,
...
...
@@ -447,7 +456,7 @@ export class QueryInterface {
* Inserts multiple records at once
*/
public
bulkInsert
(
tableName
:
string
,
tableName
:
TableName
,
records
:
object
[],
options
?:
QueryOptions
,
attributes
?:
string
[]
|
string
...
...
@@ -458,7 +467,7 @@ export class QueryInterface {
*/
public
update
(
instance
:
Model
,
tableName
:
string
,
tableName
:
TableName
,
values
:
object
,
identifier
:
WhereOptions
,
options
?:
QueryOptions
...
...
@@ -468,7 +477,7 @@ export class QueryInterface {
* Updates multiple rows at once
*/
public
bulkUpdate
(
tableName
:
string
,
tableName
:
TableName
,
values
:
object
,
identifier
:
WhereOptions
,
options
?:
QueryOptions
,
...
...
@@ -478,13 +487,13 @@ export class QueryInterface {
/**
* Deletes a row
*/
public
delete
(
instance
:
Model
|
null
,
tableName
:
string
,
identifier
:
WhereOptions
,
options
?:
QueryOptions
):
Promise
<
object
>
;
public
delete
(
instance
:
Model
|
null
,
tableName
:
TableName
,
identifier
:
WhereOptions
,
options
?:
QueryOptions
):
Promise
<
object
>
;
/**
* Deletes multiple rows at once
*/
public
bulkDelete
(
tableName
:
string
,
tableName
:
TableName
,
identifier
:
WhereOptions
,
options
?:
QueryOptions
,
model
?:
typeof
Model
...
...
@@ -493,14 +502,14 @@ export class QueryInterface {
/**
* Returns selected rows
*/
public
select
(
model
:
typeof
Model
|
null
,
tableName
:
string
,
options
?:
QueryOptionsWithWhere
):
Promise
<
object
[]
>
;
public
select
(
model
:
typeof
Model
|
null
,
tableName
:
TableName
,
options
?:
QueryOptionsWithWhere
):
Promise
<
object
[]
>
;
/**
* Increments a row value
*/
public
increment
(
instance
:
Model
,
tableName
:
string
,
tableName
:
TableName
,
values
:
object
,
identifier
:
WhereOptions
,
options
?:
QueryOptions
...
...
@@ -510,7 +519,7 @@ export class QueryInterface {
* Selects raw without parsing the string into an object
*/
public
rawSelect
(
tableName
:
string
,
tableName
:
TableName
,
options
:
QueryOptionsWithWhere
,
attributeSelector
:
string
|
string
[],
model
?:
typeof
Model
...
...
@@ -521,7 +530,7 @@ export class QueryInterface {
* parameters.
*/
public
createTrigger
(
tableName
:
string
,
tableName
:
TableName
,
triggerName
:
string
,
timingType
:
string
,
fireOnArray
:
{
...
...
@@ -536,13 +545,13 @@ export class QueryInterface {
/**
* Postgres only. Drops the specified trigger.
*/
public
dropTrigger
(
tableName
:
string
,
triggerName
:
string
,
options
?:
QueryInterfaceOptions
):
Promise
<
void
>
;
public
dropTrigger
(
tableName
:
TableName
,
triggerName
:
string
,
options
?:
QueryInterfaceOptions
):
Promise
<
void
>
;
/**
* Postgres only. Renames a trigger
*/
public
renameTrigger
(
tableName
:
string
,
tableName
:
TableName
,
oldTriggerName
:
string
,
newTriggerName
:
string
,
options
?:
QueryInterfaceOptions
...
...
@@ -585,7 +594,7 @@ export class QueryInterface {
/**
* Escape a table name
*/
public
quoteTable
(
identifier
:
string
):
string
;
public
quoteTable
(
identifier
:
TableName
):
string
;
/**
* Split an identifier into .-separated tokens and quote each part. If force is true, the identifier will be
...
...
types/test/query-interface.ts
View file @
c77c553
...
...
@@ -51,6 +51,16 @@ queryInterface.createTable(
queryInterface
.
dropTable
(
'nameOfTheExistingTable'
);
queryInterface
.
bulkDelete
({
tableName
:
'foo'
,
schema
:
'bar'
},
{},
{});
queryInterface
.
bulkInsert
({
tableName
:
'foo'
,
as
:
'bar'
,
name
:
'as'
},
[{}],
{});
queryInterface
.
bulkUpdate
({
tableName
:
'foo'
,
delimiter
:
'bar'
,
as
:
'baz'
,
name
:
'quz'
},
{},
{});
queryInterface
.
dropTrigger
({
tableName
:
'foo'
,
as
:
'bar'
,
name
:
'baz'
},
'foo'
,
{});
queryInterface
.
quoteTable
({
tableName
:
'foo'
,
delimiter
:
'bar'
});
queryInterface
.
dropAllTables
();
queryInterface
.
renameTable
(
'Person'
,
'User'
);
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment