From a4291d64cea2c9190ef190d85b4a858e111554e2 Mon Sep 17 00:00:00 2001
From: Ciaran Gultnieks <ciaran@thurlow.(none)>
Date: Mon, 26 Jan 2009 20:36:02 +0000
Subject: PostgreSQL - remaining changes to fix db create script up to laconica
 0.6.4 level

---
 db/laconica_pg.sql | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

(limited to 'db/laconica_pg.sql')

diff --git a/db/laconica_pg.sql b/db/laconica_pg.sql
index eb0dfc0ee..c3efd9daa 100644
--- a/db/laconica_pg.sql
+++ b/db/laconica_pg.sql
@@ -49,7 +49,7 @@ create table "user" (
     emailnotifysub integer default 1 /* comment 'Notify by email of subscriptions' */,
     emailnotifyfav integer default 1 /* comment 'Notify by email of favorites' */,
     emailnotifynudge integer default 1 /* comment 'Notify by email of nudges' */,
-    emailnotifymsg integer default 1 / * comment 'Notify by email of direct messages' */,
+    emailnotifymsg integer default 1 /* comment 'Notify by email of direct messages' */,
 emailmicroid integer default 1 /* comment 'whether to publish email microid' */,
     language varchar(50) /* comment 'preferred language' */,
     timezone varchar(50) /* comment 'timezone' */,
@@ -88,8 +88,8 @@ create table remote_profile (
 create table subscription (
     subscriber integer not null /* comment 'profile listening' */,
     subscribed integer not null /* comment 'profile being listened to' */,
-    jabber integer default 1 /* comment 'deliver jabber messages',
-    sms integer default 1 comment 'deliver sms messages',
+    jabber integer default 1 /* comment 'deliver jabber messages' */,
+    sms integer default 1 /* comment 'deliver sms messages' */,
     token varchar(255) /* comment 'authorization token' */,
     secret varchar(255) /* comment 'token secret' */,
     created timestamp not null /* comment 'date this record was created' */,
@@ -271,7 +271,7 @@ create table foreign_service (
 );
 
 create table foreign_user (
-     id int not null /* comment 'unique numeric key on foreign service' */,
+     id int not null unique /* comment 'unique numeric key on foreign service' */,
      service int not null /* comment 'foreign key to service' */ references foreign_service(id) ,
      uri varchar(255) not null unique /* comment 'identifying URI' */,
      nickname varchar(255) /* comment 'nickname on foreign service' */,
@@ -280,15 +280,14 @@ create table foreign_user (
      
      primary key (id, service)
 );
-create index foreign_user_user_id_idx on foreign_user using btree(user_id);
 
 create table foreign_link (
      user_id int /* comment 'link to user on this system, if exists' */ references "user" (id),
      foreign_id int /* comment 'link' */ references foreign_user (id),
      service int not null /* comment 'foreign key to service' */ references foreign_service (id),
-     credentials varchar(255) /* comment 'authc credentials, typically a password',
+     credentials varchar(255) /* comment 'authc credentials, typically a password' */,
      noticesync int not null default 1 /* comment 'notice synchronisation, bit 1 = sync outgoing, bit 2 = sync incoming, bit 3 = filter local replies' */,
-     friendsync int not null default 2 /* comment 'friend synchronisation, bit 1 = sync outgoing, bit 2 = sync incoming 
+     friendsync int not null default 2 /* comment 'friend synchronisation, bit 1 = sync outgoing, bit 2 = sync incoming */, 
      created timestamp not null /* comment 'date this record was created' */,
      modified timestamp not null /* comment 'date this record was modified' */,
 
@@ -300,7 +299,7 @@ create table foreign_subscription (
      service int not null /* comment 'service where relationship happens' */ references foreign_service(id) ,
      subscriber int not null /* comment 'subscriber on foreign service' */ ,
      subscribed int not null /* comment 'subscribed user' */ ,
-     created timestamp not null /* comment 'date this record was created' /,
+     created timestamp not null /* comment 'date this record was created' */,
      
      primary key (service, subscriber, subscribed)
 );
@@ -338,14 +337,14 @@ create index message_created_idx on message using btree(created);
 
 create table notice_inbox (
 
-    user_id integer not null /* comment 'user receiving the message' */ references user (id),
+    user_id integer not null /* comment 'user receiving the message' */ references "user" (id),
     notice_id integer not null /* comment 'notice received' */ references notice (id),
-    created datetime not null /* comment 'date the notice was created' */,
+    created timestamp not null /* comment 'date the notice was created' */,
     source integer default 1 /* comment 'reason it is in the inbox; 1=subscription' */,
 
     primary key (user_id, notice_id)
 );
-create index notice_inbox_notice_id_idx (notice_id) on notice_inbox using btree(notice_id);
+create index notice_inbox_notice_id_idx on notice_inbox using btree(notice_id);
 
 create table profile_tag (
    tagger integer not null /* comment 'user making the tag' */ references "user" (id),
@@ -360,7 +359,7 @@ create index profile_tag_tagger_tag_idx on profile_tag using btree(tagger,tag);
 
 create table profile_block (
 
-   blocker integer not null i/* comment 'user making the block' */ references user (id),
+   blocker integer not null /* comment 'user making the block' */ references "user" (id),
    blocked integer not null /* comment 'profile that is blocked' */ references profile (id),
    modified timestamp /* comment 'date of blocking' */,
 
-- 
cgit v1.2.3-54-g00ecf

