Add versioned DB migrations, startup error dialog and native basics
rusqlite_migration with a VACUUM INTO backup before upgrading; M2 adds GST registration, snapshot, cancellation and draft columns and backfills snapshots for existing invoices. Startup failures now show a native dialog instead of exiting silently. Adds single-instance and window-state plugins, minimum window 960x600, embedBootstrapper, DMABUF workaround on Linux and xbps dependency updates.
This commit is contained in:
@@ -5,7 +5,8 @@ use tauri::State;
|
||||
|
||||
const SETTINGS_COLS: &str = "vendor_name, vendor_address, vendor_email, vendor_phone, vendor_pan,
|
||||
vendor_gstin, vendor_state_code, logo_path, signature_path, default_bank_id, default_tax_rate,
|
||||
default_tax_type, payment_terms_days, currency, onboarded, theme";
|
||||
default_tax_type, payment_terms_days, currency, onboarded, theme, gst_registration, default_hsn_sac, signatory_name,
|
||||
signatory_designation";
|
||||
|
||||
fn map_settings(row: &Row) -> rusqlite::Result<Settings> {
|
||||
Ok(Settings {
|
||||
@@ -25,6 +26,10 @@ fn map_settings(row: &Row) -> rusqlite::Result<Settings> {
|
||||
currency: row.get(13)?,
|
||||
onboarded: row.get::<_, i64>(14)? != 0,
|
||||
theme: row.get(15)?,
|
||||
gst_registration: row.get(16)?,
|
||||
default_hsn_sac: row.get(17)?,
|
||||
signatory_name: row.get(18)?,
|
||||
signatory_designation: row.get(19)?,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -48,7 +53,8 @@ pub fn save_settings(state: State<AppState>, settings: Settings) -> Result<Setti
|
||||
vendor_pan = ?5, vendor_gstin = ?6, vendor_state_code = ?7, logo_path = ?8,
|
||||
signature_path = ?9, default_bank_id = ?10, default_tax_rate = ?11,
|
||||
default_tax_type = ?12, payment_terms_days = ?13, currency = ?14,
|
||||
onboarded = ?15, theme = ?16
|
||||
onboarded = ?15, theme = ?16, gst_registration = ?17, default_hsn_sac = ?18,
|
||||
signatory_name = ?19, signatory_designation = ?20
|
||||
WHERE id = 1"#,
|
||||
params![
|
||||
settings.vendor_name,
|
||||
@@ -67,6 +73,10 @@ pub fn save_settings(state: State<AppState>, settings: Settings) -> Result<Setti
|
||||
settings.currency,
|
||||
if settings.onboarded { 1 } else { 0 },
|
||||
settings.theme,
|
||||
settings.gst_registration,
|
||||
settings.default_hsn_sac,
|
||||
settings.signatory_name,
|
||||
settings.signatory_designation,
|
||||
],
|
||||
)
|
||||
.map_err(|e| e.to_string())?;
|
||||
|
||||
Reference in New Issue
Block a user