Mercurial > p > roundup > code
comparison roundup/backends/back_postgresql.py @ 2746:adce02da25b7 maint-0.7
merge from HEAD
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Fri, 08 Oct 2004 08:10:59 +0000 |
| parents | 4dd01588db90 |
| children | d3a5e382d44a |
comparison
equal
deleted
inserted
replaced
| 2744:4dd01588db90 | 2746:adce02da25b7 |
|---|---|
| 88 | 88 |
| 89 class Database(rdbms_common.Database): | 89 class Database(rdbms_common.Database): |
| 90 arg = '%s' | 90 arg = '%s' |
| 91 | 91 |
| 92 def sql_open_connection(self): | 92 def sql_open_connection(self): |
| 93 raise NotImplementedError, "Please don't use me just yet..." | |
| 94 db = getattr(self.config, 'POSTGRESQL_DATABASE') | 93 db = getattr(self.config, 'POSTGRESQL_DATABASE') |
| 95 try: | 94 try: |
| 96 conn = psycopg.connect(**db) | 95 conn = psycopg.connect(**db) |
| 97 except psycopg.OperationalError, message: | 96 except psycopg.OperationalError, message: |
| 98 raise hyperdb.DatabaseError, message | 97 raise hyperdb.DatabaseError, message |
| 158 %s_value VARCHAR(255), %s_time REAL)'''%(name, name, name, | 157 %s_value VARCHAR(255), %s_time REAL)'''%(name, name, name, |
| 159 name)) | 158 name)) |
| 160 c.execute('CREATE INDEX %ss_key_idx ON %ss(%s_key)'%(name, name, | 159 c.execute('CREATE INDEX %ss_key_idx ON %ss(%s_key)'%(name, name, |
| 161 name)) | 160 name)) |
| 162 | 161 |
| 162 def fix_version_3_tables(self): | |
| 163 rdbms_common.Database.fix_version_3_tables(self) | |
| 164 self.cursor.execute('''CREATE INDEX words_both_idx ON public.__words | |
| 165 USING btree (_word, _textid)''') | |
| 166 | |
| 163 def add_actor_column(self): | 167 def add_actor_column(self): |
| 164 # update existing tables to have the new actor column | 168 # update existing tables to have the new actor column |
| 165 tables = self.database_schema['tables'] | 169 tables = self.database_schema['tables'] |
| 166 for name in tables.keys(): | 170 for name in tables.keys(): |
| 167 self.cursor.execute('ALTER TABLE _%s add __actor ' | 171 self.cursor.execute('ALTER TABLE _%s add __actor ' |
