* db changes required for minimal sessions API

This commit is contained in:
Seth Call 2012-10-02 22:46:28 -05:00
parent 562eaea844
commit f3c21dba51
3 changed files with 25 additions and 1 deletions

2
build
View File

@ -21,7 +21,7 @@ mkdir -p $PG_RUBY_PACKAGE_OUT
bundle update
echo "building migrations"
bundle exec pg_migrate build --source . --out $PG_BUILD_OUT
bundle exec pg_migrate build --source . --out $PG_BUILD_OUT --test --verbose
echo "packaging migrations for ruby"bundle exec pg_migrate package --source $PG_BUILD_OUT --out $PG_RUBY_PACKAGE_OUT --name jam-db --version "0.0.1"
bundle exec pg_migrate package --source $PG_BUILD_OUT --out $PG_RUBY_PACKAGE_OUT --name $PROJECT_NAME --version $BUILD_NUMBER

View File

@ -1 +1,2 @@
sessions.sql
sessions_api_v1.sql

23
up/sessions_api_v1.sql Normal file
View File

@ -0,0 +1,23 @@
ALTER TABLE jam_sessions DROP COLUMN public;
-- rename 'name' to 'description' to match product specification terminology
ALTER TABLE jam_sessions RENAME name TO description;
-- rename jam_sessions to more generic 'music_sessions'
ALTER TABLE jam_sessions RENAME TO music_sessions;
-- get rid of early version of member table
DROP TABLE jam_session_members;
-- one row is created per connected client
CREATE TABLE music_session_clients (
id VARCHAR(64) PRIMARY KEY DEFAULT uuid_generate_v4(),
user_id VARCHAR(64) REFERENCES users(id) ON DELETE CASCADE,
music_session_id VARCHAR(64) REFERENCES music_sessions(id) ON DELETE CASCADE,
ip_address VARCHAR(64) NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);