Not able to create ENUM type attribute using sequelize cli - orm

Trying to create a model that has an enum field with certain values using Sequelize CLI.
sequelize model:generate --name user --attributes name:string,login_method:enum('email','google')
Error: bash: syntax error near unexpected token `('
What is the right syntax to do so?

https://github.com/sequelize/cli/blob/master/docs/FAQ.md
try
npx sequelize-cli model:generate --name user --attributes name:string,login_method:enum:'{email,google}'

you can do it with
model:generate --name User --attributes 'login_method:enum:{google,facebook}'
Another good example is:
npx sequelize-cli model:generate --name devicelogs --attributes 'type:enum:{embedded,console,wearable,smarttv,browser,tablet,mobile}','browser:enum:{Chrome,Firefox,Safari,Opera,Internet Explorer,Edge,Edge Chromium,Yandex,Chromium,Mobile Safari,Samsung Browser}'
from sequelize-cli code you can also try
first_name:string,last_name:string,bio:text,role:enum:{Admin, 'Guest User'},reviews:array:string
'first_name:string, last_name:string, bio:text, role:enum:{Admin, Guest User} reviews:array:string'

It should be possible to create enum values from model:create command
you can do like this .
$ sequelize model:create --name User --attributes opts:enum(x,y,z)
hope this help .

Try this one:
npx sequelize model:create --name User --attributes 'opts:enum:{x,y,z}'
Or
sequelize model:create --name User --attributes 'opts:enum:{x,y,z}'
Hope this will help you.

npx sequelize-cli model:generate --name User --attributes username:string,email:string,password:string,role:ENUM("users","admin")
instead or writing this try this
npx sequelize-cli model:generate --name User --attributes username:string,email:string,password:string,role:enum:'{users,admin}'

Related

Update odoo module from command line

Please, I need help, I am trying to update my module list in Odoo 11 from the command line.
I try these three commands:
==> -c ./etc/odoo-server.conf -u module_name -d database_name
==> ./odoo.py -u module_name
the solution in this link: https://gist.github.com/holdenrehg/9fd3f8596611bbfc45aea13d6315d4f4
but nothing has worked.
cd odoo-server/
./odoo-bin -c /etc/odoo-server.conf -d data_base_name -u module_name
The "Update Apps List" button triggers creation of a "Module Update" wizard. The wizard has a button, "Update", which runs the update_module method. The only important thing that update_module does is to call update_list against ir.module.module.
You can simulate this via shell with the command below, but I'm not sure there's a way to do it directly from the command line in an automated way.
self.env['ir.module.module'].update_list()
Please move to the location where odoo-bin exist and use the below command
./odoo-bin -c /etc/odoo-server.conf --db-filter='data_base_name' -u module_name

Why is npm passing cmd line flags directly to my script?

I'm using npm to run a build and I'm trying to override my .npmrc config options using cmd line flags. However npm insists on passing these flags directly to my script rather than reading them as config options as described in the docs. What am I doing wrong?
From the cmd line I try to build a Tizen pacakge like so:
npm run package --tizen_profile myprofile
inside my package.json I have:
"package": "tizen package -t wgt --sign $npm_package_config_tizen_profile -- .buildResult/wgt -o .buildResult/wgt"
The result from running the command is:
package: `tizen package -t wgt --sign $npm_package_config_tizen_profile -- .buildResult/wgt -o .buildResult/wgt "myprofile"`
Where it should be:
package: `tizen package -t wgt --sign "myprofile"_tizen_profile -- .buildResult/wgt -o .buildResult/wgt`
It's like npm is merely appending the cmd line argument to the script command instead of plugging it in like a variable as described in the docs: https://docs.npmjs.com/misc/config
Has there been a recent update to npm which deprecates and removes this ability? I just updated to npm 6.x but it was working this way on 5.x as well.
you can try to rewrite your script within package.json without --sign flag like:
"package": "tizen package -t wgt -- .buildResult/wgt -o .buildResult/wgt"
and then pass it when you run npm command:
npm run package -- --sign myprofile
I assume that you can change the order of arguments, because --sign myprofile now will be at the very end of your command
UPDATE
here is another way to pass variables and place them in any place in your CLI command (without using npm config set). In my package.json:
"aaa": "ls $myoptionalflag && $mycmd"
this way I can pass any flag to la command (or not to pass at all) and I can pass any CLI command as mycmd variable. So, now I can run:
myoptionalflag=-la mycmd=pwd npm run aaa
which will execute
ls -la && pwd
or
mycmd=pwd npm run aaa
which will execute
ls && pwd
I FIGURED IT OUT!
The documentation is flawed as it doesn't tell you the correct syntax for passing npm config properties. I had to use:
npm run package --mypackagename:tizen_profile="myprofile"
where mypackagename is the name property used in package.json. Also note the key value syntax is --key=value and not --key value as described in the docs. Again, --key would be packagename:key using the name specified at the top level of your package.json.

How to make a Docker environment variable value to get a random id

I am looking to pass an environment variable which should get a random id.
Something like below.
ENV SERVICE_TAG= $uuid
In short, every time I run the container, I should get a random id for this environment variable inside the container.
Can anyone please suggest the way forward?
Thanks and regards,
Prasanth.
Add uuidgen package to the image. In case you are using alpine add
RUN apk add --no-cache util-linux
to the Dockerfile
Then in the entrypoint of your Dockerfile add
Below is a sample Dockerfile
FROM alpine:latest
RUN apk add --no-cache util-linux
ENTRYPOINT export UUID=`uuidgen` && echo $UUIDFROM alpine:latest
You should pass the environment variable from a docker run -env parameter generated uuid or guid from your shell, eg:
bash:
docker run --env SERVICE_TAG=$(uuidgen) yourimage
See more details at the official docker docs:
https://docs.docker.com/engine/reference/commandline/run/#set-environment-variables--e---env---env-file

Zypper repository authentication (non-interactive)

I need to add a repository using zypper that requires authentication from a Dockerfile. I'm able to add it, but of course, when I try to run
zypper -n refresh
It fails because the authentication failed.
What is the normal approach to automate the authentication process? Didn't find a good answer while "googling".
Solved it like this:
Dockerfile
ARG MY_REPO_USERNAME
ARG MY_REPO_PASSWORD
RUN zypper -n addrepo https://$MY_REPO_USERNAME:$MY_REPO_PASSWORD#repo.domain/foo/bar repo-domain-alias
When building the image:
docker build --build-arg MY_REPO_USERNAME=my_username --build-arg MY_REPO_PASSWORD=my_password -tag my-image-name .

Create docker image to run selenium tests on different browser versions

I am currently learning to use docker to run selenium tests.
However, to run tests on different versions of the browser, it requires creating our own image.
I tried few ways but failed to run them.
I used the docker file at below path:
https://hub.docker.com/r/selenium/node-chrome/~/dockerfile/
and tried to build the image by using the following command:
docker build -t my-chrome-image --build-arg CHROME_DRIVER_VERSION=2.23 --build-arg CHROME_VERSION=google-chrome-beta=53.0.2785.92-1 NodeChrome
Can anyone guide me on how to implement the same?
Regards,
Ashwin Karangutkar
Use
docker build -t my-chrome-image --build-arg CHROME_DRIVER_VERSION=2.23 --build-arg CHROME_VERSION=google-chrome-beta <path_to_Dockerfile>
I am using elgalu/selenium.
docker run -d --name=grid -p 4444:24444 -p 5900:25900 --shm-size=1g elgalu/selenium
And looking in elgalu looks like you can change the browser versions.
Adding -e FIREFOX_VERSION=38.0.6 to the docker run command.