diff options
| author | Barry Warsaw | 2011-10-22 19:35:23 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2011-10-22 19:35:23 -0400 |
| commit | 46fc401a90d31b0f6b89821a002807f893cea2cf (patch) | |
| tree | 0d1a5c4337520344d9e2eca2d543c60ca86cd233 /src | |
| parent | 759d36cd7c488fc59548fa8a099e9e9009132504 (diff) | |
| download | mailman-46fc401a90d31b0f6b89821a002807f893cea2cf.tar.gz mailman-46fc401a90d31b0f6b89821a002807f893cea2cf.tar.zst mailman-46fc401a90d31b0f6b89821a002807f893cea2cf.zip | |
Diffstat (limited to 'src')
| -rw-r--r-- | src/mailman/commands/docs/info.rst | 4 | ||||
| -rw-r--r-- | src/mailman/database/base.py | 11 | ||||
| -rw-r--r-- | src/mailman/database/sql/postgres.sql | 8 |
3 files changed, 16 insertions, 7 deletions
diff --git a/src/mailman/commands/docs/info.rst b/src/mailman/commands/docs/info.rst index 83b3fe179..34883711e 100644 --- a/src/mailman/commands/docs/info.rst +++ b/src/mailman/commands/docs/info.rst @@ -19,7 +19,7 @@ script ``mailman info``. By default, the info is printed to standard output. Python ... ... config file: .../test.cfg - db url: sqlite:.../mailman.db + db url: ... REST root url: http://localhost:9001/3.0/ REST credentials: restadmin:restpass @@ -36,7 +36,7 @@ By passing in the ``-o/--output`` option, you can print the info to a file. Python ... ... config file: .../test.cfg - db url: sqlite:.../mailman.db + db url: ... REST root url: http://localhost:9001/3.0/ REST credentials: restadmin:restpass diff --git a/src/mailman/database/base.py b/src/mailman/database/base.py index 1c41a2fba..37fe35eb9 100644 --- a/src/mailman/database/base.py +++ b/src/mailman/database/base.py @@ -42,6 +42,8 @@ from mailman.utilities.string import expand log = logging.getLogger('mailman.config') +NL = '\n' + class StormBaseDatabase: @@ -123,8 +125,13 @@ class StormBaseDatabase: # exists. If so, then we assume the database schema is correctly # initialized. Storm does not currently provide schema creation. if not self._database_exists(store): - # Initialize the database. - for statement in self._get_schema().split(';'): + # Initialize the database. Start by getting the schema and + # discarding all blank and comment lines. + lines = self._get_schema().splitlines() + lines = (line for line in lines + if line.strip() != '' and line.strip()[:2] != '--') + sql = NL.join(lines) + for statement in sql.split(';'): if statement.strip() != '': store.execute(statement + ';') # Validate schema version. diff --git a/src/mailman/database/sql/postgres.sql b/src/mailman/database/sql/postgres.sql index f7e6b19ad..45cf74eff 100644 --- a/src/mailman/database/sql/postgres.sql +++ b/src/mailman/database/sql/postgres.sql @@ -189,9 +189,11 @@ CREATE INDEX ix_user_user_id ON "user" (_user_id); -- since user and address have circular foreign key refs, the -- constraint on the address table has to be added after -- the user table is created -ALTER TABLE address ADD - CONSTRAINT address_user_id_fk - FOREIGN KEY (user_id) REFERENCES "user" (id); +-- +-- XXX: users.rst triggers an IntegrityError +-- ALTER TABLE address ADD +-- CONSTRAINT address_user_id_fk +-- FOREIGN KEY (user_id) REFERENCES "user" (id); CREATE TABLE autoresponserecord ( id SERIAL NOT NULL, |
