File tree Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 11# Changelog
22
3+ ## [ unreleased]
4+
5+ ### Fixed
6+
7+ * cli: Fixed ` schema init ` command crash with SQLite databases.
8+
39## 5.0.0 - 2022-04-08
410
511This release contains no changes except for the version number.
Original file line number Diff line number Diff line change 4545from dipdup .models import Index
4646from dipdup .models import Schema
4747from dipdup .utils import iter_files
48- from dipdup .utils .database import execute_sql_scripts
48+ from dipdup .utils .database import generate_schema
4949from dipdup .utils .database import set_decimal_context
5050from dipdup .utils .database import tortoise_wrapper
5151from dipdup .utils .database import wipe_schema
@@ -397,8 +397,7 @@ async def schema_init(ctx):
397397
398398 # NOTE: It's not necessary a reindex, but it's safe to execute built-in scripts to (re)create views.
399399 conn = get_connection (None )
400- sql_path = join (dirname (__file__ ), 'sql' , 'on_reindex' )
401- await execute_sql_scripts (conn , sql_path )
400+ await generate_schema (conn , config .database .schema_name )
402401
403402 _logger .info ('Schema initialized' )
404403
Original file line number Diff line number Diff line change @@ -79,6 +79,10 @@ class SqliteDatabaseConfig:
7979 kind : Literal ['sqlite' ]
8080 path : str = DEFAULT_SQLITE_PATH
8181
82+ @property
83+ def schema_name (self ) -> str :
84+ return 'public'
85+
8286 @cached_property
8387 def connection_string (self ) -> str :
8488 return f'{ self .kind } ://{ self .path } '
You can’t perform that action at this time.
0 commit comments