我在使用续集器创建模型时遇到问题。或者更准确地说,我可以创建模型并进行迁移,但我无法通过psql访问,修改或删除它们。
我正在创建这样的模型:
sequelize model:generate --name Device --attributes pid:string
输出:
Sequelize CLI [Node: 4.6.1, CLI: 3.0.0, ORM: 4.22.6] WARNING: This version of Sequelize CLI is not fully compatible with Sequelize v4. https://github.com/sequelize/cli#sequelize-support New model was created at /home/matti/workspace/db_demo/server/models/device.js . New migration was created at /home/matti/workspace/db_demo/server/migrations/20171114134820-Device.js .
像这样迁移:
$ sequelize db:migrate Sequelize CLI [Node: 4.6.1, CLI: 3.0.0, ORM: 4.22.6] WARNING: This version of Sequelize CLI is not fully compatible with Sequelize v4. https://github.com/sequelize/cli#sequelize-support Loaded configuration file "server/config/config.json". Using environment "development". sequelize deprecated String based operators are now deprecated. Please use Symbol based operators for better security, read more at http://docs.sequelizejs.com/manual/tutorial/querying.html#operators node_modules/sequelize/lib/sequelize.js:236:13 == 20171114134820-create-device: migrating ======= == 20171114134820-create-device: migrated (0.044s)
之后我可以看到psql中的表:
device-dev=# \d
List of relations
Schema | Name | Type | Owner
--------+----------------+----------+-------
public | Devices | table | matti
public | Devices_id_seq | sequence | matti
public | SequelizeMeta | table | matti
但是我无法列出表格:
device-dev=# \d Devices
Did not find any relation named "Devices".
我的用户凭据(使用它作为matti):
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------------------+-----------
matti | Superuser, Create DB | {}
postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
使用过的版本: Sequelize: Sequelize CLI [节点:4.6.1,CLI:3.0.0,ORM:4.22.6]
postgres的: psql(PostgreSQL)10.1
的NodeJS: v4.6.1
NPM: 2.15.9
我在Ubuntu 16.04工作。
我已经恢复了迁移并放弃了数据库只是为了确定。但它没有任何影响。也没有重新启动postgres。
我可以从psql创建,列出和删除db:ses as user“matti”。但不是续集器产生的那些。