Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
252 commits
Select commit Hold shift + click to select a range
93ae88d
changed binary to varchar(200) in message table
SpiderBall Mar 9, 2015
f7be5ba
replaced varchar to bytea in irc.sql
SpiderBall Mar 9, 2015
3325d6e
added connectToDB
SpiderBall Mar 9, 2015
4d73ca5
added a comment to server.js
SpiderBall Mar 9, 2015
5862c7f
added Michelle's insert query
SpiderBall Mar 9, 2015
3c2f944
A file that might be helpful.
MidnaPeach Mar 9, 2015
95ddef8
Merge pull request #1 from MidnaPeach/master
SpiderBall Mar 9, 2015
e29af70
I think I just updated index, mostly I want to check if github and I …
MidnaPeach Mar 13, 2015
8f4ae22
Merge pull request #2 from MidnaPeach/master
SpiderBall Mar 13, 2015
1b6d2f4
I am adding a ton of comments to try to understand what is happening …
MidnaPeach Mar 13, 2015
d116a35
Merge pull request #3 from MidnaPeach/master
SpiderBall Mar 13, 2015
4ed052d
committing because it told me to
SpiderBall Mar 13, 2015
9d79c69
hai
SpiderBall Mar 13, 2015
9ac483b
testy crap
MidnaPeach Mar 13, 2015
c9ea566
Yay this works now, git editor changed from nano, not really a thing …
MidnaPeach Mar 13, 2015
2cf21dc
added a comment above uuid
SpiderBall Mar 13, 2015
335ccc0
I added some code, and more comments.
MidnaPeach Mar 13, 2015
4e84ce4
Merge pull request #4 from MidnaPeach/master
SpiderBall Mar 13, 2015
56d1282
committing because i need to merge
SpiderBall Mar 13, 2015
a6bfe96
Merge branch 'master' of https://github.com/SpiderBall/irc
SpiderBall Mar 13, 2015
6d05a5a
Merge pull request #1 from SpiderBall/master
Mar 13, 2015
81f87c5
Merge branch 'master' of https://github.com/MidnaPeach/irc
SpiderBall Mar 13, 2015
fe4decb
I added conn stuff and cursor stuff into each socket function.
MidnaPeach Mar 13, 2015
671d54f
Merge branch 'master' of https://github.com/MidnaPeach/irc
SpiderBall Mar 13, 2015
577e3d9
I added a penis
SpiderBall Mar 13, 2015
365b07f
testing
MidnaPeach Mar 13, 2015
686db9c
Merge pull request #5 from MidnaPeach/master
SpiderBall Mar 13, 2015
1e89ac7
Merge pull request #2 from SpiderBall/master
Mar 13, 2015
995a1ac
took out the penis
SpiderBall Mar 13, 2015
06790da
Merge pull request #6 from MidnaPeach/master
SpiderBall Mar 13, 2015
d3ffcb1
Merge pull request #3 from SpiderBall/master
Mar 13, 2015
e62df68
adding the fact that there is a username and password in the login fu…
MidnaPeach Mar 13, 2015
a6f6567
Merge pull request #7 from MidnaPeach/master
SpiderBall Mar 13, 2015
5db13b1
This sure is terrible message attempt.
MidnaPeach Mar 14, 2015
2ae39eb
added a login function that should work with postgres, committing to …
SpiderBall Mar 14, 2015
7328fd2
added print statements to see what each function does to the website
SpiderBall Mar 14, 2015
f3d4de9
added a means to execute a select users query in updateroster, finger…
SpiderBall Mar 14, 2015
9ab6aea
changed irc to irc_db
SpiderBall Mar 14, 2015
54be38c
added print B, testing git stash
SpiderBall Mar 15, 2015
0a5922d
I'm trying to do a thing.
MidnaPeach Mar 15, 2015
6b5548b
Merge pull request #8 from MidnaPeach/master
SpiderBall Mar 15, 2015
dc528eb
put my stash back
SpiderBall Mar 15, 2015
9420bb5
Just double checking we are on the same page
MidnaPeach Mar 15, 2015
4426b66
found two semicolons that were breaking things
SpiderBall Mar 15, 2015
2b7b8f1
Merge branch 'master' of https://github.com/SpiderBall/irc
SpiderBall Mar 15, 2015
7fdc5ea
Added index.html and a new server.py. Trying to get login variables.
MidnaPeach Mar 15, 2015
0e1e1c1
Merge https://github.com/MidnaPeach/irc
SpiderBall Mar 15, 2015
3ed7b4a
Merge branch 'master' of https://github.com/SpiderBall/irc
SpiderBall Mar 15, 2015
e226ef9
stuff?
SpiderBall Mar 15, 2015
18e8678
We will get login to work. It is inevitable.
MidnaPeach Mar 15, 2015
031e76b
M;erge https://github.com/MidnaPeach/irc
SpiderBall Mar 15, 2015
91d6232
removed session password
SpiderBall Mar 15, 2015
361796f
whatever
SpiderBall Mar 15, 2015
8aac8ed
Merge branch 'master' of https://github.com/SpiderBall/irc
SpiderBall Mar 15, 2015
c2e70c2
attempted error handling for login
SpiderBall Mar 15, 2015
6d8d77e
balsjkf
SpiderBall Mar 15, 2015
ea54ce7
jsklhfdMerge branch 'master' of https://github.com/SpiderBall/irc
SpiderBall Mar 15, 2015
d77dad5
Found out how to do error printing, which will save us hours. Trying …
MidnaPeach Mar 15, 2015
95d9c3c
Merge https://github.com/MidnaPeach/irc
SpiderBall Mar 15, 2015
e4222ed
Merge branch 'master' of https://github.com/SpiderBall/irc
SpiderBall Mar 15, 2015
140eca8
Merge pull request #6 from SpiderBall/master
Mar 15, 2015
209dc65
ehhhhhhhhsdfjkdsfkjh
MidnaPeach Mar 15, 2015
96a6ebd
changed == to is
SpiderBall Mar 15, 2015
9db4fec
saldfjMerge branch 'master' of https://github.com/SpiderBall/irc
SpiderBall Mar 15, 2015
53fe066
null is None now
SpiderBall Mar 15, 2015
b9de6f4
skld;fja
SpiderBall Mar 15, 2015
f9b0a51
The message thingy inserts into the table oMG
MidnaPeach Mar 15, 2015
fb42da8
skljf
SpiderBall Mar 15, 2015
78b3e7f
Did this work?
MidnaPeach Mar 15, 2015
29d48e3
alkfderge https://github.com/MidnaPeach/irc
SpiderBall Mar 15, 2015
2ce4c01
as;lfjksMerge branch 'master' of https://github.com/SpiderBall/irc
SpiderBall Mar 15, 2015
7dae489
Figuring out why it can't read users. bob guy to the rescue!
MidnaPeach Mar 15, 2015
8d397b3
Merge https://github.com/MidnaPeach/irc
SpiderBall Mar 15, 2015
dcc339f
Changed a few variable names and adds a comment that explains what uu…
MidnaPeach Mar 15, 2015
d8abc86
Added notion of rooms
zacharski Mar 15, 2015
1d3a29f
Merge https://github.com/MidnaPeach/irc
SpiderBall Mar 15, 2015
5fbb4ea
Changed index.html name to username line 157
MidnaPeach Mar 15, 2015
aef5cd5
Merge https://github.com/MidnaPeach/irc
SpiderBall Mar 15, 2015
f28de18
Making stuff up to date.
MidnaPeach Mar 15, 2015
9481b85
Merge https://github.com/MidnaPeach/irc
SpiderBall Mar 15, 2015
fb97129
I'm adding things before I crash. >~< I'll be better tomorrow.
MidnaPeach Mar 16, 2015
2e08540
Merge https://github.com/MidnaPeach/irc
SpiderBall Mar 16, 2015
a5454af
kljf
SpiderBall Mar 16, 2015
61f529c
Merge branch 'master' of https://github.com/SpiderBall/irc
SpiderBall Mar 16, 2015
a4253f7
changed names = [] to names = users. hope this works
SpiderBall Mar 16, 2015
cd9ca29
dkjsgMerge branch 'master' of https://github.com/SpiderBall/irc
SpiderBall Mar 16, 2015
722985e
changed print item to print item[0]
SpiderBall Mar 16, 2015
ee91ff9
salkdf
SpiderBall Mar 16, 2015
9990325
changed names users to names=users[1] to see if that would just pass …
SpiderBall Mar 16, 2015
1c2db33
kljdfMerge branch 'master' of https://github.com/SpiderBall/irc
SpiderBall Mar 16, 2015
fdf5364
i figured out why the whole list is printing, we needed to access nam…
SpiderBall Mar 16, 2015
d4cb2d7
Merge branch 'master' of https://github.com/SpiderBall/irc
SpiderBall Mar 16, 2015
77f8a35
changed item to item[1] to see if that would just print out names
SpiderBall Mar 16, 2015
ff64fea
skjkfMerge branch 'master' of https://github.com/SpiderBall/irc
SpiderBall Mar 16, 2015
cc5f79b
changed names to names[][1] to see if that will print just the name
SpiderBall Mar 16, 2015
d2710e1
aklsdfjMerge branch 'master' of https://github.com/SpiderBall/irc
SpiderBall Mar 16, 2015
d47df57
added count=0 and names[count][1] as a clever way to check each eleme…
SpiderBall Mar 16, 2015
a68800f
asdfskjlfMerge branch 'master' of https://github.com/SpiderBall/irc
SpiderBall Mar 16, 2015
97badd1
trying to make sure count does not go out of bounds
SpiderBall Mar 16, 2015
4d58ff9
lkxjvcMerge branch 'master' of https://github.com/SpiderBall/irc
SpiderBall Mar 16, 2015
057739f
update roster officially works. the code looks pretty awful rn, but i…
SpiderBall Mar 16, 2015
63fc65a
cleaned up a bit, changed update roster back to what raz had, it turn…
SpiderBall Mar 16, 2015
0dc056b
can successfully log in, just doesnt show up on the screen
SpiderBall Mar 16, 2015
1c5e400
Have the messages from before displaying, and cleaned up some previou…
MidnaPeach Mar 16, 2015
281b56b
merging after a slight start over
MidnaPeach Mar 16, 2015
13338e8
attempted to add a search bar
SpiderBall Mar 16, 2015
85b0679
added text box to search bar
SpiderBall Mar 16, 2015
6d59dab
changed Search to go and switched the button and the text box
SpiderBall Mar 16, 2015
03dcf06
made it so the search bar doesnt copy its text into message box
SpiderBall Mar 16, 2015
75676ac
Merge branch 'master' of https://github.com/SpiderBall/irc
SpiderBall Mar 16, 2015
6e301dd
Almost got previous messages loading
MidnaPeach Mar 16, 2015
494d5fe
wrote search query
SpiderBall Mar 16, 2015
3498f43
rge branch 'master' of https://github.com/SpiderBall/irc
SpiderBall Mar 16, 2015
68dfbe3
moved search function up so that i can compare how other functions ta…
SpiderBall Mar 16, 2015
07a0a7a
Grabbed all previous messages and their usernames. ugh.
MidnaPeach Mar 16, 2015
e52ee37
asodufh
SpiderBall Mar 16, 2015
4036add
asx
SpiderBall Mar 16, 2015
f740b03
Merge https://github.com/MidnaPeach/irc
SpiderBall Mar 16, 2015
d9796c8
This is me trying to get previous messages to display
MidnaPeach Mar 16, 2015
7a82d44
This is the updated index.html, along with server.py to be sure
MidnaPeach Mar 17, 2015
380ee12
adding michelles latest changes
SpiderBall Mar 17, 2015
4dff89b
Hey I just got the previous messages to display, now I'm working on s…
MidnaPeach Mar 17, 2015
2f0d492
Merge dammit
MidnaPeach Mar 17, 2015
1d15e5b
This should be the up to date server.py
MidnaPeach Mar 17, 2015
11de73a
fixing merge bullshit
SpiderBall Mar 17, 2015
947d0f9
Merge https://github.com/MidnaPeach/irc
SpiderBall Mar 17, 2015
217d605
changed searchterm to work with %%
SpiderBall Mar 17, 2015
2d2a2fb
IT IS DONEEEEE
MidnaPeach Mar 17, 2015
a55a672
lsdkf
SpiderBall Mar 18, 2015
3d8e1aa
added michelle's change to search bar
SpiderBall Mar 18, 2015
edf1215
added some print statements for diagnostics
SpiderBall Mar 18, 2015
b606e68
seeing if an if statement can help prevent more errors
SpiderBall Mar 18, 2015
65748a5
added helpful print statements
SpiderBall Mar 18, 2015
4859038
set scope to another value in index.html
SpiderBall Mar 18, 2015
aba0d91
the changes i just made earlier actually broke it, so im changing it …
SpiderBall Mar 18, 2015
5d75b29
added back those random lines i deleted
SpiderBall Mar 18, 2015
9440e81
trying something weird; adding the variable searchItem2 to see if tra…
SpiderBall Mar 18, 2015
a21f14f
still not working whyyyy
SpiderBall Mar 18, 2015
d84f0dc
got it to work :D
SpiderBall Mar 18, 2015
e6d8e9e
playing around with the html
SpiderBall Mar 18, 2015
24e2105
created a new user so that when someone runs the irc.sql they wont ha…
SpiderBall Mar 18, 2015
8ac972c
This should be the last commit I think.
MidnaPeach Mar 19, 2015
a154d34
MERGED RAZ'S IRC
SpiderBall Mar 23, 2015
782a4e0
hi im commiting because reasons
SpiderBall Mar 23, 2015
981b592
Merge branch 'master' of https://github.com/SpiderBall/irc
SpiderBall Mar 23, 2015
ec5d096
Merging stuff
MidnaPeach Mar 26, 2015
9d56092
merged raz stuff
SpiderBall Mar 27, 2015
4fa1a26
Merge branch 'master' of https://github.com/SpiderBall/irc
SpiderBall Mar 27, 2015
6bd0c54
actually added files this time:
SpiderBall Mar 27, 2015
321dea2
will this push to master
SpiderBall Mar 27, 2015
1f89003
again?
SpiderBall Mar 27, 2015
c113ede
Merge branch 'master' of https://github.com/SpiderBall/irc
SpiderBall Mar 27, 2015
5e53d52
cleaned up repo a bit
SpiderBall Mar 27, 2015
23820d8
found why all that code was printing out, forgot to comment out somet…
SpiderBall Mar 27, 2015
643e069
Merge branch 'master' of https://github.com/SpiderBall/irc
SpiderBall Mar 27, 2015
4b58ad5
got rid of line printing near the msg box
SpiderBall Mar 27, 2015
b29ab04
Merge branch 'master' of https://github.com/SpiderBall/irc
SpiderBall Mar 27, 2015
d9ba809
nevermine
SpiderBall Mar 27, 2015
b9dcedd
laskjfMerge branch 'master' of https://github.com/SpiderBall/irc
SpiderBall Mar 27, 2015
3b12b26
cleanup
SpiderBall Mar 27, 2015
80d40a8
rooms are doing a thing now
SpiderBall Mar 27, 2015
617c7c4
added hello to see if i know where the problem is
SpiderBall Mar 27, 2015
4d7f46d
bkashfd
SpiderBall Mar 27, 2015
c8af551
maybe fixed object error
SpiderBall Mar 27, 2015
b202a80
there is no steak Merge https://github.com/SpiderBall/irc
MidnaPeach Mar 27, 2015
e97b97c
merging bc unmerged ugh
MidnaPeach Mar 28, 2015
a13c9d1
hopefully up to date for sprint2
MidnaPeach Mar 28, 2015
a1b174a
log in should work
SpiderBall Mar 28, 2015
688c394
doin a thing so up to date on login for reals Merge https://github.co…
MidnaPeach Mar 28, 2015
746df8b
The current room now displays above the chat window
MidnaPeach Mar 28, 2015
2bf9662
Imported the join_room and leave_room also did some other stuff with …
MidnaPeach Mar 28, 2015
bbe684a
Updated readme
MidnaPeach Mar 28, 2015
4a2c126
Everything I have for now, trying to get chat to communicate with roo…
MidnaPeach Mar 28, 2015
cee8a6f
added a rooms table to the sql file, now associates each message with…
SpiderBall Mar 28, 2015
ba09ff1
Merge branch 'master' of https://github.com/SpiderBall/irc
SpiderBall Mar 28, 2015
6729cc8
Merge branch 'master' of https://github.com/SpiderBall/irc
SpiderBall Mar 28, 2015
8dee071
just realized that michelle also edited the irc.sql file, changed it …
SpiderBall Mar 28, 2015
25692cb
fixed some small things in the irc.sql file
SpiderBall Mar 28, 2015
777f861
screwed it up so that it doesnt add tables to irc_db, fixed that
SpiderBall Mar 28, 2015
d9c492d
added subscriptions table
SpiderBall Mar 30, 2015
649d6dd
added a comma
SpiderBall Mar 30, 2015
e0b8088
uncommented updateRooms just to see what it does
SpiderBall Mar 30, 2015
e079cc3
moved insert to new_room function, added select statement to updaterooms
SpiderBall Mar 30, 2015
fa2130b
put the insert statements back in update rooms
SpiderBall Mar 30, 2015
7cea163
trying to use data as a session
SpiderBall Mar 30, 2015
58c3fc8
Merge branch 'master' of https://github.com/SpiderBall/irc into HEAD
SpiderBall Mar 30, 2015
5260ca7
added data['room'] stuff, had HEAD issues
SpiderBall Mar 30, 2015
119d4ce
added emit back
SpiderBall Mar 30, 2015
a177c34
added session['room']
SpiderBall Mar 30, 2015
8e9e511
fixed data['room']
SpiderBall Mar 30, 2015
3904edf
made room a tuple`
SpiderBall Mar 30, 2015
3cce547
commented out code from documentation
SpiderBall Mar 30, 2015
67aa1f7
fa
SpiderBall Mar 30, 2015
6a9ab81
attempting to print room in session
SpiderBall Mar 30, 2015
a1f566b
lskjf
SpiderBall Mar 30, 2015
f26cda0
deleted user_in_room element in rooms table
SpiderBall Mar 30, 2015
ff31177
Got it finally inserting rooms into the rooms table, but it can't see…
MidnaPeach Mar 31, 2015
7990a66
cant remember if i changed anything
SpiderBall Mar 31, 2015
4ad55f1
removed swp file
SpiderBall Mar 31, 2015
e9cf7f6
Merge https://github.com/MidnaPeach/irc
SpiderBall Mar 31, 2015
20906af
fixed a small merge conflict in irc.sql
SpiderBall Mar 31, 2015
2bfa921
printing room
SpiderBall Mar 31, 2015
9dbba78
added rooms to irc.sql as a means of testing before adding to the db
SpiderBall Mar 31, 2015
c1b725c
commenting out a line to see what it does
SpiderBall Mar 31, 2015
cd6a755
l;kdf
SpiderBall Mar 31, 2015
1177772
added a get roomid function (not tested)
SpiderBall Mar 31, 2015
3535404
added print statements around id select
SpiderBall Mar 31, 2015
1cfa5c1
inserted room id in insert message alsdkfj
SpiderBall Mar 31, 2015
3e84e7f
made savannahs function return to the past yeah
MidnaPeach Mar 31, 2015
637678c
savannahs function id thing
MidnaPeach Mar 31, 2015
d8c9346
id shit
SpiderBall Mar 31, 2015
65c5b96
sjl;kflas
SpiderBall Mar 31, 2015
47024b8
alskdjf
SpiderBall Mar 31, 2015
9955743
skj;dfa
SpiderBall Mar 31, 2015
8c9574f
asldkfjs
SpiderBall Mar 31, 2015
47f614d
i switched searchterm with roomname
SpiderBall Mar 31, 2015
6f82961
asl;dkfhs
SpiderBall Mar 31, 2015
909b4b6
used an alias to see if that would make the where clause work
SpiderBall Mar 31, 2015
3cd135a
changed inner join to natural join
SpiderBall Mar 31, 2015
b964d18
changed natural join to join pls work
SpiderBall Mar 31, 2015
1d5ae7e
holy shit i was supposed to use ON before rooms, not messages
SpiderBall Mar 31, 2015
dcf9fb2
removed needless alias, hopefully this will fix search
SpiderBall Mar 31, 2015
0bbeba7
moved insert statement to new_room
SpiderBall Mar 31, 2015
b0f78e5
forgot conn stuff
SpiderBall Mar 31, 2015
8ac2c20
asolsa
SpiderBall Mar 31, 2015
f825eed
wrote select statement to add previously made rooms to the rooms list
SpiderBall Mar 31, 2015
41924c8
only adding room[0] to rooms
SpiderBall Mar 31, 2015
4a5f78e
printing room[1]
SpiderBall Mar 31, 2015
75a076e
added printed bool
SpiderBall Mar 31, 2015
628a853
capitalized true and false
SpiderBall Mar 31, 2015
fd9b34c
set printed to false in new_room, also clear room array in for loop
SpiderBall Mar 31, 2015
efd7e52
removed printed bool, clearing room array may be sufficient
SpiderBall Mar 31, 2015
820522c
moved initialization of rooms outside of for loop
SpiderBall Mar 31, 2015
443ee1c
inserted to the subscriptions table
SpiderBall Mar 31, 2015
5f38c4a
added a line that may filter by subscription
SpiderBall Mar 31, 2015
64a8849
print statements, moved fetchall`
SpiderBall Mar 31, 2015
ab99395
initialized previousMessages
SpiderBall Mar 31, 2015
ad97454
making sure c9 is updated
SpiderBall Mar 31, 2015
eb44f27
reentered a line i deletedal'ksdfal
SpiderBall Mar 31, 2015
52e1193
added join leave stuff back
SpiderBall Mar 31, 2015
a35afa3
forgot to add scope to current room
SpiderBall Mar 31, 2015
2280b23
commented out username = data
SpiderBall Mar 31, 2015
6aa7259
commented stuff
SpiderBall Mar 31, 2015
93d17f0
what are strings
SpiderBall Mar 31, 2015
f89c298
python stuff
SpiderBall Mar 31, 2015
9301455
asopifaskl
SpiderBall Mar 31, 2015
55b5ed3
appended 0th element to session
SpiderBall Mar 31, 2015
b04ad0d
klh
SpiderBall Mar 31, 2015
b282a39
changed one of the room id to user id (since that was the intended use)
SpiderBall Apr 6, 2015
82714a7
deletes messages bt rooms
SpiderBall Apr 7, 2015
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
Binary file added .server.py.swo
Binary file not shown.
Binary file added .server.py.swp
Binary file not shown.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,36 @@ Welcome to your IRC project on Cloud9 IDE!
2. Messages stored in database.
3. When a user logs in they will see some list of previous messages.
4. Search. I can search for a particular term and see the results.

### Deliverables for Second Sprint
1. the chat supports multiple rooms (EXAMPLE CODE: https://bitbucket.org/zacharski/irc.git)
2. Users are subscribed to a set of rooms and cannot access rooms that they are not subscribed to.
3. When a user searches for something the search takes place only in posts in rooms they are subscribed to
4. all tables in 3NF
Earn more XP by implementing other features that rely on a db. (for ex, a register an account popup)

Still need to add stuff from Michelle's paper. She scribbled things while he was talking about stuff.

### You must host your code on github


we still need to :
cake is great!
- do search stuff
- make it fail gracefully when user is not in the thing
=======
I'm pretty sure this isn't right. Stuff down there at least. Not running server from .js what.

Welcome to your Node.js project on Cloud9 IDE!

This chat example showcases how to use `socket.io` with a static `express` server.

## Running the server

1) Open `server.js` and start the app by clicking on the "Run" button in the top menu.

2) Alternatively you can launch the app from the Terminal:

$ node server.js

Once the server is running, open the project in the shape of 'https://projectname-username.c9.io/'. As you enter your name, watch the Users list (on the left) update. Once you press Enter or Send, the message is shared with all connected clients.
60 changes: 60 additions & 0 deletions irc.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
DROP DATABASE IF EXISTS irc_db;
CREATE DATABASE irc_db;
\c irc_db

CREATE TABLE users (
id serial,
username varchar(30),
password varchar(30),
PRIMARY KEY (id)
);

CREATE TABLE rooms (
id serial UNIQUE,
roomname varchar(30),
/* user_in_room varchar(30), */
PRIMARY KEY (id)
);

CREATE TABLE subscriptions (
id serial,
room_id int NOT NULL,
user_id int NOT NULL,
PRIMARY KEY (id)
);

CREATE TABLE messages (
message_id serial,
original_poster_id int NOT NULL,
message_content VARCHAR(250),
room_id int NOT NULL,
PRIMARY KEY (message_id)
);

INSERT INTO users (id, username, password)
VALUES
(DEFAULT, 'SpiderBall', 'sb'),
(DEFAULT, 'MidnaPeach', 'mp'),
(DEFAULT, 'lz', 'lz');

INSERT INTO rooms (id, roomname)
VALUES
(DEFAULT, 'General'),
(DEFAULT, 'Happy'),
(DEFAULT, 'Sad'),
(DEFAULT, 'Hungry');


INSERT INTO subscriptions (id, room_id, user_id)
VALUES
(DEFAULT, 1, 1),
(DEFAULT, 1, 2),
(DEFAULT, 1, 3),
(DEFAULT, 2, 1),
(DEFAULT, 3, 2),
(DEFAULT, 4, 1),
(DEFAULT, 4, 2),
(DEFAULT, 3, 3);
/* sb is subscribed to happy hungry and general
mp is subscribed to general sad and hungry
lz is subscribed to general and sad */
23 changes: 23 additions & 0 deletions postgreSQLCommands.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Command cheat sheet

change column name
ALTER TABLE [tablename] RENAME COLUMN [oldname] TO [newname];

copy table
CREATE TABLE [newtablename] AS SELECT [columns] FROM [existing];

change column data type
ALTER TABLE[tablename] ALTER COLUMN [columnname] TYPE [newtype];

//first sprint thing
username, password

insert
INSERT INTO [tablename] VALUES
([value1],[value2], ... );




update
UPDATE [tablename] SET [column1]=[value1] ... WHERE [somecolumn] = [somevalue];
Loading