コード例 #1
0
    def register_database(self):
        from masoniteorm.query import QueryBuilder

        self.application.bind(
            "builder",
            QueryBuilder(connection_details=load(
                self.application.make("config.database")).DATABASES),
        )
        self.application.bind("migrations.location",
                              "tests/integrations/databases/migrations")
        self.application.bind("seeds.location",
                              "tests/integrations/databases/seeds")
コード例 #2
0
    def register_database(self):
        from masoniteorm.query import QueryBuilder

        self.application.bind(
            "builder",
            QueryBuilder(connection_details=config("database.databases")),
        )

        self.application.bind("migrations.location", "databases/migrations")
        self.application.bind("seeds.location", "databases/seeds")

        self.application.bind("resolver", config("database.db"))
コード例 #3
0
        "password": env("DB_PASSWORD"),
        "database": env("DB_DATABASE"),
        "port": "5432",
        "prefix": "",
        "grammar": "postgres",
    },
    "sqlite": {
        "driver": "sqlite",
        "database": "orm.sqlite3",
        "prefix": ""
    },
}

ConnectionResolver.set_connection_details(DATABASES)

DB = QueryBuilder(connection_details=DATABASES)

# DATABASES = {
#     'default': os.environ.get('DB_DRIVER'),
#     'sqlite': {
#         'driver': 'sqlite',
#         'database': os.environ.get('DB_DATABASE')
#     },
#     'postgres': {
#         'driver': 'postgres',
#         'host': env('DB_HOST'),
#         'database': env('DB_DATABASE'),
#         'port': env('DB_PORT'),
#         'user': env('DB_USERNAME'),
#         'password': env('DB_PASSWORD'),
#         'log_queries': env('DB_LOG'),