-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
316 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env bash | ||
set -Eeuxo pipefail # https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/ | ||
cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" # https://stackoverflow.com/a/17744637 | ||
|
||
export DIALECT=db2 | ||
SEQ_DB="${SEQ_DB:-testdb}" | ||
# db2 db names must be uppercase | ||
SEQ_DB=$(echo "$SEQ_DB" | awk '{print toupper($0)}') | ||
|
||
mkdir -p Docker | ||
if [ ! "$(sudo docker ps -q -f name=db2server)" ]; then | ||
if [ "$(sudo docker ps -aq -f status=exited -f name=db2server)" ]; | ||
then | ||
# cleanup | ||
sudo docker rm -f db2server | ||
sudo rm -rf /Docker | ||
fi | ||
# TODO: use docker compose so renovate can automatically update this version | ||
sudo docker run -h db2server --name db2server --restart=always --detach --privileged=true -p 50000:50000 --env "DBNAME=$SEQ_DB" --env-file ../.env_list -v /Docker:/database ibmcom/db2-amd64:11.5.8.0 | ||
count=1 | ||
while true | ||
do | ||
if (sudo docker logs db2server | grep 'Setup has completed') | ||
then | ||
sudo docker exec db2server bash -c "su db2inst1 & disown" | ||
break | ||
fi | ||
if [ $count -gt 30 ]; then | ||
echo "Error: Db2 docker setup has not completed in 10 minutes." | ||
break | ||
fi | ||
sleep 20 | ||
let "count=count+1" | ||
done | ||
fi | ||
|
||
DIALECT=db2 ts-node ../../check-connection.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
sudo docker stop db2server | ||
|
||
echo "Local latest supported Db2 instance stopped (if it was running)." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
sudo docker stop db2server | ||
|
||
echo "Local Db2 instance stopped (if it was running)." | ||
echo "Local oldest supported Db2 instance stopped (if it was running)." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
packages/core/src/decorators/legacy/built-in-attributes.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import type { ModelStatic } from '../../model.js'; | ||
import { isModelStatic } from '../../utils/model-utils.js'; | ||
import { registerModelOptions } from '../shared/model.js'; | ||
import type { OptionalParameterizedPropertyDecorator } from './decorator-utils.js'; | ||
import { | ||
createOptionallyParameterizedPropertyDecorator, | ||
throwMustBeAttribute, throwMustBeInstanceProperty, | ||
throwMustBeModel, | ||
} from './decorator-utils.js'; | ||
|
||
function createBuiltInAttributeDecorator( | ||
decoratorName: string, | ||
callback: ( | ||
target: ModelStatic, | ||
propertyName: string, | ||
) => void, | ||
): OptionalParameterizedPropertyDecorator<undefined> { | ||
return createOptionallyParameterizedPropertyDecorator<undefined>( | ||
decoratorName, | ||
undefined, | ||
(decoratorOption, target, propertyName) => { | ||
if (typeof target === 'function') { | ||
throwMustBeInstanceProperty(decoratorName, target, propertyName); | ||
} | ||
|
||
if (!isModelStatic(target.constructor)) { | ||
throwMustBeModel(decoratorName, target, propertyName); | ||
} | ||
|
||
if (typeof propertyName === 'symbol') { | ||
throwMustBeAttribute(decoratorName, target, propertyName); | ||
} | ||
|
||
callback(target.constructor, propertyName); | ||
}, | ||
); | ||
} | ||
|
||
export const CreatedAt = createBuiltInAttributeDecorator( | ||
'CreatedAt', | ||
(target: ModelStatic, propertyName: string) => { | ||
registerModelOptions(target, { | ||
createdAt: propertyName, | ||
timestamps: true, | ||
}); | ||
}, | ||
); | ||
|
||
export const UpdatedAt = createBuiltInAttributeDecorator( | ||
'UpdatedAt', | ||
(target: ModelStatic, propertyName: string) => { | ||
registerModelOptions(target, { | ||
updatedAt: propertyName, | ||
timestamps: true, | ||
}); | ||
}, | ||
); | ||
|
||
export const DeletedAt = createBuiltInAttributeDecorator( | ||
'DeletedAt', | ||
(target: ModelStatic, propertyName: string) => { | ||
registerModelOptions(target, { | ||
deletedAt: propertyName, | ||
timestamps: true, | ||
paranoid: true, | ||
}); | ||
}, | ||
); | ||
|
||
export const Version = createBuiltInAttributeDecorator( | ||
'Version', | ||
(target: ModelStatic, propertyName: string) => { | ||
registerModelOptions(target, { | ||
version: propertyName, | ||
}); | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.