Skip to content
Snippets Groups Projects
Commit 3e85e52b authored by Mark Haines's avatar Mark Haines
Browse files

Allow ':memory:' as the database path for sqlite3

parent 5fed0426
No related branches found
No related tags found
No related merge requests found
...@@ -247,7 +247,13 @@ def setup(): ...@@ -247,7 +247,13 @@ def setup():
logger.info("Database prepared in %s.", db_name) logger.info("Database prepared in %s.", db_name)
hs.get_db_pool() db_pool = hs.get_db_pool()
if db_name == ":memory:"
# Memory databases will need to be setup each time they are opened.
reactor.callWhenRunning(
hs.get_db_pool().runWithConnection, prepare_database
)
if config.manhole: if config.manhole:
f = twisted.manhole.telnet.ShellFactory() f = twisted.manhole.telnet.ShellFactory()
......
...@@ -20,7 +20,10 @@ import os ...@@ -20,7 +20,10 @@ import os
class DatabaseConfig(Config): class DatabaseConfig(Config):
def __init__(self, args): def __init__(self, args):
super(DatabaseConfig, self).__init__(args) super(DatabaseConfig, self).__init__(args)
self.database_path = self.abspath(args.database_path) if args.database_path == ":memory:":
self.database_path = ":memory:"
else:
self.database_path = self.abspath(args.database_path)
@classmethod @classmethod
def add_arguments(cls, parser): def add_arguments(cls, parser):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment