diff --git a/.gitignore b/.gitignore index af50845..018b872 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,5 @@ -./target/* \ No newline at end of file +target/ +*.iml +.idea/ +demo.iml +*.class \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 8676242..556ccd1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,14 +1,14 @@ version: '3' services: - db: - image: postgres:latest - container_name: emolog_db - volumes: - - ./docker/pg:/docker-entrypoint-initdb.d - environment: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_DB: test_db - ports: - - '5432:5432' \ No newline at end of file + db: + image: postgres:latest + container_name: emolog_db + volumes: + - ./docker/pg:/docker-entrypoint-initdb.d + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: test_db + ports: + - '5432:5432' \ No newline at end of file diff --git a/docker/pg/1-createTable.sql b/docker/pg/1-createTable.sql index 84ee809..e62fcca 100644 --- a/docker/pg/1-createTable.sql +++ b/docker/pg/1-createTable.sql @@ -1,16 +1,57 @@ create table users ( id serial primary key, - name varchar not null, - age integer not null + name varchar(30) not null, + mail varchar(50) not null, + filterlevel smallint +); + +create table friend ( + id serial primary key, + userid INTEGER not null, + friendid INTEGER not null, + name varchar(30) not null, + latestemolog varchar(30) +); + +create table emolog ( + id serial primary key, + userid INTEGER not null, + friendid INTEGER not null, + create_at timestamp, + contents varchar(30) +); + +create table talk ( + id serial primary key, + userid INTEGER not null, + friendid INTEGER not null, + contents varchar(30) + create_at timestamp, +); + +create table requestfriend ( + id serial primary key, + userid INTEGER not null, + requestfriendid INTEGER not null, + contents varchar(30) + create_at timestamp, ); create table emojicode ( keyword serial primary key, - emoji_code + emoji_code ); + +insert into users(name, mail, filterlevel) values + ('ichigo.chocomint', 'hoge@hoge.com', 1), + ('banana.chocomint', 'hogehoge@hoge.com', 2), + ('pinapple.chocomint', 'hogehogehoge@hoge.com', 3) +; + + insert into users(name, age) values ('ichigo.chocomint', 99), ('banana.chocomint', 98), ('pinapple.chocomint', 97) -; \ No newline at end of file +; diff --git a/src/main/java/com/example/demo/DemoApplication.java b/src/main/java/com/example/demo/DemoApplication.java index 1621886..7969051 100644 --- a/src/main/java/com/example/demo/DemoApplication.java +++ b/src/main/java/com/example/demo/DemoApplication.java @@ -12,7 +12,7 @@ public class DemoApplication implements CommandLineRunner { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } - +q @Autowired JdbcTemplate jdbcTemplate;