I am trying to spin a postgres container from docker-compose, copying *.sql files to /docker-entrypoint-initdb.d in order to create the database and the schema.
The logs from the docker-compose run:
/usr/local/bin/docker-entrypoint.sh: sourcing /docker-entrypoint-initdb.d/02-schema.sql
db_1 | CREATE DATABASE
db_1 | GRANT
db_1 | SET
db_1 | CREATE TABLE
db_1 | CREATE INDEX
db_1 | CREATE TABLE
db_1 | CREATE TABLE
The database is created, but non of the tables is created. Below is my schema.sql file
CREATE DATABASE sample_db OWNER user1;
GRANT ALL PRIVILEGES ON DATABASE sample_db TO user1;
CREATE TABLE PUBLIC.PROFILES(
USER_ID VARCHAR(50) PRIMARY KEY,
NAME VARCHAR(50) NOT NULL
);
I used to do the same with my sql container, adding : USE sample_db, but I couldn't find the equivalent postgres command.