-
Hi, I'm new to sqlx and not sure what I'm doing wrong. It seems the migration happens but only the rustc 1.79.0 migrations/0001_create_users_table.sql -- up
CREATE TABLE users (
id SERIAL PRIMARY KEY,
email TEXT NOT NULL UNIQUE,
first_name TEXT NOT NULL,
last_name TEXT NOT NULL,
password TEXT NOT NULL,
email_verified BOOLEAN NOT NULL DEFAULT FALSE,
oauth_provider TEXT,
oauth_id TEXT,
magic_link_token TEXT,
magic_link_expiration TIMESTAMP,
created_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_date TIMESTAMP NULL
);
-- down
DROP TABLE users; .env:
Run the migration: % sqlx migrate run
Applied 1/migrate create users table (8.739375ms)
% sqlx migrate info
1/installed create users table Has not created a users table: / # psql postgres://postgres:secret@localhost:5432/postgres
psql (16.3)
Type "help" for help.
postgres=# \dt
List of relations
Schema | Name | Type | Owner
--------+------------------+-------+----------
public | _sqlx_migrations | table | postgres
(1 row) DB created with docker compose: version: "3.9"
networks:
postgres:
name: ${DB_CONTAINER:-postgres}
volumes:
db:
name: ${DB_CONTAINER:-postgres}
services:
postgres:
image: postgres:16.3-alpine
container_name: ${DB_CONTAINER:-postgres}
restart: always
environment:
- POSTGRES_USER=${DB_USERNAME:-postgres}
- POSTGRES_PASSWORD=${DB_PASSWORD:-secret}
- POSTGRES_DB=${DB_DATABASE:-postgres}
volumes:
- db:/var/lib/postgresql/data
ports:
- 5432:5432
networks:
- postgres What am I doing wrong here? Thanks 🤔 |
Beta Was this translation helpful? Give feedback.
Answered by
sekoyo
Jul 13, 2024
Replies: 1 comment
-
I misunderstood that there is no --up/--down so I removed that and just kept the up part and it worked |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
sekoyo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I misunderstood that there is no --up/--down so I removed that and just kept the up part and it worked