How to create table postgresql when start by docker compose

前端 未结 1 412
一生所求
一生所求 2021-01-26 17:10

I know this question is already asked and also answer given. But it is not working for me. I follow the same. My postgres container is running fine. I checked inside the contain

相关标签:
1条回答
  • 2021-01-26 17:30

    You can write your queries inside init.sql, in this squence:-

    DROP DATABASE IF EXISTS test_db;    
    
    CREATE DATABASE test_db;    
    
    \c test_db;        
    
    CREATE TABLE Role(
    RoleID SERIAL PRIMARY KEY,
    RoleName varchar(50),
    );    
    insert into Role(RoleName)
    values ('Admin'),('User');
    
    0 讨论(0)
提交回复
热议问题