Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1-createTable #38

Merged
merged 2 commits into from
Aug 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 69 additions & 60 deletions docker/pg/1-createTable.sql
Original file line number Diff line number Diff line change
@@ -1,84 +1,93 @@
create table users (
id serial primary key,
name varchar(30) not null,
mail varchar(50) not null,
filterlevel smallint
id serial primary key,
name varchar(30) not null,
mail varchar(50) not null,
filterlevel smallint
);

insert into users(name, mail, filterlevel) values
('ichigo.chocomint', '[email protected]', 1),
('banana.chocomint', '[email protected]', 2),
('pinapple.chocomint', '[email protected]', 3)
;

create table sample (
id serial primary key,
name varchar(30) not null,
mail varchar(50) not null,
filterlevel smallint
id serial primary key,
name varchar(30) not null,
mail varchar(50) not null,
filterlevel smallint
);

insert into sample(name, mail, filterlevel) values
('ichigo.chocomint', '[email protected]', 1),
('banana.chocomint', '[email protected]', 2),
('pinapple.chocomint', '[email protected]', 3)
;

create table friend (
id serial primary key,
userid INTEGER not null,
name varchar(30) not null,
latestemolog varchar(30),
updated_at timestamp
id serial primary key,
userid INTEGER not null,
name varchar(30) not null,
latestemolog varchar(30),
updated_at timestamp
);

insert into friend(userid, name, latestemolog, updated_at) values
(123, 'ichigo.chocomint', '🍎🍋🍇', 2020-08-24 16:24:29.353806),
(456, 'banana.chocomint', '🍈🍓🍌', 2020-08-25 16:24:29.353806),
(789, 'pinapple.chocomint', '🍊🥝', 2020-08-26 16:24:29.353806)
;

create table emolog (
id serial primary key,
userid INTEGER not null,
friendid INTEGER not null,
created_at timestamp,
contents varchar(30)
id serial primary key,
userid INTEGER not null,
friendid INTEGER not null,
created_at timestamp,
contents varchar(30)
);

insert into emolog(userid, friendid, created_at, contents) values
(123, 456, 2020-08-26 16:24:29.353806, U+1F600)
;
create table chat (
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,
create_at timestamp
);

create table talk (
id serial primary key,
userid INTEGER not null,
friendid INTEGER not null,
contents varchar(30),
create_at timestamp
create table emojicode (
keyword serial primary key,
emoji_code varchar(30)
);

insert into talk(userid, friendid, contents, create_at) values
(123, 456, "こんにちは", 2020-08-26 16:24:29.353806)
insert into users(name, mail, filterlevel) values
('ichigo.chocomint', '[email protected]', 1),
('banana.chocomint', '[email protected]', 2),
('pinapple.chocomint', '[email protected]', 3),
('apple.chocomint', '[email protected]', 4),
('lemon.chocomint', '[email protected]', 5)
;

create table requestfriend (
id serial primary key,
userid INTEGER not null,
requestfriendid INTEGER not null,
contents varchar(30),
create_at timestamp
);
insert into friend(userid, name, latestemolog, updated_at) values
(123, 'ichigo.chocomint', '🍎🍋🍇', '2001-01-01 01:01:01'),
(456, 'banana.chocomint', '🍈🍓🍌', '2002-02-02 02:02:02'),
(789, 'pinapple.chocomint', '🍊🥝🍎', '2003-03-03 03:03:03'),
(321, 'apple.chocomint', '🍋🍇🍈', '2004-04-04 04:04:04'),
(654, 'lemon.chocomint', '🍓🍌🍊', '2005-05-05 05:05:05')
;

insert table requestfriend() values
()
insert into emolog(userid, friendid, created_at, contents) values
(1, 2, '2006-06-06 06:06:06', '⛰🌋🗻'),
(2, 1, '2007-07-07 07:07:07', '🏘🏠🏡'),
(1, 3, '2008-08-08 08:08:08', '🐒🦍🐒'),
(3, 1, '2009-09-09 09:09:09', '⭐️🌟⭐️'),
(2, 3, '2010-10-10 10:10:10', '🐈🐈🐈')
;

create table emojicode (
keyword serial primary key,
emoji_code varchar(30)
);
insert into chat(userid, friendid, contents, create_at) values
(123, 456, 'Hello', '2011-11-11 11:11:11'),
(789, 123, 'Good morning', '2012-12-12 12:12:12'),
(456, 789, 'Good afternoon', '2013-01-13 01:13:13'),
(456, 123, 'Good evening', '2014-02-14 02:14:14'),
(123, 789, 'Good night', '2015-03-15 03:15:15')

;

insert into requestfriend(userid, requestfriendid, create_at) values
(12, 34, '2016-04-16 04:16:16'),
(56, 78, '2017-05-17 05:17:17'),
(91, 23, '2018-06-18 06:18:18'),
(45, 67, '2019-07-19 07:19:19'),
(89, 12, '2020-08-20 08:20:20')
;
insert into users(name, mail, filterlevel) values
('ichigo.chocomint', '[email protected]', 1),
('banana.chocomint', '[email protected]', 2),
Expand Down