Mercurial > p > roundup > code
comparison roundup/backends/back_postgresql.py @ 2093:3f6024ab2c7a
That's the last of the RDBMS migration steps done! Yay!
Note that the code currently has some unit testing issues:
- Metakit needs some attention in a couple of areas
- RDBMS backends are having trouble ordering their journal entries
correctly. I'm going to be migrating them to use TIMESTAMP for the date
column, but that's not necessarily going to fix things as mysql and
postgresql both appear to have second granularity. Sqlite will ignore
the data type as usual ;)
Next up is the datatype-ification of the RDBMS backends. Part of that will
involve the migration to numeric IDs, which will also be done in the *dbm
backends (already done in metakit). The ID exposed *above* the hyperdb
will be String, since so many things assume a string ID now.
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Sun, 21 Mar 2004 23:39:08 +0000 |
| parents | 93f03c6714d8 |
| children | 18addf2a8596 |
comparison
equal
deleted
inserted
replaced
| 2091:0e6db4462896 | 2093:3f6024ab2c7a |
|---|---|
| 111 self.sql("CREATE TABLE ids (name VARCHAR(255), num INT4)") | 111 self.sql("CREATE TABLE ids (name VARCHAR(255), num INT4)") |
| 112 self.sql("CREATE INDEX ids_name_idx ON ids(name)") | 112 self.sql("CREATE INDEX ids_name_idx ON ids(name)") |
| 113 self.create_version_2_tables() | 113 self.create_version_2_tables() |
| 114 | 114 |
| 115 def create_version_2_tables(self): | 115 def create_version_2_tables(self): |
| 116 # OTK store | |
| 116 self.cursor.execute('CREATE TABLE otks (otk_key VARCHAR(255), ' | 117 self.cursor.execute('CREATE TABLE otks (otk_key VARCHAR(255), ' |
| 117 'otk_value VARCHAR(255), otk_time FLOAT(20))') | 118 'otk_value VARCHAR(255), otk_time FLOAT(20))') |
| 118 self.cursor.execute('CREATE INDEX otks_key_idx ON otks(otk_key)') | 119 self.cursor.execute('CREATE INDEX otks_key_idx ON otks(otk_key)') |
| 120 | |
| 121 # Sessions store | |
| 119 self.cursor.execute('CREATE TABLE sessions (session_key VARCHAR(255), ' | 122 self.cursor.execute('CREATE TABLE sessions (session_key VARCHAR(255), ' |
| 120 'session_time FLOAT(20), session_value VARCHAR(255))') | 123 'session_time FLOAT(20), session_value VARCHAR(255))') |
| 121 self.cursor.execute('CREATE INDEX sessions_key_idx ON ' | 124 self.cursor.execute('CREATE INDEX sessions_key_idx ON ' |
| 122 'sessions(session_key)') | 125 'sessions(session_key)') |
| 126 | |
| 127 # full-text indexing store | |
| 128 self.cursor.execute('CREATE TABLE _textids (_class VARCHAR(255), ' | |
| 129 '_itemid VARCHAR(255), _prop VARCHAR(255), _textid INT4) ') | |
| 130 self.cursor.execute('CREATE TABLE _words (_word VARCHAR(30), ' | |
| 131 '_textid INT4)') | |
| 132 self.cursor.execute('CREATE INDEX words_word_ids ON _words(_word)') | |
| 133 sql = 'insert into ids (name, num) values (%s,%s)'%(self.arg, self.arg) | |
| 134 self.cursor.execute(sql, ('_textids', 1)) | |
| 123 | 135 |
| 124 def add_actor_column(self): | 136 def add_actor_column(self): |
| 125 # update existing tables to have the new actor column | 137 # update existing tables to have the new actor column |
| 126 tables = self.database_schema['tables'] | 138 tables = self.database_schema['tables'] |
| 127 for name in tables.keys(): | 139 for name in tables.keys(): |
