Knex migration don't create the tables
Knex won't create the sequences without creating the tables. I've tried your migration with a local test setup I use for Stack Overflow questions, and it works fine (the stack uses docker-compose
, though the config is trivially different to yours).
There could be a variety of reasons why the tables appear to be absent, depending on what you're using to look for them. The simplest way to go is probably to connect to your database using:
psql postgres://postgres:postgres@localhost/users
and then issue a \dt
command. If you don't see the table listed, you could try \dn+
to show the available schemas and permissions for each. Specifically asking for the table via \d users
(or even \d public.users
) may be helpful.
If you still can't "see" the tables, perhaps edit your question with more detail about how you're testing for them, and someone may be able to help further.
Here's a simple docker-compose.yml
you could try your migration against:
version: '3.1'services: postgres: image: postgres:11 restart: always environment: POSTGRES_PASSWORD: example POSTGRES_USER: example POSTGRES_DB: users ports: - 5432:5432 adminer: image: adminer restart: always ports: - 8080:8080
You can use the adminer web interface on http://localhost:8080 to browse the database if psql is not your preferred tool.