diff options
Diffstat (limited to 'db/schema_0001.sql')
-rw-r--r-- | db/schema_0001.sql | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/db/schema_0001.sql b/db/schema_0001.sql new file mode 100644 index 000000000..88bed06c6 --- /dev/null +++ b/db/schema_0001.sql @@ -0,0 +1,36 @@ +-- These are changes needed to the schema to support moving over to DBIx::Class + +begin; + +-- table for sessions - needed by Catalyst::Plugin::Session::Store::DBIC +CREATE TABLE sessions ( + id CHAR(72) PRIMARY KEY, + session_data TEXT, + expires INTEGER +); + +-- users table +create table users ( + id serial not null primary key, + email text not null unique, + name text, + password text not null +); + +-- add PK to contacts table +ALTER TABLE contacts + ADD COLUMN id SERIAL PRIMARY KEY; + +AlTER TABLE contacts_history + ADD COLUMN contact_id integer; + +update contacts_history + set contact_id = ( + select id + from contacts + where contacts_history.category = contacts.category + and contacts_history.area_id = contacts.area_id + ); + +-- rollback; +commit; |